From 7d57386ab0441e6bb3b7ac48a26bce0dafbfc577 Mon Sep 17 00:00:00 2001
From: Dominic Kempf <dominic.kempf@iwr.uni-heidelberg.de>
Date: Wed, 26 Apr 2017 16:26:12 +0200
Subject: [PATCH] Optimize FacetNomral in the axiparallel case

---
 python/dune/perftool/ufl/visitor.py | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/python/dune/perftool/ufl/visitor.py b/python/dune/perftool/ufl/visitor.py
index 2ecb0b99..b82b7fc9 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:
-- 
GitLab