Skip to content

Commit e0aa4ad

Browse files
KBGrammerAlvaroCubiGrammer, Kyle
authored andcommitted
Fix for #203, errors in simplify full (#206)
* Patch for #203 * Responding to comments on #206 * Update core.py Add missing space to call to UF.get_box() --------- Co-authored-by: AlvaroCubi <[email protected]> Co-authored-by: Grammer, Kyle <[email protected]>
1 parent d1d4d5c commit e0aa4ad

File tree

6 files changed

+18
-18
lines changed

6 files changed

+18
-18
lines changed

src/geouned/GEOReverse/Modules/Utils/BooleanSolids.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ def point_inside(solid):
434434
BBox = solid.optimalBoundingBox(False)
435435
box = [BBox.XMin, BBox.XMax, BBox.YMin, BBox.YMax, BBox.ZMin, BBox.ZMax]
436436

437-
boxes, centers = cut_box(box)
437+
boxes, centers = divide_box(box)
438438
n = 0
439439

440440
while True:
@@ -446,7 +446,7 @@ def point_inside(solid):
446446
subbox = []
447447
centers = []
448448
for b in boxes:
449-
btab, ctab = cut_box(b)
449+
btab, ctab = divide_box(b)
450450
subbox.extend(btab)
451451
centers.extend(ctab)
452452
boxes = subbox
@@ -458,7 +458,7 @@ def point_inside(solid):
458458

459459

460460
# divide a box into 8 smaller boxes
461-
def cut_box(Box):
461+
def divide_box(Box):
462462
xmid = (Box[1] + Box[0]) * 0.5
463463
ymid = (Box[3] + Box[2]) * 0.5
464464
zmid = (Box[5] + Box[4]) * 0.5

src/geouned/GEOReverse/Modules/splitFunction.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ def point_inside(solid):
163163
BBox = solid.optimalBoundingBox(False)
164164
box = [BBox.XMin, BBox.XMax, BBox.YMin, BBox.YMax, BBox.ZMin, BBox.ZMax]
165165

166-
boxes, centers = cut_box(box)
166+
boxes, centers = divide_box(box)
167167
n = 0
168168

169169
while True:
@@ -175,7 +175,7 @@ def point_inside(solid):
175175
subbox = []
176176
centers = []
177177
for b in boxes:
178-
btab, ctab = cut_box(b)
178+
btab, ctab = divide_box(b)
179179
subbox.extend(btab)
180180
centers.extend(ctab)
181181
boxes = subbox
@@ -188,7 +188,7 @@ def point_inside(solid):
188188

189189

190190
# divide a box into 8 smaller boxes
191-
def cut_box(Box):
191+
def divide_box(Box):
192192
xmid = (Box[1] + Box[0]) * 0.5
193193
ymid = (Box[3] + Box[2]) * 0.5
194194
zmid = (Box[5] + Box[4]) * 0.5

src/geouned/GEOUNED/conversion/cell_definition.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -856,7 +856,7 @@ def no_overlapping_cell(metaList, surfaces, options):
856856
CT = build_c_table_from_solids(
857857
box,
858858
(tuple(t_def.get_surfaces_numbers()), Surfs),
859-
option="diag",
859+
"diag",
860860
options=options,
861861
)
862862

@@ -866,7 +866,7 @@ def no_overlapping_cell(metaList, surfaces, options):
866866
CT = build_c_table_from_solids(
867867
box,
868868
(tuple(new_def.get_surfaces_numbers()), Surfs),
869-
option="full",
869+
"full",
870870
options=options,
871871
)
872872

src/geouned/GEOUNED/core.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -687,8 +687,8 @@ def start(self):
687687
if c.Definition.level == 0 or c.IsEnclosure:
688688
continue
689689
logger.info(f"simplify cell {c.__id__}")
690-
Box = UF.get_box(c)
691-
CT = build_c_table_from_solids(Box, (c.Surfaces, Surfs), option="full")
690+
Box = UF.get_box(c, self.options.enlargeBox)
691+
CT = build_c_table_from_solids(Box, (c.Surfaces, Surfs), "full", options=self.options)
692692
c.Definition.simplify(CT)
693693
c.Definition.clean()
694694
if type(c.Definition.elements) is bool:

src/geouned/GEOUNED/utils/boolean_solids.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ def combine_diag_elements(d1, d2):
239239
return CTelement((0, 0, 1, 0))
240240

241241

242-
def build_c_table_from_solids(Box, SurfInfo, option, options):
242+
def build_c_table_from_solids(Box, SurfInfo, simplification_mode, options):
243243

244244
if type(SurfInfo) is dict:
245245
surfaces = SurfInfo
@@ -260,7 +260,7 @@ def build_c_table_from_solids(Box, SurfInfo, option, options):
260260
surfaces[s].buildShape(Box.BoundBox)
261261

262262
CTable = ConstraintTable()
263-
if option == "diag":
263+
if simplification_mode == "diag":
264264
CTable.diagonal = True
265265
else:
266266
CTable.diagonal = False
@@ -270,7 +270,7 @@ def build_c_table_from_solids(Box, SurfInfo, option, options):
270270
# res,splitRegions = split_solid_fast(Box,Surfaces.get_surface(s1),True)
271271

272272
CTable.add_element(s1, s1, CTelement(res, s1, s1))
273-
if option == "diag":
273+
if simplification_mode == "diag":
274274
continue
275275
if splitRegions is None:
276276
continue # loop, no region to be split by s2
@@ -309,7 +309,7 @@ def build_c_table_from_solids(Box, SurfInfo, option, options):
309309
CTable.add_element(s1, s2, CTelement(val, s1, s2))
310310

311311
# if some surfaces don't cross the box some elements in Constraint table are not filled
312-
if option != "diag":
312+
if simplification_mode != "diag":
313313
CTable.fill_missing_elements()
314314
return CTable
315315

@@ -460,7 +460,7 @@ def point_inside(solid):
460460
BBox = solid.optimalBoundingBox(False)
461461
box = [BBox.XMin, BBox.XMax, BBox.YMin, BBox.YMax, BBox.ZMin, BBox.ZMax]
462462

463-
boxes, centers = cut_box(box)
463+
boxes, centers = divide_box(box)
464464
n = 0
465465

466466
while True:
@@ -472,7 +472,7 @@ def point_inside(solid):
472472
subbox = []
473473
centers = []
474474
for b in boxes:
475-
btab, ctab = cut_box(b)
475+
btab, ctab = divide_box(b)
476476
subbox.extend(btab)
477477
centers.extend(ctab)
478478
boxes = subbox
@@ -515,7 +515,7 @@ def point_from_surface(solid):
515515

516516

517517
# divide a box into 8 smaller boxes
518-
def cut_box(Box):
518+
def divide_box(Box):
519519
xmid = (Box[1] + Box[0]) * 0.5
520520
ymid = (Box[3] + Box[2]) * 0.5
521521
zmid = (Box[5] + Box[4]) * 0.5

src/geouned/GEOUNED/void/void_box_class.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ def get_void_complementary(self, Surfaces, options, tolerances, numeric_format,
271271
surfaceDict = {}
272272
for i in surfList:
273273
surfaceDict[i] = Surfaces.get_surface(i)
274-
CTable = build_c_table_from_solids(Box, surfaceDict, option=simplify, options=options)
274+
CTable = build_c_table_from_solids(Box, surfaceDict, simplify, options=options)
275275
else:
276276
if res is True:
277277
return None, None

0 commit comments

Comments
 (0)