Skip to content

Commit

Permalink
update boolean surface class
Browse files Browse the repository at this point in the history
  • Loading branch information
psauvan committed Jul 1, 2024
1 parent 14c63d3 commit 5bf756c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 21 deletions.
2 changes: 1 addition & 1 deletion src/geouned/GEOUNED/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ def start(self):
continue
logger.info(f"simplify cell {c.__id__}")
Box = UF.get_box(c, self.options.enlargeBox)
CT = build_c_table_from_solids(Box, (c.Surfaces, Surfs), "full", options=self.options)
CT = build_c_table_from_solids(Box, (c.Surfaces, Surfs), "full", options=self.options, excludeAux=True)
c.Definition.simplify(CT)
c.Definition.clean()
if type(c.Definition.elements) is bool:
Expand Down
32 changes: 13 additions & 19 deletions src/geouned/GEOUNED/utils/boolean_solids.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,7 @@ def solid_in_box(self, Seq): # Sequence of the cell
if self.diagonal:
seqValues = dict()
for s in surfs:
if s.aux:
val = None
else:
val = BoolVals[self[s][s].val]
val = BoolVals[self[s][s].val]
if val is not None:
seqValues[s] = val
# if evaluate None : Box intersection Cell != 0 Part of the cell in the box
Expand All @@ -195,11 +192,7 @@ def solid_in_box(self, Seq): # Sequence of the cell
return res if type(res) is bool else None

else:
if surfs[0].aux:
trueSet = {surfs[0]: True}
falseSet = {surfs[0]: False}
else:
trueSet, falseSet = self.get_constraint_set(surfs[0])
trueSet, falseSet = self.get_constraint_set(surfs[0])

if trueSet is not None:
trueVal = Seq.evaluate(trueSet)
Expand Down Expand Up @@ -247,7 +240,7 @@ def combine_diag_elements(d1, d2):
return CTelement((0, 0, 1, 0))


def build_c_table_from_solids(Box, SurfInfo, simplification_mode, options):
def build_c_table_from_solids(Box, SurfInfo, simplification_mode, options, excludeAux=False):

if type(SurfInfo) is dict:
surfaces = SurfInfo
Expand All @@ -258,13 +251,6 @@ def build_c_table_from_solids(Box, SurfInfo, simplification_mode, options):
surfaces = SurfInfo.Surfaces
surfaceList = SurfInfo.surfaceList

newList = []
for s in surfaceList:
if s.aux:
continue
newList.append(s)
surfaceList = newList

if type(surfaces[surfaceList[0]]) is GeounedSurface:
for s in surfaceList:
ss = surfaces[s]
Expand All @@ -281,10 +267,18 @@ def build_c_table_from_solids(Box, SurfInfo, simplification_mode, options):
CTable.diagonal = False

for i, s1 in enumerate(surfaceList):
res, splitRegions = split_solid_fast(Box, surfaces[s1], True, options)
# res,splitRegions = split_solid_fast(Box,Surfaces.get_surface(s1),True)
if excludeAux and s1.aux:
# if auxillary surfaces are excluded :
# 1) assume auxillary surface s1 is "crossing" the box (diagnonal elements)
# 2) if surface s2 cross the box => surface s1 cross s2
res = 0
splitRegions = None
else:
res, splitRegions = split_solid_fast(Box, surfaces[s1], True, options)
# res,splitRegions = split_solid_fast(Box,Surfaces.get_surface(s1),True)

CTable.add_element(s1, s1, CTelement(res, s1, s1))

if simplification_mode == "diag":
continue
if splitRegions is None:
Expand Down
2 changes: 1 addition & 1 deletion src/geouned/GEOUNED/void/void_box_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ def get_void_complementary(self, Surfaces, options, tolerances, numeric_format,
surfaceDict = {}
for i in surfList:
surfaceDict[i] = Surfaces.get_surface(i)
CTable = build_c_table_from_solids(Box, surfaceDict, simplify, options=options)
CTable = build_c_table_from_solids(Box, surfaceDict, simplify, options=options, excludeAux=False)
else:
if res is True:
return None, None
Expand Down

0 comments on commit 5bf756c

Please sign in to comment.