diff options
-rw-r--r-- | boltzgen/kernel/memory/index.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/boltzgen/kernel/memory/index.py b/boltzgen/kernel/memory/index.py index e89e9ee..75b0ebc 100644 --- a/boltzgen/kernel/memory/index.py +++ b/boltzgen/kernel/memory/index.py @@ -9,10 +9,16 @@ class XYZ(CellIndex): pass def gid(self, x, y, z=0): - return x*self.geometry.size_y*self.geometry.size_z + y*self.geometry.size_z + z + if any(map(lambda v: isinstance(v, str), [x,y,z])): + return "(%s)*%d + (%s)*%d + %s" % (x, self.geometry.size_y*self.geometry.size_z, y, self.geometry.size_z, z) + else: + return x*self.geometry.size_y*self.geometry.size_z + y*self.geometry.size_z + z class ZYX(CellIndex): pass def gid(self, x, y, z=0): - return z*self.geometry.size_x*self.geometry.size_y + y*self.geometry.size_x + x + if any(map(lambda v: isinstance(v, str), [x,y,z])): + return "(%s)*%d + (%s)*%d + %s" % (z, self.geometry.size_x*self.geometry.size_y, y, self.geometry.size_x, x) + else: + return z*self.geometry.size_x*self.geometry.size_y + y*self.geometry.size_x + x |