From bee3bfdfdbb6eb97144d629c22b97aa7bd9d2d45 Mon Sep 17 00:00:00 2001
From: Martin Bauer <martin.bauer@fau.de>
Date: Wed, 26 Jul 2017 13:11:20 +0200
Subject: [PATCH] pystencils: easy access to center

---
 field.py           | 4 ++++
 transformations.py | 3 ++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/field.py b/field.py
index 5be82e170..97a5893a9 100644
--- a/field.py
+++ b/field.py
@@ -204,6 +204,10 @@ class Field(object):
         offsetList[coordId] = offset
         return Field.Access(self, tuple(offsetList))
 
+    def center(self):
+        center = tuple([0] * self.spatialDimensions)
+        return Field.Access(self, center)
+
     def __getitem__(self, offset):
         if type(offset) is np.ndarray:
             offset = tuple(offset)
diff --git a/transformations.py b/transformations.py
index 1c9732eb0..afad758d1 100644
--- a/transformations.py
+++ b/transformations.py
@@ -540,7 +540,8 @@ def getOptimalLoopOrdering(fields):
 
     layouts = set([field.layout for field in fields])
     if len(layouts) > 1:
-        raise ValueError("Due to different layout of the fields no optimal loop ordering exists " + str(layouts))
+        raise ValueError("Due to different layout of the fields no optimal loop ordering exists " +
+                         str({f.name: f.layout for f in fields}))
     layout = list(layouts)[0]
     return list(layout)
 
-- 
GitLab