Skip to content

Commit

Permalink
avoid double reading thermal scattering libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
joshmay1 committed Nov 14, 2022
1 parent 81b88cc commit dc5f274
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/thermal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)));
}
}
}
}
Expand Down

0 comments on commit dc5f274

Please sign in to comment.