diff --git a/python/dune/perftool/ufl/visitor.py b/python/dune/perftool/ufl/visitor.py index 2ecb0b999c30e3553e116682fc1b20e15ccf8780..b82b7fc9b2b7c2c86a68389a8bca3a22ca0b6327 100644 --- a/python/dune/perftool/ufl/visitor.py +++ b/python/dune/perftool/ufl/visitor.py @@ -362,6 +362,15 @@ class UFL2LoopyVisitor(ModifiedTerminalTracker): # The normal must be restricted to be well-defined assert self.restriction is not Restriction.NONE + # Optimize facet normal on axiparallel grids + from dune.perftool.options import get_option + if get_option("diagonal_transformation_matrix"): + index, = self.indices + from dune.perftool.sumfact.switch import get_facedir + if isinstance(index, int) and index != get_facedir(self.restriction): + self.indices = None + return 0 + if self.restriction == Restriction.POSITIVE: return Variable(self.interface.name_unit_outer_normal()) if self.restriction == Restriction.NEGATIVE: