diff --git a/python/dune/perftool/pdelab/driver/constraints.py b/python/dune/perftool/pdelab/driver/constraints.py index d6c021f220ba865dfa9aed1d0b329b2a2bea71cc..dc65354a08452b783a377f53f401e8b7f445c766 100644 --- a/python/dune/perftool/pdelab/driver/constraints.py +++ b/python/dune/perftool/pdelab/driver/constraints.py @@ -1,4 +1,5 @@ -from dune.perftool.generation import (global_context, +from dune.perftool.generation import (get_counted_variable, + global_context, include_file, preamble, ) @@ -52,12 +53,10 @@ def assemble_constraints(name): def name_bctype_function(element, is_dirichlet): - if isinstance(element, (VectorElement, TensorElement)): - subel = element.sub_elements()[0] - child = name_bctype_function(subel, is_dirichlet[:subel.value_size()]) - name = "{}_pow{}bctype".format(child, element.num_sub_elements()) - define_power_bctype_function(element, name, child) - return name + # Note: Previously, there was a separate code branch for VectorElement here, + # which was implemented through PDELabs Power constraints concept. + # However this completely fails if you have different constraints for + # the children of a VectorElement. We therefore omit this branch completely. if isinstance(element, MixedElement): k = 0 childs = [] @@ -69,7 +68,7 @@ def name_bctype_function(element, is_dirichlet): return name else: assert isinstance(element, (FiniteElement, TensorProductElement)) - name = "{}_bctype".format(FEM_name_mangling(element).lower()) + name = get_counted_variable("bctype") define_bctype_function(element, is_dirichlet[0], name) return name @@ -85,12 +84,6 @@ def define_bctype_function(element, is_dirichlet, name): ) -@preamble(section="constraints") -def define_power_bctype_function(element, name, subgfs): - include_file('dune/pdelab/constraints/common/constraintsparameters.hh', filetag='driver') - return "Dune::PDELab::PowerConstraintsParameters<decltype({}), {}> {}({});".format(subgfs, element.num_sub_elements(), name, subgfs) - - @preamble(section="constraints") def define_composite_bctype_function(element, is_dirichlet, name, subgfs): include_file('dune/pdelab/constraints/common/constraintsparameters.hh', filetag='driver') diff --git a/python/dune/perftool/pdelab/driver/visitor.py b/python/dune/perftool/pdelab/driver/visitor.py index 447f3d535244b3588680d54234dbc7d656c51b8f..c126e40d79a02b32501390ecf76f6c3bded07f72 100644 --- a/python/dune/perftool/pdelab/driver/visitor.py +++ b/python/dune/perftool/pdelab/driver/visitor.py @@ -22,6 +22,10 @@ class DriverUFL2PymbolicVisitor(UFL2LoopyVisitor): ret = self._call(expr, False) return set(self.preambles), ret + def facet_normal(self, o): + self.preambles.append("auto n=is.unitOuterNormal(xl);") + return prim.Variable("n") + def spatial_coordinate(self, o): self.preambles.append("auto x=is.geometry().global(xl);") return prim.Variable("x")