From cc98a1558c5fb941274fb3e352e1d67faed98d91 Mon Sep 17 00:00:00 2001 From: Jonathan Shimwell Date: Thu, 25 Apr 2024 01:15:32 +0100 Subject: [PATCH 1/4] removed unused vars --- src/geouned/GEOReverse/Modules/MCNPinput.py | 3 +-- src/geouned/GEOReverse/Modules/Parser/parser.py | 1 - .../GEOReverse/Modules/Utils/BooleanSolids.py | 2 -- src/geouned/GEOReverse/Modules/XMLinput.py | 5 ----- src/geouned/GEOReverse/Modules/splitFunction.py | 2 -- src/geouned/GEOUNED/Conversion/CellDefinition.py | 10 ---------- src/geouned/GEOUNED/Decompose/Decom_one.py | 15 --------------- src/geouned/GEOUNED/LoadFile/LoadFunctions.py | 1 - src/geouned/GEOUNED/LoadFile/LoadSTEP.py | 3 +-- src/geouned/GEOUNED/Utils/BasicFunctions_part2.py | 1 - src/geouned/GEOUNED/Utils/BooleanSolids.py | 2 -- src/geouned/GEOUNED/Void/VoidBoxClass.py | 4 ---- src/geouned/GEOUNED/Write/Functions.py | 7 ------- src/geouned/GEOUNED/Write/MCNPFormat.py | 2 -- src/geouned/GEOUNED/Write/OpenMCFormat.py | 2 -- src/geouned/GEOUNED/Write/PHITSFormat.py | 2 -- src/geouned/GEOUNED/Write/SerpentFormat.py | 2 -- src/geouned/GEOUNED/Write/StringFunctions.py | 1 - src/geouned/GEOUNED/__init__.py | 1 - 19 files changed, 2 insertions(+), 64 deletions(-) diff --git a/src/geouned/GEOReverse/Modules/MCNPinput.py b/src/geouned/GEOReverse/Modules/MCNPinput.py index e9d9f490..7c997444 100644 --- a/src/geouned/GEOReverse/Modules/MCNPinput.py +++ b/src/geouned/GEOReverse/Modules/MCNPinput.py @@ -161,6 +161,7 @@ def __getTransList__(self): trl[c.name] = getTransMatrix(trValues, c.unit) return trl + # fmt: off def getTransMatrix(trsf, unit="", scale=10.0): @@ -1077,7 +1078,6 @@ def get_hyperboloid_parameters(eVal, eVect, T, k, iaxis): elliposoid = False if iaxis is None: iaxis = np.argmin(np.abs(eVal)) - ellipsoid = True other1 = (iaxis + 1) % 3 other2 = (iaxis + 2) % 3 @@ -1247,7 +1247,6 @@ def gq2params(x): # f b g * beta = -v # h g c gamma -w - zeroLim = 1e-12 mat3 = np.array( [ [x[0], x[3] / 2, x[5] / 2], diff --git a/src/geouned/GEOReverse/Modules/Parser/parser.py b/src/geouned/GEOReverse/Modules/Parser/parser.py index 5431690a..927c98b0 100644 --- a/src/geouned/GEOReverse/Modules/Parser/parser.py +++ b/src/geouned/GEOReverse/Modules/Parser/parser.py @@ -1264,7 +1264,6 @@ def get_cards(inp, debug=None, preservetabs=False): If dump exists and it is newwer than the input file, read the dump file """ - iname = inp for c in get_cards_from_input(inp, debug=debug, preservetabs=preservetabs): yield c diff --git a/src/geouned/GEOReverse/Modules/Utils/BooleanSolids.py b/src/geouned/GEOReverse/Modules/Utils/BooleanSolids.py index 49c0761a..24ce1bed 100644 --- a/src/geouned/GEOReverse/Modules/Utils/BooleanSolids.py +++ b/src/geouned/GEOReverse/Modules/Utils/BooleanSolids.py @@ -244,7 +244,6 @@ def buildCTableFromSolids(Box, SurfInfo, option="diag"): surfaces = SurfInfo.surfaces surfaceList = SurfInfo.surfaceList - outSurfaces = [] for s in surfaceList: surfaces[s].buildShape(Box.BoundBox) @@ -306,7 +305,6 @@ def buildCTableFromSolids(Box, SurfInfo, option="diag"): def removeExtraSurfaces(CellSeq, CTable): # checking is make on solid cell definition to be removed from void cell outSurfaces = set(CTable.getOutSurfaces()) - changed = False newDef = BoolSequence(operator="OR") # Loop over all compound solids of the metaSolid diff --git a/src/geouned/GEOReverse/Modules/XMLinput.py b/src/geouned/GEOReverse/Modules/XMLinput.py index 9b22ee67..8b22a5fb 100644 --- a/src/geouned/GEOReverse/Modules/XMLinput.py +++ b/src/geouned/GEOReverse/Modules/XMLinput.py @@ -68,7 +68,6 @@ def GetFilteredCells(self, Surfaces, config): def GetLevelStructure(self): containers = [] Universe_dict = {} - cellCards = {} for c in self.__inputcards__: if c.type != "cell": @@ -291,10 +290,6 @@ def Get_primitive_surfaces(mcnp_surfaces, scale=10.0): X_vec = FreeCAD.Vector(1.0, 0.0, 0.0) Y_vec = FreeCAD.Vector(0.0, 1.0, 0.0) Z_vec = FreeCAD.Vector(0.0, 0.0, 1.0) - negX_vec = -X_vec - negY_vec = -Y_vec - negZ_vec = -Z_vec - origin = FreeCAD.Vector(0.0, 0.0, 0.0) surfaces = {} for Sid in mcnp_surfaces.keys(): diff --git a/src/geouned/GEOReverse/Modules/splitFunction.py b/src/geouned/GEOReverse/Modules/splitFunction.py index 643ce3ba..2a688d42 100644 --- a/src/geouned/GEOReverse/Modules/splitFunction.py +++ b/src/geouned/GEOReverse/Modules/splitFunction.py @@ -70,7 +70,6 @@ def SplitSolid(base, surfacesCut, cellObj, solidTool=False, tolerance=0.01): # Solids = [base.base] partPositions, partSolids = space_decomposition(Solids, surfacesCut) - ii = 0 for pos, sol in zip(partPositions, partSolids): # fullPos = updateSurfacesValues(pos,cellObj.surfaces,base.knownSurf) # inSolid = cellObj.definition.evaluate(fullPos) @@ -139,7 +138,6 @@ def point_inside(solid): # no poner boundbox, el punto puente caer en una superficie para geometria triangular point = solid.CenterOfMass - points = point if solid.isInside(point, 0.0, False): return point diff --git a/src/geouned/GEOUNED/Conversion/CellDefinition.py b/src/geouned/GEOUNED/Conversion/CellDefinition.py index 8c8fd8d2..50ded8d5 100644 --- a/src/geouned/GEOUNED/Conversion/CellDefinition.py +++ b/src/geouned/GEOUNED/Conversion/CellDefinition.py @@ -382,7 +382,6 @@ def GenPlaneCylinder_old(face, solid): try: UVNodes.append(face2.getUVNodes()) except RuntimeError: - tess = face.tessellate(1.0, True) UVNodes.append(face2.getUVNodes()) Uval_str_cl = [] @@ -404,12 +403,9 @@ def GenPlaneCylinder_old(face, solid): # searching for minimum and maximum angle points for j, Nodes in enumerate(UVNodes): for elem in Nodes: - val = "%11.4E" % elem[0] dif1 = abs(float(Uval_str_cl[0]) - elem[0]) dif2 = abs(float(Uval_str_cl[1]) - elem[0]) - if abs(elem[0]) < 1.0e-5: - val = "%11.4E" % 0.0 if dif1 < dif1_0: Node_min = elem face_index_2[0] = face_index[j] @@ -483,8 +479,6 @@ def GenPlaneCone(face, solid): def GenPlaneCone_old(face, solid): Surf = face.Surface - rad = Surf.Radius - Axis = face.Surface.Axis if str(Surf) != "": return None @@ -544,11 +538,8 @@ def GenPlaneCone_old(face, solid): # searching for minimum and maximum angle points for j, Nodes in enumerate(UVNodes): for elem in Nodes: - val = "%11.4E" % elem[0] dif1 = abs(float(Uval_str_cl[0]) - elem[0]) dif2 = abs(float(Uval_str_cl[1]) - elem[0]) - if abs(elem[0]) < 1.0e-5: - val = "%11.4E" % 0.0 if dif1 < dif1_0: Node_min = elem face_index_2[0] = face_index[j] @@ -1165,7 +1156,6 @@ def ExtraPlaneCylFace(face, Box, Surfaces): plane = GEOUNED_Surface( ("Plane", (center, dir, dim1, dim2)), Box, Face="Build" ) - sign = signPlane(face.CenterOfMass, plane) id, exist = Surfaces.addPlane(plane) if exist: pp = Surfaces.getSurface(id) diff --git a/src/geouned/GEOUNED/Decompose/Decom_one.py b/src/geouned/GEOUNED/Decompose/Decom_one.py index bc3167e3..3246e4db 100644 --- a/src/geouned/GEOUNED/Decompose/Decom_one.py +++ b/src/geouned/GEOUNED/Decompose/Decom_one.py @@ -229,13 +229,9 @@ def ExtractSurfaces(solid, kind, UniverseBox, MakeObj=False): P3P = False solidParts = [GU.solid_GU(solid, P3P)] - ex = FreeCAD.Vector(1, 0, 0) - ey = FreeCAD.Vector(0, 1, 0) - ez = FreeCAD.Vector(0, 0, 1) Surfaces = UF.Surfaces_dict() for solid_GU in solidParts: - flag_inv = CD.isInverted(solid_GU.solid) # Get the parameter of all faces of the solid # Add auxillary planes for Cylinders and Cones @@ -501,12 +497,9 @@ def GenPlaneCylinder(face, solid): for j, Nodes in enumerate(UVNodes): for elem in Nodes: - val = "%11.4E" % elem[0] dif1 = abs(float(Uval_str_cl[0]) - elem[0]) dif2 = abs(float(Uval_str_cl[1]) - elem[0]) - if abs(elem[0]) < 1.0e-5: - val = "%11.4E" % 0.0 if dif1 < dif1_0: Node_min = elem face_index_2[0] = face_index[j] @@ -535,9 +528,6 @@ def GenPlaneCylinder(face, solid): # function should be reviewed def GenPlaneCone(face, solid): - Surf = face.Surface - rad = Surf.Radius - if face.Area < 1e-2: return None @@ -628,12 +618,9 @@ def GenPlaneCone(face, solid): # searching for minimum and maximum angle points for j, Nodes in enumerate(UVNodes): for elem in Nodes: - val = "%11.4E" % elem[0] dif1 = abs(float(Uval_str_cl[0]) - elem[0]) dif2 = abs(float(Uval_str_cl[1]) - elem[0]) - if abs(elem[0]) < 1.0e-5: - val = "%11.4E" % 0.0 if dif1 < dif1_0: Node_min = elem face_index_2[0] = face_index[j] @@ -735,7 +722,6 @@ def SplitPlanes_new(Solids, UniverseBox): def SplitPlanes_org(Solids, UniverseBox): Bases = [] - icount = 0 err = 0 for sol in Solids: Bases.append((sol, [])) @@ -988,7 +974,6 @@ def Split2ndOrderPlanes(Solids): def split2ndOPlane(solid): - Planes = [] err = 0 flag_inv = CD.isInverted(solid) solid_GU = GU.solid_GU(solid) diff --git a/src/geouned/GEOUNED/LoadFile/LoadFunctions.py b/src/geouned/GEOUNED/LoadFile/LoadFunctions.py index 3aac03ac..cb56527d 100644 --- a/src/geouned/GEOUNED/LoadFile/LoadFunctions.py +++ b/src/geouned/GEOUNED/LoadFile/LoadFunctions.py @@ -13,7 +13,6 @@ def GetLabel(label): return label wrd = label.split() try: - val = float(wrd[-1]) new_label = " ".join(wrd[:-1]) return new_label except: diff --git a/src/geouned/GEOUNED/LoadFile/LoadSTEP.py b/src/geouned/GEOUNED/LoadFile/LoadSTEP.py index a1098d73..72f3f967 100644 --- a/src/geouned/GEOUNED/LoadFile/LoadSTEP.py +++ b/src/geouned/GEOUNED/LoadFile/LoadSTEP.py @@ -14,8 +14,7 @@ # Paco mod def extractMaterials(filename): - rhoreal = [] - namestr = [] + rhoreal = []] mdict = {} # _ Material dictionary with open(filename, "rt") as file: for line in file: diff --git a/src/geouned/GEOUNED/Utils/BasicFunctions_part2.py b/src/geouned/GEOUNED/Utils/BasicFunctions_part2.py index 5fbb84d3..430e1303 100644 --- a/src/geouned/GEOUNED/Utils/BasicFunctions_part2.py +++ b/src/geouned/GEOUNED/Utils/BasicFunctions_part2.py @@ -41,7 +41,6 @@ def Fuzzy(index, dtype, surf1, surf2, val, tol): elif dtype == "cylAxs": cyl1str = MCNPSurface(index, "Cylinder", surf1) cyl2str = MCNPSurface(0, "Cylinder", surf2) - c12 = surf1.Center - surf2.Center line = "Same surface : {}\nDist Axis / Tolerance: {} {}\n {}\n {}\n\n".format( same, val, tol, cyl1str, cyl2str ) diff --git a/src/geouned/GEOUNED/Utils/BooleanSolids.py b/src/geouned/GEOUNED/Utils/BooleanSolids.py index 3fb4735e..e1d9cf5c 100644 --- a/src/geouned/GEOUNED/Utils/BooleanSolids.py +++ b/src/geouned/GEOUNED/Utils/BooleanSolids.py @@ -250,7 +250,6 @@ def buildCTableFromSolids(Box, SurfInfo, option="diag"): surfaces = SurfInfo.Surfaces surfaceList = SurfInfo.surfaceList - outSurfaces = [] if type(surfaces[surfaceList[0]]) is GEOUNED_Surface: for s in surfaceList: ss = surfaces[s] @@ -318,7 +317,6 @@ def buildCTableFromSolids(Box, SurfInfo, option="diag"): def removeExtraSurfaces(CellSeq, CTable): # checking is make on solid cell definition to be removed from void cell outSurfaces = set(CTable.getOutSurfaces()) - changed = False newDef = BoolSequence(operator="OR") # Loop over all compound solids of the metaSolid diff --git a/src/geouned/GEOUNED/Void/VoidBoxClass.py b/src/geouned/GEOUNED/Void/VoidBoxClass.py index 309770c7..f4640ea2 100644 --- a/src/geouned/GEOUNED/Void/VoidBoxClass.py +++ b/src/geouned/GEOUNED/Void/VoidBoxClass.py @@ -156,8 +156,6 @@ def refine(self): FreeCAD.Vector(self.BoundBox.XMin, self.BoundBox.YMin, self.BoundBox.ZMin), FreeCAD.Vector(0, 0, 1), ) - refinedList = [] - newcom = [] for m in self.Objects: self.__removeExtraComp__(m, Cube, mode="dist") @@ -290,8 +288,6 @@ def getVoidComplementary(self, Surfaces, simplify="no"): compSeq = voidSolidDef.getComplementary() else: - newCell = [] - if voidSolidDef.level == 1 and voidSolidDef.operator == "AND": compSeq = BoolSequence(operator="OR") else: diff --git a/src/geouned/GEOUNED/Write/Functions.py b/src/geouned/GEOUNED/Write/Functions.py index 975d37b1..4095eb6d 100644 --- a/src/geouned/GEOUNED/Write/Functions.py +++ b/src/geouned/GEOUNED/Write/Functions.py @@ -733,13 +733,6 @@ def SerpentSurface(id, Type, surf): ) else: Q = Qform.QFormCone(Dir, Apex, tan) - MCNP_def = """\ -surf quadratic {v[0]:{aTof}} {v[1]:{aTof}} {v[2]:{aTof}} - {v[3]:{aTof}} {v[4]:{aTof}} {v[5]:{aTof}} - {v[6]:{gToi}} {v[7]:{gToi}} {v[8]:{gToi}} - {v[9]:{j}} """.format( - id, v=Q, aTof=nf.GQ_1to6, gToi=nf.GQ_7to9, j=nf.GQ_10 - ) elif Type == "Sphere": rad = surf.Radius * 0.1 diff --git a/src/geouned/GEOUNED/Write/MCNPFormat.py b/src/geouned/GEOUNED/Write/MCNPFormat.py index 7e76fb44..a157b16b 100644 --- a/src/geouned/GEOUNED/Write/MCNPFormat.py +++ b/src/geouned/GEOUNED/Write/MCNPFormat.py @@ -300,8 +300,6 @@ def __getSurfaceTable__(self): return def __simplifyPlanes__(self, Surfaces): - offset = len(self.Cells) - keys = self.surfaceTable.keys() for p in Surfaces["PX"]: if p.Surf.Axis[0] < 0: diff --git a/src/geouned/GEOUNED/Write/OpenMCFormat.py b/src/geouned/GEOUNED/Write/OpenMCFormat.py index 48ebfd68..a425665a 100644 --- a/src/geouned/GEOUNED/Write/OpenMCFormat.py +++ b/src/geouned/GEOUNED/Write/OpenMCFormat.py @@ -225,8 +225,6 @@ def __getSurfaceTable__(self): return def __simplifyPlanes__(self, Surfaces): - offset = len(self.Cells) - keys = self.surfaceTable.keys() for p in Surfaces["PX"]: if p.Surf.Axis[0] < 0: diff --git a/src/geouned/GEOUNED/Write/PHITSFormat.py b/src/geouned/GEOUNED/Write/PHITSFormat.py index 8163a138..62c60511 100644 --- a/src/geouned/GEOUNED/Write/PHITSFormat.py +++ b/src/geouned/GEOUNED/Write/PHITSFormat.py @@ -551,8 +551,6 @@ def __getSurfaceTable__(self): return def __simplifyPlanes__(self, Surfaces): - offset = len(self.Cells) - keys = self.surfaceTable.keys() for p in Surfaces["PX"]: if p.Surf.Axis[0] < 0: diff --git a/src/geouned/GEOUNED/Write/SerpentFormat.py b/src/geouned/GEOUNED/Write/SerpentFormat.py index 5af58fc4..82f87132 100644 --- a/src/geouned/GEOUNED/Write/SerpentFormat.py +++ b/src/geouned/GEOUNED/Write/SerpentFormat.py @@ -309,8 +309,6 @@ def __getSurfaceTable__(self): return def __simplifyPlanes__(self, Surfaces): - offset = len(self.Cells) - keys = self.surfaceTable.keys() for p in Surfaces["PX"]: if p.Surf.Axis[0] < 0: diff --git a/src/geouned/GEOUNED/Write/StringFunctions.py b/src/geouned/GEOUNED/Write/StringFunctions.py index f8cf2970..24c7287d 100644 --- a/src/geouned/GEOUNED/Write/StringFunctions.py +++ b/src/geouned/GEOUNED/Write/StringFunctions.py @@ -137,7 +137,6 @@ def redundant(m, geom): def remove_redundant(geom): """return cell without redundant parenthesis""" - porg = countP(geom) # Loop until no redundant parentheses are found cont = True while cont: diff --git a/src/geouned/GEOUNED/__init__.py b/src/geouned/GEOUNED/__init__.py index 3cd34449..e6da2c6c 100644 --- a/src/geouned/GEOUNED/__init__.py +++ b/src/geouned/GEOUNED/__init__.py @@ -374,7 +374,6 @@ def Start(self): UniverseBox = getUniverse(MetaList + EnclosureList) else: UniverseBox = getUniverse(MetaList) - Comsolids = [] surfOffset = code_setting["startSurf"] - 1 Surfaces = UF.Surfaces_dict(offset=surfOffset) From af65edcadbda16f988d10074e72fd76f8c3d0ca8 Mon Sep 17 00:00:00 2001 From: Jonathan Shimwell Date: Thu, 25 Apr 2024 01:17:51 +0100 Subject: [PATCH 2/4] returned ws --- src/geouned/GEOReverse/Modules/MCNPinput.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/geouned/GEOReverse/Modules/MCNPinput.py b/src/geouned/GEOReverse/Modules/MCNPinput.py index 7c997444..8005e1d5 100644 --- a/src/geouned/GEOReverse/Modules/MCNPinput.py +++ b/src/geouned/GEOReverse/Modules/MCNPinput.py @@ -161,7 +161,6 @@ def __getTransList__(self): trl[c.name] = getTransMatrix(trValues, c.unit) return trl - # fmt: off def getTransMatrix(trsf, unit="", scale=10.0): From bc287223ee5566c595b7ee0467b1302226d39ae3 Mon Sep 17 00:00:00 2001 From: Jonathan Shimwell Date: Thu, 25 Apr 2024 01:19:04 +0100 Subject: [PATCH 3/4] removed spare ] --- src/geouned/GEOUNED/LoadFile/LoadSTEP.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/geouned/GEOUNED/LoadFile/LoadSTEP.py b/src/geouned/GEOUNED/LoadFile/LoadSTEP.py index 72f3f967..b54057b9 100644 --- a/src/geouned/GEOUNED/LoadFile/LoadSTEP.py +++ b/src/geouned/GEOUNED/LoadFile/LoadSTEP.py @@ -14,7 +14,7 @@ # Paco mod def extractMaterials(filename): - rhoreal = []] + rhoreal = [] mdict = {} # _ Material dictionary with open(filename, "rt") as file: for line in file: From 6bd0f3390b457370abde5580411905b4b7cd6522 Mon Sep 17 00:00:00 2001 From: Jonathan Shimwell Date: Thu, 25 Apr 2024 09:32:58 +0100 Subject: [PATCH 4/4] ellipsoid var returns and typo fix to match --- src/geouned/GEOReverse/Modules/MCNPinput.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/geouned/GEOReverse/Modules/MCNPinput.py b/src/geouned/GEOReverse/Modules/MCNPinput.py index 8005e1d5..ac06e20d 100644 --- a/src/geouned/GEOReverse/Modules/MCNPinput.py +++ b/src/geouned/GEOReverse/Modules/MCNPinput.py @@ -1074,9 +1074,10 @@ def get_hyperboloid_parameters(eVal, eVect, T, k, iaxis): cylTan = 1e3 coneRad = 0.1 - elliposoid = False + ellipsoid = False if iaxis is None: iaxis = np.argmin(np.abs(eVal)) + ellipsoid = True other1 = (iaxis + 1) % 3 other2 = (iaxis + 2) % 3 @@ -1100,7 +1101,7 @@ def get_hyperboloid_parameters(eVal, eVect, T, k, iaxis): elif minorRad < coneRad: return get_cone_parameters(eVal, eVect, T, iaxis) else: - if elliposoid: + if ellipsoid: print("ellipical hyperboloid not implemented") print("single radius from {} eigen Value will be used".format(minorRad)) return "hyperboloid", ( @@ -1198,7 +1199,7 @@ def getGQAxis(eVal, k): ek = (0, -1) elif np.sign(e0) == np.sign(e1) and np.sign(e1) == np.sign( e2 - ): # e1*X^2 + e2*Y^2 + e0*Z^2 - |k| = 0 Elliposoid + ): # e1*X^2 + e2*Y^2 + e0*Z^2 - |k| = 0 Ellipsoid ek = (1, -1) else: # e1*X^2 + e2*Y^2 - e0*Z^2 - |k| = 0 Hyperbpoloid ek = (-1, 1)