Skip to content

Commit

Permalink
disable cross section loading on plot mode (#2690)
Browse files Browse the repository at this point in the history
Co-authored-by: Paul Romano <paul.k.romano@gmail.com>
  • Loading branch information
bam241 and paulromano committed Oct 7, 2023
1 parent 61c4352 commit ca49d81
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 15 deletions.
8 changes: 6 additions & 2 deletions src/initialize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,9 @@ bool read_model_xml()
"No <materials> node present in the {} file.", model_filename));
}

read_cross_sections_xml(root.child("materials"));
if (settings::run_mode != RunMode::PLOTTING) {
read_cross_sections_xml(root.child("materials"));
}
read_materials_xml(root.child("materials"));

// Read geometry
Expand Down Expand Up @@ -413,7 +415,9 @@ bool read_model_xml()
void read_separate_xml_files()
{
read_settings_xml();
read_cross_sections_xml();
if (settings::run_mode != RunMode::PLOTTING) {
read_cross_sections_xml();
}
read_materials_xml();
read_geometry_xml();

Expand Down
32 changes: 19 additions & 13 deletions src/material.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,11 +224,13 @@ Material::Material(pugi::xml_node node)

// Check that this nuclide is listed in the nuclear data library
// (cross_sections.xml for CE and the MGXS HDF5 for MG)
LibraryKey key {Library::Type::neutron, name};
if (data::library_map.find(key) == data::library_map.end()) {
fatal_error("Could not find nuclide " + name +
" in the "
"nuclear data library.");
if (settings::run_mode != RunMode::PLOTTING) {
LibraryKey key {Library::Type::neutron, name};
if (data::library_map.find(key) == data::library_map.end()) {
fatal_error("Could not find nuclide " + name +
" in the "
"nuclear data library.");
}
}

// If this nuclide hasn't been encountered yet, we need to add its name
Expand All @@ -247,10 +249,12 @@ Material::Material(pugi::xml_node node)
std::string element = to_element(name);

// Make sure photon cross section data is available
LibraryKey key {Library::Type::photon, element};
if (data::library_map.find(key) == data::library_map.end()) {
fatal_error(
"Could not find element " + element + " in cross_sections.xml.");
if (settings::run_mode != RunMode::PLOTTING) {
LibraryKey key {Library::Type::photon, element};
if (data::library_map.find(key) == data::library_map.end()) {
fatal_error(
"Could not find element " + element + " in cross_sections.xml.");
}
}

if (data::element_map.find(element) == data::element_map.end()) {
Expand Down Expand Up @@ -324,10 +328,12 @@ Material::Material(pugi::xml_node node)

// Check that the thermal scattering table is listed in the
// cross_sections.xml file
LibraryKey key {Library::Type::thermal, name};
if (data::library_map.find(key) == data::library_map.end()) {
fatal_error("Could not find thermal scattering data " + name +
" in cross_sections.xml file.");
if (settings::run_mode != RunMode::PLOTTING) {
LibraryKey key {Library::Type::thermal, name};
if (data::library_map.find(key) == data::library_map.end()) {
fatal_error("Could not find thermal scattering data " + name +
" in cross_sections.xml file.");
}
}

// Determine index of thermal scattering data in global
Expand Down

0 comments on commit ca49d81

Please sign in to comment.