Commit bee3bfdf authored by Martin Bauer's avatar Martin Bauer
Browse files

pystencils: easy access to center

parent 747f1851
......@@ -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)
......
......@@ -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)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment