Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing unused variables #84

Merged
merged 4 commits into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions src/geouned/GEOReverse/Modules/MCNPinput.py
Original file line number Diff line number Diff line change
Expand Up @@ -1077,7 +1077,6 @@ def get_hyperboloid_parameters(eVal, eVect, T, k, iaxis):
elliposoid = False
if iaxis is None:
iaxis = np.argmin(np.abs(eVal))
ellipsoid = True
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should variable not be removed. In fact there is a typo in the spelling of the variable in line 1077 "elliposoid" which is the variable used in line 1144.
Please keep the variable in line 1080 and rename the variable in lines 1077 and 1144

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

excellent spot @psauvan

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've corrected the spelling typos and put ellipsoid back as requested.

This PR now has slightly different behaviour compared to the dev branch, as it fixes an undiscovered bug. Perhaps this helps with some of the geometries that lose particles during transport


other1 = (iaxis + 1) % 3
other2 = (iaxis + 2) % 3
Expand Down Expand Up @@ -1247,7 +1246,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],
Expand Down
1 change: 0 additions & 1 deletion src/geouned/GEOReverse/Modules/Parser/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 0 additions & 2 deletions src/geouned/GEOReverse/Modules/Utils/BooleanSolids.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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
Expand Down
5 changes: 0 additions & 5 deletions src/geouned/GEOReverse/Modules/XMLinput.py
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand Down Expand Up @@ -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():
Expand Down
2 changes: 0 additions & 2 deletions src/geouned/GEOReverse/Modules/splitFunction.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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

Expand Down
10 changes: 0 additions & 10 deletions src/geouned/GEOUNED/Conversion/CellDefinition.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
Expand All @@ -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]
Expand Down Expand Up @@ -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) != "<Cone object>":
return None

Expand Down Expand Up @@ -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]
Expand Down Expand Up @@ -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)
Expand Down
15 changes: 0 additions & 15 deletions src/geouned/GEOUNED/Decompose/Decom_one.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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]
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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]
Expand Down Expand Up @@ -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, []))
Expand Down Expand Up @@ -988,7 +974,6 @@ def Split2ndOrderPlanes(Solids):

def split2ndOPlane(solid):

Planes = []
err = 0
flag_inv = CD.isInverted(solid)
solid_GU = GU.solid_GU(solid)
Expand Down
1 change: 0 additions & 1 deletion src/geouned/GEOUNED/LoadFile/LoadFunctions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 0 additions & 1 deletion src/geouned/GEOUNED/LoadFile/LoadSTEP.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
# Paco mod
def extractMaterials(filename):
rhoreal = []
namestr = []
mdict = {} # _ Material dictionary
with open(filename, "rt") as file:
for line in file:
Expand Down
1 change: 0 additions & 1 deletion src/geouned/GEOUNED/Utils/BasicFunctions_part2.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down
2 changes: 0 additions & 2 deletions src/geouned/GEOUNED/Utils/BooleanSolids.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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
Expand Down
4 changes: 0 additions & 4 deletions src/geouned/GEOUNED/Void/VoidBoxClass.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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:
Expand Down
7 changes: 0 additions & 7 deletions src/geouned/GEOUNED/Write/Functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions src/geouned/GEOUNED/Write/MCNPFormat.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 0 additions & 2 deletions src/geouned/GEOUNED/Write/OpenMCFormat.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 0 additions & 2 deletions src/geouned/GEOUNED/Write/PHITSFormat.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 0 additions & 2 deletions src/geouned/GEOUNED/Write/SerpentFormat.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 0 additions & 1 deletion src/geouned/GEOUNED/Write/StringFunctions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 0 additions & 1 deletion src/geouned/GEOUNED/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down