From ca49d8167fb14417313a04223eaeaeb0e299fa19 Mon Sep 17 00:00:00 2001 From: Baptiste Mouginot <15145274+bam241@users.noreply.github.com> Date: Sat, 7 Oct 2023 16:11:03 +0200 Subject: [PATCH] disable cross section loading on plot mode (#2690) Co-authored-by: Paul Romano --- src/initialize.cpp | 8 ++++++-- src/material.cpp | 32 +++++++++++++++++++------------- 2 files changed, 25 insertions(+), 15 deletions(-) diff --git a/src/initialize.cpp b/src/initialize.cpp index d667f4b03..2f448e804 100644 --- a/src/initialize.cpp +++ b/src/initialize.cpp @@ -372,7 +372,9 @@ bool read_model_xml() "No 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(); diff --git a/src/material.cpp b/src/material.cpp index 610b54add..7466f1981 100644 --- a/src/material.cpp +++ b/src/material.cpp @@ -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