Reading DAGMC universes from the geometry.xml now.

This commit is contained in:
Patrick Shriwise 2020-07-08 23:39:06 -05:00
parent 249a5bb511
commit c35c8dae43
5 changed files with 14 additions and 25 deletions

View file

@ -358,6 +358,7 @@ struct CellInstanceHash {
//==============================================================================
void read_cells(pugi::xml_node node);
void read_dagmc_universes(pugi::xml_node node);
#ifdef DAGMC
void read_dagmc_universes(pugi::xml_node node);

View file

@ -992,9 +992,6 @@ void read_cells(pugi::xml_node node)
// Count the number of cells.
int n_cells = 0;
for (pugi::xml_node cell_node: node.children("cell")) {n_cells++;}
if (n_cells == 0) {
fatal_error("No cells found in geometry.xml!");
}
// Loop over XML cell elements and populate the array.
model::cells.reserve(n_cells);
@ -1013,10 +1010,7 @@ void read_cells(pugi::xml_node node)
}
}
#ifdef DAGMC
// read any DAGMC universes
read_dagmc_universes(node);
#endif
// Populate the Universe vector and map.
for (int i = 0; i < model::cells.size(); i++) {
@ -1037,17 +1031,17 @@ void read_cells(pugi::xml_node node)
if (settings::check_overlaps) {
model::overlap_check_count.resize(model::cells.size(), 0);
}
if (model::cells.size() == 0) {
fatal_error("No cells were found in the geometry.xml file");
}
}
void read_dagmc_universes(pugi::xml_node node) {
// determine the max cell id
int32_t next_cell_id = 0;
for (const auto& c : model::cells) {
if (c->id_ > next_cell_id) next_cell_id = c->id_;
for (pugi::xml_node dag_node : node.children("dagmc")) {
model::universes.push_back(std::make_unique<DAGUniverse>(dag_node));
model::universe_map[model::universes.back()->id_] = model::universes.size() - 1;
}
next_cell_id++;
}
//==============================================================================

View file

@ -367,7 +367,7 @@ void DAGUniverse::initialize() {
// add to global array and map
model::surfaces.emplace_back(s);
model::surface_map[s->id_] = model::surfaces.size() - 1;
// model::surface_map[s->id_] = model::surfaces.size() - 1;
}
}

View file

@ -42,13 +42,6 @@ void update_universe_cell_count(int32_t a, int32_t b) {
void read_geometry_xml()
{
#ifdef DAGMC
if (settings::dagmc) {
read_geometry_dagmc();
return;
}
#endif
// Display output message
write_message("Reading geometry XML file...", 5);
@ -69,8 +62,8 @@ void read_geometry_xml()
pugi::xml_node root = doc.document_element();
// Read surfaces, cells, lattice
read_surfaces(root);
read_cells(root);
read_surfaces(root);
read_lattices(root);
// Allocate universes, universe cell arrays, and assign base universe

View file

@ -1036,9 +1036,6 @@ void read_surfaces(pugi::xml_node node)
// Count the number of surfaces
int n_surfaces = 0;
for (pugi::xml_node surf_node : node.children("surface")) {n_surfaces++;}
if (n_surfaces == 0) {
fatal_error("No surfaces found in geometry.xml!");
}
// Loop over XML surface elements and populate the array. Keep track of
// periodic surfaces.
@ -1196,6 +1193,10 @@ void read_surfaces(pugi::xml_node node)
if (settings::run_mode != RunMode::PLOTTING && !boundary_exists) {
fatal_error("No boundary conditions were applied to any surfaces!");
}
if (model::surfaces.size() == 0) {
fatal_error("No surfaces found in geometry.xml!");
}
}
void free_memory_surfaces()