-def CompositeBox (X0 , Y0 , DX , DY , **args ) :
-
- if args.__contains__('groups') :
- GroupNames = args['groups']
- else : GroupNames = [None, None, None, None]
- # Create a full Box just to inherit, globally, the mesh parameters of bounding objects
- MacObject('CompBoxF',[(X0,Y0),(DX,DY)],['auto'],publish=0)
-
- # Save the existing number of segments on each direction
- ExistingSegments = Config.ListObj[-1].DirectionalMeshParams
-
- # Sort the connection list for the full Box
- ObjIDLists = SortObjLists(Config.Connections[-1],X0 , Y0 , DX , DY )
- RemoveLastObj()
-
- print "ObjIDLists: ", ObjIDLists
-
- RealSegments = []
- Direction = []
- flag = 0
- if not(args.__contains__('recursive')) : Config.Count = 0
- print "Config.Count : ", Config.Count
- Config.Criterion = GetCriterion(ObjIDLists)
- for index, ObjList in enumerate(ObjIDLists) :
- if not (ObjList[0] == -1 or Config.Count >= Config.Criterion):
- if len(ObjList)>1 : flag = 1
- else : flag = 0
- for ObjID in ObjList:
- ToLook0 = [2,2,0,0][index]
- ToLook1 = [3,2,1,0][index]
- CommonSide = FindCommonSide(Config.ListObj[ObjID].DirBoundaries(ToLook1),[X0-DX/2.,X0+DX/2.,Y0-DY/2.,Y0+DY/2.][ToLook0:ToLook0+2])
- ToLook2 = [1,0,3,2][index]
- RealSegments.append(Config.ListObj[ObjID].DirectionalMeshParams[ToLook2]*IntLen(CommonSide)/IntLen(Config.ListObj[ObjID].DirBoundaries(ToLook1)))
- Direction.append(ToLook0/2)
-
- if flag and Config.Count < Config.Criterion:
- if index < 2 :
- if abs(CommonSide[0] - (Y0-DY/2.))<1e-7 : SouthGR = GroupNames[0]
- else : SouthGR = None
- if abs(CommonSide[1] - (Y0+DY/2.))<1e-7 : NorthGR = GroupNames[1]
- else : NorthGR = None
- CompositeBox (X0, CommonSide[0]+IntLen(CommonSide)/2., DX,IntLen(CommonSide), recursive=1, groups = [SouthGR,NorthGR]+GroupNames[2:4])
- else :
- if abs(CommonSide[0] - (X0-DX/2.))<1e-7 : EastGR = GroupNames[2]
- else : EastGR = None
- if abs(CommonSide[1] - (X0+DX/2.))<1e-7 : WestGR = GroupNames[3]
- else : WestGR = None
- CompositeBox (CommonSide[0]+IntLen(CommonSide)/2., Y0, IntLen(CommonSide),DY, recursive=1, groups = GroupNames[0:2]+[EastGR,WestGR])
-
- if Config.Count >= Config.Criterion :
- break
- if flag == 0 and Config.Count < Config.Criterion:
- #print "Dir : ", Direction
- #print "RealSegments : ", RealSegments
-
- #Xind = Direction.index(0)
- #Yind = Direction.index(1)
- #MacObject('CompBoxF',[(X0,Y0),(DX,DY)] ,[(RealSegments[Xind],RealSegments[Yind])], groups = GroupNames)
- MacObject('CompBoxF',[(X0,Y0),(DX,DY)] ,['auto'], groups = GroupNames)
-
- Config.Count += 1
-
-
+def CompositeBox (X0 , Y0 , DX , DY , **args ) :
+
+ if args.__contains__('groups') :
+ GroupNames = args['groups']
+ else : GroupNames = [None, None, None, None]
+ # Create a full Box just to inherit, globally, the mesh parameters of bounding objects
+ MacObject('CompBoxF',[(X0,Y0),(DX,DY)],['auto'],publish=0)
+
+ # Save the existing number of segments on each direction
+ ExistingSegments = Config.ListObj[-1].DirectionalMeshParams
+
+ # Sort the connection list for the full Box
+ ObjIDLists = SortObjLists(Config.Connections[-1],X0 , Y0 , DX , DY )
+ RemoveLastObj()
+
+ print("ObjIDLists: ", ObjIDLists)
+
+ RealSegments = []
+ Direction = []
+ flag = 0
+ if not(args.__contains__('recursive')) : Config.Count = 0
+ print("Config.Count : ", Config.Count)
+ Config.Criterion = GetCriterion(ObjIDLists)
+ for index, ObjList in enumerate(ObjIDLists) :
+ if not (ObjList[0] == -1 or Config.Count >= Config.Criterion):
+ if len(ObjList)>1 : flag = 1
+ else : flag = 0
+ for ObjID in ObjList:
+ ToLook0 = [2,2,0,0][index]
+ ToLook1 = [3,2,1,0][index]
+ CommonSide = FindCommonSide(Config.ListObj[ObjID].DirBoundaries(ToLook1),[X0-DX/2.,X0+DX/2.,Y0-DY/2.,Y0+DY/2.][ToLook0:ToLook0+2])
+ ToLook2 = [1,0,3,2][index]
+ RealSegments.append(Config.ListObj[ObjID].DirectionalMeshParams[ToLook2]*IntLen(CommonSide)/IntLen(Config.ListObj[ObjID].DirBoundaries(ToLook1)))
+ Direction.append(ToLook0/2)
+
+ if flag and Config.Count < Config.Criterion:
+ if index < 2 :
+ if abs(CommonSide[0] - (Y0-DY/2.))<1e-7 : SouthGR = GroupNames[0]
+ else : SouthGR = None
+ if abs(CommonSide[1] - (Y0+DY/2.))<1e-7 : NorthGR = GroupNames[1]
+ else : NorthGR = None
+ CompositeBox (X0, CommonSide[0]+IntLen(CommonSide)/2., DX,IntLen(CommonSide), recursive=1, groups = [SouthGR,NorthGR]+GroupNames[2:4])
+ else :
+ if abs(CommonSide[0] - (X0-DX/2.))<1e-7 : EastGR = GroupNames[2]
+ else : EastGR = None
+ if abs(CommonSide[1] - (X0+DX/2.))<1e-7 : WestGR = GroupNames[3]
+ else : WestGR = None
+ CompositeBox (CommonSide[0]+IntLen(CommonSide)/2., Y0, IntLen(CommonSide),DY, recursive=1, groups = GroupNames[0:2]+[EastGR,WestGR])
+
+ if Config.Count >= Config.Criterion :
+ break
+ if flag == 0 and Config.Count < Config.Criterion:
+ #print "Dir : ", Direction
+ #print "RealSegments : ", RealSegments
+
+ #Xind = Direction.index(0)
+ #Yind = Direction.index(1)
+ #MacObject('CompBoxF',[(X0,Y0),(DX,DY)] ,[(RealSegments[Xind],RealSegments[Yind])], groups = GroupNames)
+ MacObject('CompBoxF',[(X0,Y0),(DX,DY)] ,['auto'], groups = GroupNames)
+
+ Config.Count += 1
+
+