diff --git a/include/openmc/dagmc.h b/include/openmc/dagmc.h index 4b7a6c45d1..4c4e7f8c49 100644 --- a/include/openmc/dagmc.h +++ b/include/openmc/dagmc.h @@ -161,6 +161,7 @@ private: std::shared_ptr uwuw_; //!< Pointer to the UWUW instance for this universe std::unique_ptr dmd_ptr; //! Pointer to DAGMC metadata object + bool uwuw_disabled; //!< Switch to disable UWUW materials bool adjust_geometry_ids_; //!< Indicates whether or not to automatically //!< generate new cell and surface IDs for the //!< universe diff --git a/src/dagmc.cpp b/src/dagmc.cpp index 4c72779ce5..061c04f877 100644 --- a/src/dagmc.cpp +++ b/src/dagmc.cpp @@ -83,6 +83,7 @@ DAGUniverse::DAGUniverse(std::shared_ptr external_dagmc_ptr, adjust_geometry_ids_(auto_geom_ids), adjust_material_ids_(auto_mat_ids) { set_id(); + uwuw_disabled = (filename==""); } void DAGUniverse::set_id() @@ -102,6 +103,7 @@ void DAGUniverse::set_id() void DAGUniverse::initialize() { geom_type() = GeometryType::DAG; + uwuw_disabled = false; init_dagmc(); @@ -424,7 +426,8 @@ void DAGUniverse::to_hdf5(hid_t universes_group) const bool DAGUniverse::uses_uwuw() const { - return !uwuw_->material_library.empty(); + if (uwuw_disabled) return false; + else return !uwuw_->material_library.empty(); } std::string DAGUniverse::get_uwuw_materials_xml() const @@ -513,6 +516,7 @@ void DAGUniverse::legacy_assign_material( void DAGUniverse::init_uwuw() { + if (uwuw_disabled) return; uwuw_ = std::make_shared(filename_.c_str()); }