diff --git a/include/openmc/cell.h b/include/openmc/cell.h index 52d6e9fdc..0aa14e523 100644 --- a/include/openmc/cell.h +++ b/include/openmc/cell.h @@ -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); diff --git a/src/cell.cpp b/src/cell.cpp index 733b70f05..ffbb7dae7 100644 --- a/src/cell.cpp +++ b/src/cell.cpp @@ -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(dag_node)); + model::universe_map[model::universes.back()->id_] = model::universes.size() - 1; } - next_cell_id++; - } //============================================================================== diff --git a/src/dagmc.cpp b/src/dagmc.cpp index 395372a58..93d9b222a 100644 --- a/src/dagmc.cpp +++ b/src/dagmc.cpp @@ -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; } } diff --git a/src/geometry_aux.cpp b/src/geometry_aux.cpp index 17000129d..94365428f 100644 --- a/src/geometry_aux.cpp +++ b/src/geometry_aux.cpp @@ -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 diff --git a/src/surface.cpp b/src/surface.cpp index 76542fcd8..caa3b9ba8 100644 --- a/src/surface.cpp +++ b/src/surface.cpp @@ -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()