diff --git a/openmc/universe.py b/openmc/universe.py index 59a41a44f1..c246e33bb0 100644 --- a/openmc/universe.py +++ b/openmc/universe.py @@ -653,16 +653,25 @@ class DAGMCUniverse(UniverseBase): Name of the universe filename : str Path to the DAGMC file used to represent this universe. - auto_ids : bool + auto_geom_ids : bool Set IDs automatically on initialization (True) or report overlaps in ID space between CSG and DAGMC (False) + auto_mat_ids : bool + Set IDs automatically on initialization (True) or report overlaps + in ID space between OpenMC and UWUW materials (False) """ - def __init__(self, filename, universe_id=None, name='', auto_ids=False): + def __init__(self, + filename, + universe_id=None, + name='', + auto_geom_ids=False, + auto_mat_ids=False): super().__init__(universe_id, name) # Initialize class attributes self.filename = filename - self.auto_ids = auto_ids + self.auto_geom_ids = auto_geom_ids + self.auto_mat_ids = auto_mat_ids def __repr__(self): fmt_str = '{: <16}=\t{}\n' @@ -681,13 +690,22 @@ class DAGMCUniverse(UniverseBase): self._filename = val @property - def auto_ids(self): - return self._auto_ids + def auto_geom_ids(self): + return self._auto_geom_ids - @auto_ids.setter - def auto_ids(self, val): - cv.check_type('DAGMC auto ids', val, bool) - self._auto_ids = val + @auto_geom_ids.setter + def auto_geom_ids(self, val): + cv.check_type('DAGMC automatic geometry ids', val, bool) + self._auto_geom_ids = val + + @property + def auto_mat_ids(self): + return self._auto_mat_ids + + @auto_geom_ids.setter + def auto_mat_ids(self, val): + cv.check_type('DAGMC automatic material ids', val, bool) + self._auto_mat_ids = val def clone(self, clone_materials=True, clone_regions=True, memo=None): pass @@ -710,7 +728,9 @@ class DAGMCUniverse(UniverseBase): dagmc_element = ET.Element('dagmc') dagmc_element.set('id', str(self.id)) dagmc_element.set('name', self.name) - if self.auto_ids: - dagmc_element.set('auto_ids', 'true') + if self.auto_geom_ids: + dagmc_element.set('auto_geom_ids', 'true') + if self.auto_mat_ids: + dagmc_element.set('auto_mat_ids', 'true') dagmc_element.set('filename', self.filename) xml_element.append(dagmc_element) diff --git a/src/dagmc.cpp b/src/dagmc.cpp index e6d0d56a2c..8a54b1546f 100644 --- a/src/dagmc.cpp +++ b/src/dagmc.cpp @@ -223,9 +223,15 @@ DAGUniverse::DAGUniverse(pugi::xml_node node) { } adjust_geometry_ids_ = false; - if (check_for_node(node, "auto_ids")) { - adjust_geometry_ids_ = get_node_value_bool(node, "auto_ids"); + if (check_for_node(node, "auto_geom_ids")) { + adjust_geometry_ids_ = get_node_value_bool(node, "auto_geom_ids"); } + + adjust_material_ids_ = false; + if (check_for_node(node, "auto_mat_ids")) { + adjust_geometry_ids_ = get_node_value_bool(node, "auto_mat_ids"); + } + initialize(); } @@ -280,8 +286,6 @@ void DAGUniverse::initialize() { // notify user if UWUW materials are going to be used if (using_uwuw) { write_message("Found UWUW Materials in the DAGMC geometry file.", 6); - - } // load the DAGMC geometry diff --git a/tests/regression_tests/dagmc/refl/inputs_true.dat b/tests/regression_tests/dagmc/refl/inputs_true.dat index fdd68002d6..ca3cba5f04 100644 --- a/tests/regression_tests/dagmc/refl/inputs_true.dat +++ b/tests/regression_tests/dagmc/refl/inputs_true.dat @@ -1,6 +1,6 @@ - + diff --git a/tests/regression_tests/dagmc/refl/test.py b/tests/regression_tests/dagmc/refl/test.py index 2b43caf89e..2f4162b16a 100644 --- a/tests/regression_tests/dagmc/refl/test.py +++ b/tests/regression_tests/dagmc/refl/test.py @@ -28,8 +28,7 @@ class UWUWTest(PyAPITestHarness): model.settings.export_to_xml() # geometry - dag_univ = openmc.DAGMCUniverse("dagmc.h5m") - dag_univ.auto_ids = True + dag_univ = openmc.DAGMCUniverse("dagmc.h5m", auto_geom_ids=True) model.geometry = openmc.Geometry(root=dag_univ) # tally diff --git a/tests/regression_tests/dagmc/universes/inputs_true.dat b/tests/regression_tests/dagmc/universes/inputs_true.dat index f8acb45ccc..3113159393 100644 --- a/tests/regression_tests/dagmc/universes/inputs_true.dat +++ b/tests/regression_tests/dagmc/universes/inputs_true.dat @@ -1,7 +1,7 @@ - + diff --git a/tests/regression_tests/dagmc/universes/test.py b/tests/regression_tests/dagmc/universes/test.py index 0144a0c3a8..2ae2b0e9f2 100644 --- a/tests/regression_tests/dagmc/universes/test.py +++ b/tests/regression_tests/dagmc/universes/test.py @@ -42,7 +42,7 @@ class DAGMCUniverseTest(PyAPITestHarness): ### GEOMETRY ### # create the DAGMC universe - pincell_univ = openmc.DAGMCUniverse(filename='dagmc.h5m', auto_ids=True) + pincell_univ = openmc.DAGMCUniverse(filename='dagmc.h5m', auto_geom_ids=True) left = openmc.XPlane(x0=-24.0, name='left', boundary_type='reflective') right = openmc.XPlane(x0=24.0, name='right', boundary_type='reflective')