From 3da16edaa1cbcec07d73e7e9df2966d1127b4444 Mon Sep 17 00:00:00 2001
From: Marcel Koch <marcel.koch@uni-muenster.de>
Date: Thu, 25 Oct 2018 10:56:43 +0200
Subject: [PATCH] use custom to_global only for volume integrals

---
 .../dune/perftool/blockstructured/geometry.py | 19 +++++++++++++++----
 python/dune/perftool/pdelab/geometry.py       |  2 +-
 2 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/python/dune/perftool/blockstructured/geometry.py b/python/dune/perftool/blockstructured/geometry.py
index 63bbaa41..dc9e48e1 100644
--- a/python/dune/perftool/blockstructured/geometry.py
+++ b/python/dune/perftool/blockstructured/geometry.py
@@ -2,7 +2,8 @@ from dune.perftool.pdelab.restriction import restricted_name
 
 from dune.perftool.generation import (get_backend,
                                       temporary_variable,
-                                      instruction)
+                                      instruction,
+                                      get_global_context_value)
 from dune.perftool.tools import get_pymbolic_basename
 from dune.perftool.options import (get_form_option,
                                    option_switch, get_option)
@@ -375,8 +376,18 @@ def apply_constant_to_global_transformation(name, local):
 def to_global(local):
     macro = name_point_in_macro(local)
     name = macro + "_global"
-    if get_form_option("constant_transformation_matrix"):
-        apply_constant_to_global_transformation(name, prim.Variable(macro))
+
+    it = get_global_context_value("integral_type")
+
+    if it == 'cell':
+        if get_form_option("constant_transformation_matrix"):
+            apply_constant_to_global_transformation(name, prim.Variable(macro))
+        else:
+            apply_default_to_global_transformation(name, prim.Variable(macro))
+    elif it == 'exterior_facet' or it == 'interior_facet':
+        from dune.perftool.pdelab.geometry import apply_to_global_transformation
+        apply_to_global_transformation(name, prim.Variable(macro))
     else:
-        apply_default_to_global_transformation(name, prim.Variable(macro))
+        raise NotImplementedError
+
     return prim.Variable(name)
diff --git a/python/dune/perftool/pdelab/geometry.py b/python/dune/perftool/pdelab/geometry.py
index e7e9b734..1eebaae3 100644
--- a/python/dune/perftool/pdelab/geometry.py
+++ b/python/dune/perftool/pdelab/geometry.py
@@ -507,7 +507,7 @@ def define_element_corners(name):
     iname = "i_corner"
     domain(iname, n_corners)
     from dune.perftool.generation import instruction
-    instruction(code="{0}[{1}] = {2}.corner({3});".format(name, iname, name_cell_geometry(Restriction.NONE), iname),
+    instruction(code="{0}[{1}] = {2}.corner({3});".format(name, iname, name_geometry(), iname),
                 assignees=frozenset({name}),
                 within_inames=frozenset({iname}), within_inames_is_final=True)
 
-- 
GitLab