aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Kummerlaender2019-10-29 19:53:05 +0100
committerAdrian Kummerlaender2019-10-29 19:53:05 +0100
commit1ce3b58dabba59741343cbd9e7e4c9f58f10f91b (patch)
treeee4e3cd6f4597a88205a9ad167406a03335a4487
parent61d77cf8aa815b456d873ff3c01e54ad21a8fce9 (diff)
downloadboltzgen-1ce3b58dabba59741343cbd9e7e4c9f58f10f91b.tar
boltzgen-1ce3b58dabba59741343cbd9e7e4c9f58f10f91b.tar.gz
boltzgen-1ce3b58dabba59741343cbd9e7e4c9f58f10f91b.tar.bz2
boltzgen-1ce3b58dabba59741343cbd9e7e4c9f58f10f91b.tar.xz
boltzgen-1ce3b58dabba59741343cbd9e7e4c9f58f10f91b.zip
Return cell id as string expression when required
-rw-r--r--boltzgen/kernel/memory/index.py10
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