diff --git a/src/cross_sections.cpp b/src/cross_sections.cpp index ab753fbebe..94122199dc 100644 --- a/src/cross_sections.cpp +++ b/src/cross_sections.cpp @@ -229,7 +229,7 @@ read_ce_cross_sections(const std::vector>& nuc_temps, // Check if elemental data has been read, if needed int pos = name.find_first_of("0123456789"); - std::string element = name.substr(pos); + std::string element = name.substr(0, pos); if (settings::photon_transport) { if (already_read.find(element) == already_read.end()) { // Read photon interaction data from HDF5 photon library @@ -275,9 +275,6 @@ read_ce_cross_sections(const std::vector>& nuc_temps, } for (auto& mat : model::materials) { - // Skip materials with no S(a,b) tables - if (mat->thermal_tables_.empty()) continue; - for (const auto& table : mat->thermal_tables_) { // Get name of S(a,b) table int i_table = table.index_table; @@ -305,12 +302,11 @@ read_ce_cross_sections(const std::vector>& nuc_temps, already_read.insert(name); } } // thermal_tables_ + + // Finish setting up materials (normalizing densities, etc.) + mat->finalize(); } // materials - // Finish setting up materials (normalizing densities, etc.) - for (auto& mat : model::materials) { - mat->finalize(); - } // Set up logarithmic grid for nuclides for (auto& nuc : data::nuclides) { diff --git a/src/geometry_aux.cpp b/src/geometry_aux.cpp index 6274c78f5e..9073c511d7 100644 --- a/src/geometry_aux.cpp +++ b/src/geometry_aux.cpp @@ -139,15 +139,13 @@ get_temperatures(std::vector>& nuc_temps, } } - if (mat->thermal_tables_.size() > 0) { - for (const auto& table : mat->thermal_tables_) { - // Get index in data::thermal_scatt array - int i_sab = table.index_table; + for (const auto& table : mat->thermal_tables_) { + // Get index in data::thermal_scatt array + int i_sab = table.index_table; - // Add temperature if it hasn't already been added - if (!contains(thermal_temps[i_sab], temperature)) { - thermal_temps[i_sab].push_back(temperature); - } + // Add temperature if it hasn't already been added + if (!contains(thermal_temps[i_sab], temperature)) { + thermal_temps[i_sab].push_back(temperature); } } } diff --git a/src/material.cpp b/src/material.cpp index 3850d2be89..4e3db93d0d 100644 --- a/src/material.cpp +++ b/src/material.cpp @@ -226,7 +226,7 @@ Material::Material(pugi::xml_node node) // transport will be used, we need to add its symbol to the element_dict if (settings::photon_transport) { int pos = name.find_first_of("0123456789"); - std::string element = name.substr(pos); + std::string element = name.substr(0, pos); // Make sure photon cross section data is available LibraryKey key {Library::Type::photon, element}; @@ -689,7 +689,7 @@ void Material::calculate_neutron_xs(const Particle& p) const // S(a,b) table, then don't use the S(a,b) table if (p.E > data::thermal_scatt[i_sab]->threshold()) i_sab = C_NONE; - // Increment position in i_sab_nuclides + // Increment position in thermal_tables_ ++j; // Don't check for S(a,b) tables if there are no more left diff --git a/src/thermal.cpp b/src/thermal.cpp index 1d9d478cfe..a7d0a19a54 100644 --- a/src/thermal.cpp +++ b/src/thermal.cpp @@ -603,7 +603,11 @@ sab_from_hdf5(hid_t group, const double* temperature, int n) return data::thermal_scatt.back().get(); } -extern "C" void sab_clear() { data::thermal_scatt.clear(); } +extern "C" void sab_clear() +{ + data::thermal_scatt.clear(); + data::thermal_scatt_map.clear(); +} extern "C" bool sab_has_nuclide(int i_sab, const char* name) { diff --git a/tests/regression_tests/salphabeta/results_true.dat b/tests/regression_tests/salphabeta/results_true.dat index 2a99303f67..e1121bce50 100644 --- a/tests/regression_tests/salphabeta/results_true.dat +++ b/tests/regression_tests/salphabeta/results_true.dat @@ -1,2 +1,2 @@ k-combined: -8.447580E-01 1.806149E-02 +8.403447E-01 2.461538E-02