Skip to content

Commit

Permalink
fix reversed open cylinders and cones
Browse files Browse the repository at this point in the history
  • Loading branch information
psauvan committed Jan 16, 2025
1 parent 2de95e3 commit 6c59f74
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 25,500 deletions.
16,831 changes: 0 additions & 16,831 deletions debug/compSolid_0.stp

This file was deleted.

8,491 changes: 0 additions & 8,491 deletions debug/origSolid_0.stp

This file was deleted.

144 changes: 0 additions & 144 deletions myPru.mcnp

This file was deleted.

2 changes: 0 additions & 2 deletions myPru_summary.txt

This file was deleted.

6 changes: 3 additions & 3 deletions src/geouned/GEOUNED/conversion/cell_definition.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,21 +39,21 @@ def simple_solid_definition(solid, Surfaces, meta_surfaces=True):

solid_gu = GU.SolidGu(solid.Solids[0], tolerances=Surfaces.tolerances)
if meta_surfaces:
roundCorner, omitFaces = get_roundCorner(solid_gu)
roundCorner, omitFaces = get_roundCorner(solid_gu.Faces)
for rc in roundCorner:
rc_region = Surfaces.add_roundCorner(rc)
component_definition.append(rc_region)

# multiplanes,pindex = get_multiplanes(solid_gu,solid.BoundBox) #pindex are all faces index used to produced multiplanes, do not count as standard planes
# pindex are all faces index used to produced multiplanes, do not count as standard planes
multiplanes = get_multiplanes(solid_gu, omitFaces)
multiplanes = get_multiplanes(solid_gu.Faces, omitFaces)
for mp in multiplanes:
mp_region = Surfaces.add_multiPlane(mp)
component_definition.append(mp_region)
planeset = omit_multiplane_repeated_planes(mp_region, Surfaces, solid_gu.Faces)
omitFaces.update(planeset)

reverseCan = get_reverseCan(solid_gu, omitFaces)
reverseCan = get_reverseCan(solid_gu.Faces, omitFaces)
for cs in reverseCan:
cs_region = Surfaces.add_reverseCan(cs)
component_definition.append(cs_region)
Expand Down
4 changes: 2 additions & 2 deletions src/geouned/GEOUNED/decompose/decom_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,11 @@ def extract_surfaces(solid, kind, options, tolerances, numeric_format):

Surfaces = MetaSurfacesDict(options=options, tolerances=tolerances, numeric_format=numeric_format)

can_list, can_faces = get_reverseCan(solid_GU)
can_list, can_faces = get_reverseCan(solid_GU.Faces)
for cs in can_list:
Surfaces.add_reverseCan(cs)

multiplanes_list, multiplane_faces = get_multiplanes(solid_GU)
multiplanes_list, multiplane_faces = get_multiplanes(solid_GU.Faces)
for mp in multiplanes_list:
Surfaces.add_multiPlane(mp)

Expand Down
27 changes: 12 additions & 15 deletions src/geouned/GEOUNED/decompose/generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,31 +19,28 @@
)


def get_surfaces(solid, tolerances, meta_surface=True, additional_planes = False):
def get_surfaces(solid, omitfaces, tolerances, meta_surface=True, additional_planes = False):

solid_GU = SolidGu(solid, tolerances=tolerances, plane3Pts=False)

if additional_planes:
omitfaces = set()
for plane in cyl_cone_plane_generator(solid_GU.Faces,omitfaces,tolerances):
yield plane

else:
if meta_surface:
omitfaces = set()
for rdc in next_roundCorner(solid_GU, omitfaces):
for rdc in next_roundCorner(solid_GU.Faces, omitfaces):
yield rdc

for can in next_reverseCan(solid_GU, omitfaces):
for can in next_reverseCan(solid_GU.Faces, omitfaces):
yield can

extPlanes = exclude_no_cutting_planes(solid_GU.Faces)
omitfaces.update(extPlanes)

for multiplane in next_multiplanes(solid_GU, omitfaces):
for multiplane in next_multiplanes(solid_GU.Faces, omitfaces):
yield multiplane
else:
omitfaces = set()
extPlanes = exclude_no_cutting_planes(solid_GU.Faces)
omitfaces.update(extPlanes)

Expand Down Expand Up @@ -195,10 +192,10 @@ def cyl_cone_plane_generator(GUFaces,omitfaces,tolerances):
yield plane


def next_multiplanes(solid, plane_index_set):
def next_multiplanes(solidFaces, plane_index_set):
"""identify and return all multiplanes in the solid."""
planes = []
for f in solid.Faces:
for f in solidFaces:
if f.Index in plane_index_set:
continue
if isinstance(f.Surface, PlaneGu):
Expand Down Expand Up @@ -227,15 +224,15 @@ def next_multiplanes(solid, plane_index_set):
yield mp


