avoid double reading thermal scattering libraries

This commit is contained in:
josh 2022-11-14 20:36:11 +00:00
parent 81b88cc018
commit dc5f2746d3

View file

@ -119,20 +119,22 @@ ThermalScattering::ThermalScattering(
if (!found) {
// If no pairs found, check if the desired temperature falls within
// bounds' tolerance
if (std::abs(T - temps_available[0]) <=
settings::temperature_tolerance) {
if (std::abs(T - temps_available[0]) <= settings::temperature_tolerance){
if (std::find(temps_to_read.begin(), temps_to_read.end(), std::round(temps_available[0])) ==
temps_to_read.end()) {
temps_to_read.push_back(std::round(temps_available[0]));
break;
}
if (std::abs(T - temps_available[n - 1]) <=
settings::temperature_tolerance) {
}}
else if (std::abs(T - temps_available[n - 1]) <= settings::temperature_tolerance){
if (std::find(temps_to_read.begin(), temps_to_read.end(), std::round(temps_available[n - 1])) ==
temps_to_read.end()){
temps_to_read.push_back(std::round(temps_available[n - 1]));
break;
}
fatal_error(
}}
else {
fatal_error(
fmt::format("Nuclear data library does not contain cross "
"sections for {} at temperatures that bound {} K.",
name_, std::round(T)));
}
}
}
}