diff --git a/python/dune/perftool/pdelab/parameter.py b/python/dune/perftool/pdelab/parameter.py index 1b2fc0f37259659a1af7b2be6faa2923caa8444e..c5f20afe83f2e916a00c0258dec0a2221563b985 100644 --- a/python/dune/perftool/pdelab/parameter.py +++ b/python/dune/perftool/pdelab/parameter.py @@ -99,7 +99,8 @@ def evaluate_intersectionwise_constant_parameter_function(name): pos = name_quadrature_position() from dune.perftool.generation.loopy import valuearg - define_parameter_funciton(name) + import numpy + define_parameter_function(name) valuearg(name, dtype=numpy.float64) return '{} = {}.{}({}, {});'.format(name, diff --git a/python/dune/perftool/ufl/execution.py b/python/dune/perftool/ufl/execution.py index 6e2a7d8c04268b9a0edc5863d9ea03b06ae8d705..fb0aa6b5d008dd028f3d7903c3b57a43ed728842 100644 --- a/python/dune/perftool/ufl/execution.py +++ b/python/dune/perftool/ufl/execution.py @@ -76,17 +76,20 @@ class Expression(Coefficient): class VectorExpression(Coefficient): - def __init__(self, expr, is_global=True, on_intersection=False, cell_type="triangle"): + def __init__(self, expr, is_global=True, on_intersection=False, cell_type="triangle", cellwise_constant=False): assert isinstance(expr, str) self.c_expr = expr self.is_global = is_global self.on_intersection = on_intersection # Avoid ufl complaining about not matching dimension/cells - _dg0vec = VectorElement("DG", cell_type, 0) + if cellwise_constant: + _dgvec = VectorElement("DG", cell_type, 0) + else: + _dgvec = VectorElement("DG", cell_type, 1) # Initialize a coefficient with a dummy finite element map. - Coefficient.__init__(self, _dg0vec) + Coefficient.__init__(self, _dgvec) # TODO the subdomain_data code needs a uflid, not idea how to get it here # The standard way through class decorator fails here...