More refactoring in DAGUniverse

This commit is contained in:
helen-brooks 2022-04-08 12:13:58 +01:00
parent 290e2fba07
commit d3b4cb7fd3
2 changed files with 17 additions and 19 deletions

View file

@ -140,9 +140,10 @@ public:
bool has_graveyard() const { return has_graveyard_; }
private:
void init_dagmc();
void init_cells();
void init_surfaces();
void set_id(); //!< Deduce the universe id from model::universes
void init_dagmc(); //!< Create and initialise DAGMC pointer
void init_cells(); //!< Create cells from DAGMC volumes
void init_surfaces(); //!< Create surfaces from DAGMC surfaces
std::string
filename_; //!< Name of the DAGMC file used to create this universe
@ -156,7 +157,7 @@ private:
//!< generate new material IDs for the universe
bool has_graveyard_; //!< Indicates if the DAGMC geometry has a "graveyard"
//!< volume
moab::EntityHandle graveyard; //! MOAB index for graveyard
moab::EntityHandle graveyard; //!< MOAB index for graveyard
};
//==============================================================================

View file

@ -70,6 +70,13 @@ DAGUniverse::DAGUniverse(
const std::string& filename, bool auto_geom_ids, bool auto_mat_ids)
: filename_(filename), adjust_geometry_ids_(auto_geom_ids),
adjust_material_ids_(auto_mat_ids)
{
set_id();
initialize();
}
void DAGUniverse::set_id()
{
// determine the next universe id
int32_t next_univ_id = 0;
@ -81,8 +88,6 @@ DAGUniverse::DAGUniverse(
// set the universe id
id_ = next_univ_id;
initialize();
}
void DAGUniverse::initialize()
@ -91,6 +96,8 @@ void DAGUniverse::initialize()
init_dagmc();
read_uwuw_materials();
init_cells();
init_surfaces();
@ -102,19 +109,6 @@ void DAGUniverse::init_dagmc()
// create a new DAGMC instance
dagmc_instance_ = std::make_shared<moab::DagMC>();
// --- Materials ---
// read any UWUW materials from the file
read_uwuw_materials();
// check for uwuw material definitions
bool using_uwuw = uses_uwuw();
// 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
filename_ = settings::path_input + filename_;
if (!file_exists(filename_)) {
@ -514,6 +508,9 @@ void DAGUniverse::read_uwuw_materials()
if (mat_lib.size() == 0)
return;
// notify user if UWUW materials are going to be used
write_message("Found UWUW Materials in the DAGMC geometry file.", 6);
// if we're using automatic IDs, update the UWUW material metadata
if (adjust_material_ids_) {
for (auto& mat : uwuw_->material_library) {