fix calculation of min and max neutron data temperature

This commit is contained in:
Gavin Ridley 2021-03-30 13:54:33 -04:00
parent 763817d6ab
commit bb9ef684ae

View file

@ -33,7 +33,7 @@ namespace data {
std::array<double, 2> energy_min {0.0, 0.0};
std::array<double, 2> energy_max {INFTY, INFTY};
double temperature_min {0.0};
double temperature_max {INFTY};
double temperature_max {0.0};
std::unordered_map<std::string, int> nuclide_map;
std::vector<std::unique_ptr<Nuclide>> nuclides;
} // namespace data
@ -169,11 +169,10 @@ Nuclide::Nuclide(hid_t group, const std::vector<double>& temperature)
// Sort temperatures to read
std::sort(temps_to_read.begin(), temps_to_read.end());
double T_min_read = *std::min_element(temps_to_read.cbegin(), temps_to_read.cend());
double T_max_read = *std::max_element(temps_to_read.cbegin(), temps_to_read.cend());
data::temperature_min = std::max(data::temperature_min, T_min_read);
data::temperature_max = std::min(data::temperature_max, T_max_read);
data::temperature_min =
std::min(data::temperature_min, static_cast<double>(temps_to_read.front()));
data::temperature_max =
std::max(data::temperature_max, static_cast<double>(temps_to_read.back()));
hid_t energy_group = open_group(group, "energy");
for (const auto& T : temps_to_read) {