- Type = MacObject.Type
- if Type == 'Box11' :
- BaseDirPar = [1,1,1,1]
- return int(VecDivRatio(MacObject.DirectionalMeshParams, BaseDirPar))
- elif Type == 'Box42' :
- BaseDirPar = {'SN' : lambda : [3, 3, 4, 2],
- 'NS' : lambda : [3, 3, 2, 4],
- 'EW' : lambda : [2, 4, 3, 3],
- 'WE' : lambda : [4, 2, 3, 3], }[MacObject.MeshPar[1]]()
- return int(VecDivRatio(MacObject.DirectionalMeshParams, BaseDirPar))
- elif Type == 'BoxAng32' :
- BaseDirPar = {'NE' : lambda : [3, 2, 3, 2],
- 'NW' : lambda : [2, 3, 3, 2],
- 'SW' : lambda : [2, 3, 2, 3],
- 'SE' : lambda : [3, 2, 2, 3], }[MacObject.MeshPar[1]]()
- return int(VecDivRatio(MacObject.DirectionalMeshParams, BaseDirPar))
- elif Type == 'CompBox' :
- #print "dx is: ", MacObject.GeoPar[1][1], ". dy is: ",MacObject.GeoPar[1][0]
- ReducedRatio = ReduceRatio(MacObject.GeoPar[1][0], MacObject.GeoPar[1][1])
- #print ReducedRatio
- BaseDirPar = [ReducedRatio[1], ReducedRatio[1], ReducedRatio[0], ReducedRatio[0]]
- return int(VecDivRatio(MacObject.DirectionalMeshParams, BaseDirPar))
-
- elif Type == 'QuartCyl' :
- N = QuarCylParam(MacObject.MeshPar[2])+1
- BaseDirPar = {'NE' : lambda : [2, N, 2, N],
- 'NW' : lambda : [N, 2, 2, N],
- 'SW' : lambda : [N, 2, N, 2],
- 'SE' : lambda : [2, N, N, 2], }[MacObject.MeshPar[1]]()
- return int(VecDivRatio(MacObject.DirectionalMeshParams, BaseDirPar))
- elif Type == 'CompBoxF' :
- RealRatio = MacObject.GeoPar[1][1]/MacObject.GeoPar[1][0]
- Xd = 0
- Yd = 0
- if MacObject.DirectionalMeshParams[2]+MacObject.DirectionalMeshParams[3] :
- A = int(max(MacObject.DirectionalMeshParams[2:4]))
- Xd = int(VecDivRatio([A,0,0,0], [1,1,1,1]))
- if MacObject.DirectionalMeshParams[0]+MacObject.DirectionalMeshParams[1] :
- A = int(max(MacObject.DirectionalMeshParams[0:2]))
- Yd = int(VecDivRatio([0,0,A,0], [1,1,1,1]))
-
- if Xd == 0 and Yd : Xd = int(round(Yd/RealRatio))
- elif Yd == 0 : Yd = int(round(RealRatio*Xd))
-
- return [Xd,Yd]
- elif Type == 'NonOrtho' :
- MeanDX = 0.5*(IntLen(MacObject.DirBoundaries(0))+IntLen(MacObject.DirBoundaries(1)))
- MeanDY = 0.5*(IntLen(MacObject.DirBoundaries(2))+IntLen(MacObject.DirBoundaries(3)))
- RealRatio = MeanDY/MeanDX
- Xd = 0
- Yd = 0
- if MacObject.DirectionalMeshParams[2]+MacObject.DirectionalMeshParams[3] :
- A = int(max(MacObject.DirectionalMeshParams[2:4]))
- Xd = int(VecDivRatio([A,0,0,0], [1,1,1,1]))
- if MacObject.DirectionalMeshParams[0]+MacObject.DirectionalMeshParams[1] :
- A = int(max(MacObject.DirectionalMeshParams[0:2]))
- Yd = int(VecDivRatio([0,0,A,0], [1,1,1,1]))
-
- if Xd == 0 and Yd : Xd = int(round(Yd/RealRatio))
- elif Yd == 0 : Yd = int(round(RealRatio*Xd))
-
- return [Xd,Yd]
+ Type = MacObject.Type
+ if Type == 'Box11' :
+ BaseDirPar = [1,1,1,1]
+ return int(VecDivRatio(MacObject.DirectionalMeshParams, BaseDirPar))
+ elif Type == 'Box42' :
+ BaseDirPar = {'SN' : lambda : [3, 3, 4, 2],
+ 'NS' : lambda : [3, 3, 2, 4],
+ 'EW' : lambda : [2, 4, 3, 3],
+ 'WE' : lambda : [4, 2, 3, 3], }[MacObject.MeshPar[1]]()
+ return int(VecDivRatio(MacObject.DirectionalMeshParams, BaseDirPar))
+ elif Type == 'BoxAng32' :
+ BaseDirPar = {'NE' : lambda : [3, 2, 3, 2],
+ 'NW' : lambda : [2, 3, 3, 2],
+ 'SW' : lambda : [2, 3, 2, 3],
+ 'SE' : lambda : [3, 2, 2, 3], }[MacObject.MeshPar[1]]()
+ return int(VecDivRatio(MacObject.DirectionalMeshParams, BaseDirPar))
+ elif Type == 'CompBox' :
+ #print "dx is: ", MacObject.GeoPar[1][1], ". dy is: ",MacObject.GeoPar[1][0]
+ ReducedRatio = ReduceRatio(MacObject.GeoPar[1][0], MacObject.GeoPar[1][1])
+ #print ReducedRatio
+ BaseDirPar = [ReducedRatio[1], ReducedRatio[1], ReducedRatio[0], ReducedRatio[0]]
+ return int(VecDivRatio(MacObject.DirectionalMeshParams, BaseDirPar))
+
+ elif Type == 'QuartCyl' :
+ N = QuarCylParam(MacObject.MeshPar[2])+1
+ BaseDirPar = {'NE' : lambda : [2, N, 2, N],
+ 'NW' : lambda : [N, 2, 2, N],
+ 'SW' : lambda : [N, 2, N, 2],
+ 'SE' : lambda : [2, N, N, 2], }[MacObject.MeshPar[1]]()
+ return int(VecDivRatio(MacObject.DirectionalMeshParams, BaseDirPar))
+ elif Type == 'CompBoxF' :
+ RealRatio = MacObject.GeoPar[1][1]/MacObject.GeoPar[1][0]
+ Xd = 0
+ Yd = 0
+ if MacObject.DirectionalMeshParams[2]+MacObject.DirectionalMeshParams[3] :
+ A = int(max(MacObject.DirectionalMeshParams[2:4]))
+ Xd = int(VecDivRatio([A,0,0,0], [1,1,1,1]))
+ if MacObject.DirectionalMeshParams[0]+MacObject.DirectionalMeshParams[1] :
+ A = int(max(MacObject.DirectionalMeshParams[0:2]))
+ Yd = int(VecDivRatio([0,0,A,0], [1,1,1,1]))
+
+ if Xd == 0 and Yd : Xd = int(round(Yd/RealRatio))
+ elif Yd == 0 : Yd = int(round(RealRatio*Xd))
+
+ return [Xd,Yd]
+ elif Type == 'NonOrtho' :
+ MeanDX = 0.5*(IntLen(MacObject.DirBoundaries(0))+IntLen(MacObject.DirBoundaries(1)))
+ MeanDY = 0.5*(IntLen(MacObject.DirBoundaries(2))+IntLen(MacObject.DirBoundaries(3)))
+ RealRatio = MeanDY/MeanDX
+ Xd = 0
+ Yd = 0
+ if MacObject.DirectionalMeshParams[2]+MacObject.DirectionalMeshParams[3] :
+ A = int(max(MacObject.DirectionalMeshParams[2:4]))
+ Xd = int(VecDivRatio([A,0,0,0], [1,1,1,1]))
+ if MacObject.DirectionalMeshParams[0]+MacObject.DirectionalMeshParams[1] :
+ A = int(max(MacObject.DirectionalMeshParams[0:2]))
+ Yd = int(VecDivRatio([0,0,A,0], [1,1,1,1]))
+
+ if Xd == 0 and Yd : Xd = int(round(Yd/RealRatio))
+ elif Yd == 0 : Yd = int(round(RealRatio*Xd))
+
+ return [Xd,Yd]