summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorepapoutsellis <epapoutsellis@gmail.com>2019-04-23 09:34:57 +0100
committerepapoutsellis <epapoutsellis@gmail.com>2019-04-23 09:34:57 +0100
commitc789b7fcb83d5c693194b46fc7347503f34ac359 (patch)
tree684ec2b7eb4c215d6b466d9e14068fbb1ef1287a
parentac8fd7c768aef99003b1da8618edee9949411573 (diff)
downloadframework-c789b7fcb83d5c693194b46fc7347503f34ac359.tar.gz
framework-c789b7fcb83d5c693194b46fc7347503f34ac359.tar.bz2
framework-c789b7fcb83d5c693194b46fc7347503f34ac359.tar.xz
framework-c789b7fcb83d5c693194b46fc7347503f34ac359.zip
allocate symmetric option
-rwxr-xr-xWrappers/Python/ccpi/framework/BlockGeometry.py46
1 files changed, 45 insertions, 1 deletions
diff --git a/Wrappers/Python/ccpi/framework/BlockGeometry.py b/Wrappers/Python/ccpi/framework/BlockGeometry.py
index 5dd6750..7fc5cb8 100755
--- a/Wrappers/Python/ccpi/framework/BlockGeometry.py
+++ b/Wrappers/Python/ccpi/framework/BlockGeometry.py
@@ -31,7 +31,51 @@ class BlockGeometry(object):
'''returns the Geometry in the BlockGeometry located at position index'''
return self.geometries[index]
- def allocate(self, value=0, dimension_labels=None):
+ def allocate(self, value=0, dimension_labels=None, **kwargs):
+
+ symmetry = kwargs.get('symmetry',False)
containers = [geom.allocate(value) for geom in self.geometries]
+
+ if symmetry == True:
+
+ # TODO works but needs better coding
+
+ # for 2x2
+ # [ ig11, ig12\
+ # ig21, ig22]
+ # Row-wise Order
+
+ if len(containers)==4:
+ containers[1] = containers[2]
+
+ # for 3x3
+ # [ ig11, ig12, ig13\
+ # ig21, ig22, ig23\
+ # ig31, ig32, ig33]
+
+ elif len(containers)==9:
+ containers[1]=containers[3]
+ containers[2]=containers[6]
+ containers[5]=containers[7]
+
+ # for 4x4
+ # [ ig11, ig12, ig13, ig14\
+ # ig21, ig22, ig23, ig24\
+ # ig31, ig32, ig33, ig34
+ # ig41, ig42, ig43, ig44]
+
+ elif len(containers) == 16:
+ containers[1]=containers[4]
+ containers[2]=containers[8]
+ containers[3]=containers[12]
+ containers[6]=containers[9]
+ containers[7]=containers[10]
+ containers[11]=containers[15]
+
+
+
+
return BlockDataContainer(*containers)
+
+