From fc4b685f1a287758297581fed0682744490fc169 Mon Sep 17 00:00:00 2001
From: Marcel Koch <marcel.koch@uni-muenster.de>
Date: Wed, 24 Oct 2018 16:13:44 +0200
Subject: [PATCH] make dimension independent

---
 python/dune/perftool/blockstructured/geometry.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/python/dune/perftool/blockstructured/geometry.py b/python/dune/perftool/blockstructured/geometry.py
index ae8e0671..31f5ac01 100644
--- a/python/dune/perftool/blockstructured/geometry.py
+++ b/python/dune/perftool/blockstructured/geometry.py
@@ -313,7 +313,8 @@ def name_point_in_macro(point_in_micro):
 
 
 def apply_constant_to_global_transformation(name, local):
-    temporary_variable(name, shape=(world_dimension(),), managed=True)
+    dim = world_dimension()
+    temporary_variable(name, shape=(dim,), managed=True)
     corners = name_element_corners()
 
     if isinstance(local, str):
@@ -324,7 +325,7 @@ def apply_constant_to_global_transformation(name, local):
     # global[d] = lower_left[d] + local[d] * (upper_right[d] - lower_left[d])
     expr = prim.Sum((prim.Subscript(prim.Variable(corners), (0,prim.Variable(d))),
                      prim.Product((prim.Subscript(local, (prim.Variable(d),)),
-                                   prim.Sum((prim.Subscript(prim.Variable(corners), (3, prim.Variable(d))),
+                                   prim.Sum((prim.Subscript(prim.Variable(corners), (2**dim - 1, prim.Variable(d))),
                                              -1 * prim.Subscript(prim.Variable(corners), (0, prim.Variable(d)))))
                                    ))
                      ))
-- 
GitLab