mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-27 13:45:36 -04:00
allowing geometry to be fully made via constructor (#2602)
Co-authored-by: Paul Romano <paul.k.romano@gmail.com>
This commit is contained in:
parent
afa6ceb7d7
commit
d47e9a1092
2 changed files with 15 additions and 5 deletions
|
|
@ -39,11 +39,16 @@ class Geometry:
|
|||
|
||||
"""
|
||||
|
||||
def __init__(self, root=None):
|
||||
def __init__(
|
||||
self,
|
||||
root: typing.Optional[openmc.UniverseBase] = None,
|
||||
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
|
||||
|
|
|
|||
|
|
@ -362,8 +362,13 @@ def test_remove_redundant_surfaces():
|
|||
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]))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue