testing and returing openmc.Universe

This commit is contained in:
Jonathan Shimwell 2022-07-14 16:55:26 +01:00
parent 3d091a6cfb
commit c3e60da1b9
2 changed files with 8 additions and 8 deletions

View file

@ -762,18 +762,18 @@ class DAGMCUniverse(UniverseBase):
return +lower_x & -upper_x & +lower_y & -upper_y & +lower_z & -upper_z
def bounded_universe(self, **kwargs):
"""Returns an openmc.Cell that bounds the DAGMCUniverse and is filled
with the DAGMCUniverse. Defaults to a box cell with a vacuum surface.
kwargs are passed directly to DAGMCUniverse.bounding_region()
"""Returns an openmc.Universe filled with this DAGMCUniverse and bounded
with a cell. Defaults to a box cell with a vacuum surface. kwargs are
passed directly to DAGMCUniverse.bounding_region()
Returns
-------
openmc.Cell
cell filled with the DAGMCUniverse
openmc.Universe
Universe instance
"""
bounding_cell = openmc.Cell(fill=self, region=self.bounding_region(**kwargs))
return bounding_cell
return openmc.Universe(cells=[bounding_cell])
@classmethod
def from_hdf5(cls, group):

View file

@ -47,9 +47,9 @@ class DAGMCUniverseTest(PyAPITestHarness):
pincell_univ = openmc.DAGMCUniverse(filename='dagmc.h5m', auto_geom_ids=True)
# creates another DAGMC universe, this time with within a bounded cell
bound_pincell_cell = openmc.DAGMCUniverse(filename='dagmc.h5m').bounded_universe()
bound_pincell_universe = openmc.DAGMCUniverse(filename='dagmc.h5m').bounded_universe()
# uses the bound_dag_cell as the root argument to test the type checks in openmc.Geometry
bound_pincell_geometry = openmc.Geometry(root=[bound_pincell_cell])
bound_pincell_geometry = openmc.Geometry(root=bound_pincell_universe)
# assigns the bound_dag_geometry to the model to test the type checks in model.Geometry setter
model.Geometry = bound_pincell_geometry