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

allowing geometry to be fully made via constructor #2602

Merged
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
11 changes: 8 additions & 3 deletions openmc/geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,16 @@ class Geometry:

"""

def __init__(self, root=None):
def __init__(
self,
root : openmc.UniverseBase = None,
paulromano marked this conversation as resolved.
Show resolved Hide resolved
merge_surfaces: bool = False,
surface_precision: int = 10
):
self._root_universe = None
self._offsets = {}
self.merge_surfaces = False
self.surface_precision = 10
self.merge_surfaces = merge_surfaces
self.surface_precision = surface_precision
if root is not None:
if isinstance(root, openmc.UniverseBase):
self.root_universe = root
Expand Down
9 changes: 7 additions & 2 deletions tests/unit_tests/test_geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,8 +362,13 @@ def get_cyl_cell(r1, r2, z1, z2, fill):
clad = get_cyl_cell(r1, r2, z1, z2, m2)
water = get_cyl_cell(r2, r3, z1, z2, m3)
root = openmc.Universe(cells=[fuel, clad, water])
geom = openmc.Geometry(root)
geom.merge_surfaces=True
geom = openmc.Geometry(root=root, merge_surfaces=True, surface_precision=11)
assert geom.merge_surfaces is True
geom.merge_surfaces = False
assert geom.merge_surfaces is False
assert geom.surface_precision == 11
geom.surface_precision = 10
assert geom.surface_precision == 10
model = openmc.model.Model(geometry=geom,
materials=openmc.Materials([m1, m2, m3]))

Expand Down