diff --git a/applications/poisson_dg/poisson_dg.mini b/applications/poisson_dg/poisson_dg.mini index 38b5f7751d582767852c184f3bd4f3344cef975f..e7a0eedf624a78760143f777449033c3fcafefb2 100644 --- a/applications/poisson_dg/poisson_dg.mini +++ b/applications/poisson_dg/poisson_dg.mini @@ -1,10 +1,15 @@ -__name = app_poisson_dg +__name = app_poisson_dg_{__exec_suffix} +__exec_suffix = deg{formcompiler.ufl_variants.degree} -lowerleft = 0.0 0.0 -upperright = 1.0 1.0 -elements = 32 32 -elementType = simplical +extension = 1.0 1.0 1.0 +cells = 16 16 16 [wrapper.vtkcompare] name = {__name} extension = vtu + +[formcompiler] +sumfact = 1 + +[formcompiler.ufl_variants] +degree = 1, 2 | expand diff --git a/applications/poisson_dg/poisson_dg.ufl b/applications/poisson_dg/poisson_dg.ufl index c34e0d2c802b406afa6761c92496e12e37dd9772..6a7e50f7e9f28f333304e713214f77516d00fe45 100644 --- a/applications/poisson_dg/poisson_dg.ufl +++ b/applications/poisson_dg/poisson_dg.ufl @@ -4,7 +4,7 @@ x = SpatialCoordinate(cell) f = -6. g = x[0]*x[0] + x[1]*x[1] + x[2]*x[2] -V = FiniteElement("DG", cell, 1) +V = FiniteElement("DG", cell, degree) u = TrialFunction(V) v = TestFunction(V) diff --git a/python/dune/perftool/compile.py b/python/dune/perftool/compile.py index e1e0929436070f72fd972bdbc5aee1ae35c12245..43acf90bf87ee93f8860c3b90dea48d3961562a1 100644 --- a/python/dune/perftool/compile.py +++ b/python/dune/perftool/compile.py @@ -41,7 +41,25 @@ def read_ufl(uflfile): """ # Read the given ufl file and execute it uflcode = read_ufl_file(uflfile) + + # Prepopulate a namespace with variation information namespace = globals() + ini = get_option("ini_file") + if ini: + from dune.common.parametertree.parser import parse_ini_file + ini = parse_ini_file(ini) + + def type_guessing(val): + for t in [int, float]: + try: + return t(val) + except TypeError: + pass + return val + + for k, v in ini.get("formcompiler.ufl_variants", {}).items(): + namespace[k] = type_guessing(v) + try: exec("from dune.perftool.ufl.execution import *\n" + uflcode, namespace) except: