Skip to content

Commit c63d818

Browse files
committed
Set upper and lower interpolation bounds for MGXS data.
1 parent 8198e60 commit c63d818

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

src/mgxs.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include "openmc/error.h"
1515
#include "openmc/math_functions.h"
1616
#include "openmc/mgxs_interface.h"
17+
#include "openmc/nuclide.h"
1718
#include "openmc/random_lcg.h"
1819
#include "openmc/settings.h"
1920
#include "openmc/string_utils.h"
@@ -85,6 +86,13 @@ void Mgxs::metadata_from_hdf5(hid_t xs_id, const vector<double>& temperature,
8586
delete[] dset_names;
8687
std::sort(temps_available.begin(), temps_available.end());
8788

89+
// Set the global upper and lower interpolation bounds to avoid errors involving
90+
// C-API functions.
91+
for (int i = 0; i < num_temps; ++i) {
92+
data::temperature_min = std::min(data::temperature_min, temps_available[i]);
93+
data::temperature_max = std::max(data::temperature_max, temps_available[i]);
94+
}
95+
8896
// If only one temperature is available, lets just use nearest temperature
8997
// interpolation
9098
if ((num_temps == 1) &&

0 commit comments

Comments
 (0)