disable cross section loading on plot mode (#2690)

Co-authored-by: Paul Romano <paul.k.romano@gmail.com>
This commit is contained in:
Baptiste Mouginot 2023-10-07 16:11:03 +02:00 committed by GitHub
parent 61c43527e6
commit ca49d8167f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 15 deletions

View file

@ -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
@ -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();

View file

@ -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
@ -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()) {
@ -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