def next_reverseCan(solid, canface_index):
def next_reverseCan(solidFaces, canface_index):
"""identify and return all can type in the solid."""

for f in solid.Faces:
for f in solidFaces:
if isinstance(f.Surface, CylinderGu):
if f.Index in canface_index:
continue
if f.Orientation == "Reversed":
cs, surfindex = get_revcan_surfaces(f, solid)
cs, surfindex = get_revcan_surfaces(f, solidFaces)
if cs is not None:
gc = GeounedSurface(("ReverseCan", build_revcan_params(cs)))
canface_index.update(surfindex)
Expand All @@ -244,15 +241,15 @@ def next_reverseCan(solid, canface_index):
return None


def next_roundCorner(solid, cornerface_index):
def next_roundCorner(solidFaces, cornerface_index):
"""identify and return all roundcorner type in the solid."""

for f in solid.Faces:
for f in solidFaces:
if isinstance(f.Surface, CylinderGu):
if f.Index in cornerface_index:
continue
if f.Orientation == "Forward":
rc, surfindex = get_roundcorner_surfaces(f, solid)
rc, surfindex = get_roundcorner_surfaces(f, solidFaces)
if rc is not None:
gc = GeounedSurface(("RoundCorner", build_roundC_params(rc)))
cornerface_index.update(surfindex)
Expand Down
16 changes: 8 additions & 8 deletions src/geouned/GEOUNED/utils/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def get_box(comp, enlargeBox):
)


def get_multiplanes(solid, plane_index_set=None):
def get_multiplanes(solidFaces, plane_index_set=None):
"""identify and return all multiplanes in the solid."""

if plane_index_set is None:
Expand All @@ -41,7 +41,7 @@ def get_multiplanes(solid, plane_index_set=None):
one_value_return = True

planes = []
for f in solid.Faces:
for f in solidFaces:
if isinstance(f.Surface, PlaneGu):
planes.append(f)

Expand Down Expand Up @@ -75,7 +75,7 @@ def get_multiplanes(solid, plane_index_set=None):
return multiplane_objects, plane_index_set


def get_reverseCan(solid, canface_index=None):
def get_reverseCan(solidFaces, canface_index=None):
"""identify and return all can type in the solid."""

if canface_index is None:
Expand All @@ -85,12 +85,12 @@ def get_reverseCan(solid, canface_index=None):
one_value_return = True

can_list = []
for f in solid.Faces:
for f in solidFaces:
if isinstance(f.Surface, CylinderGu):
if f.Index in canface_index:
continue
if f.Orientation == "Reversed":
cs, surfindex = get_revcan_surfaces(f, solid)
cs, surfindex = get_revcan_surfaces(f, solidFaces)
if cs is not None:
gc = GeounedSurface(("ReverseCan", build_revcan_params(cs)))
can_list.append(gc)
Expand All @@ -102,7 +102,7 @@ def get_reverseCan(solid, canface_index=None):
return can_list, canface_index


def get_roundCorner(solid, cornerface_index=None):
def get_roundCorner(solidFaces, cornerface_index=None):
"""identify and return all roundcorner type in the solid."""
if cornerface_index is None:
cornerface_index = set()
Expand All @@ -111,12 +111,12 @@ def get_roundCorner(solid, cornerface_index=None):
one_value_return = True

corner_list = []
for f in solid.Faces:
for f in solidFaces:
if isinstance(f.Surface, CylinderGu):
if f.Index in cornerface_index:
continue
if f.Orientation == "Forward":
rc, surfindex = get_roundcorner_surfaces(f, solid)
rc, surfindex = get_roundcorner_surfaces(f, solidFaces)
if rc is not None:
gc = GeounedSurface(("RoundCorner", build_roundC_params(rc)))
cornerface_index.update(surfindex)
Expand Down
8 changes: 4 additions & 4 deletions src/geouned/GEOUNED/utils/meta_surfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,8 @@ def commonEdge(face1, face2, outer_only=True):
return e1
return None

def get_revcan_surfaces(cylinder, solid):
adjacent_planes = get_adjacent_cylplane(cylinder, solid.Faces, cornerPlanes=False)
def get_revcan_surfaces(cylinder, solidFaces):
adjacent_planes = get_adjacent_cylplane(cylinder, solidFaces, cornerPlanes=False)
if len(adjacent_planes) not in (1, 2):
return None, None

Expand All @@ -210,9 +210,9 @@ def get_revcan_surfaces(cylinder, solid):
else:
return None,None

def get_roundcorner_surfaces(cylinder, solid):
def get_roundcorner_surfaces(cylinder, Faces):

adjacent_planes = get_adjacent_cylplane(cylinder, solid.Faces)
adjacent_planes = get_adjacent_cylplane(cylinder, Faces)
if len(adjacent_planes) != 2:
return None, None

Expand Down

0 comments on commit 6c59f74

Please sign in to comment.