mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 06:05:58 -04:00
Make sure openmc_load_nuclide still works as intended
This commit is contained in:
parent
66f61a8011
commit
9fa16bc831
2 changed files with 10 additions and 5 deletions
|
|
@ -67,8 +67,8 @@ Nuclide::Nuclide(hid_t group, const double* temperature, int n)
|
|||
// temperature range was given, in which case all temperatures in the range
|
||||
// are loaded irrespective of what temperatures actually appear in the model
|
||||
std::vector<int> temps_to_read;
|
||||
double T_min = settings::temperature_range[0];
|
||||
double T_max = settings::temperature_range[1];
|
||||
double T_min = n > 0 ? settings::temperature_range[0] : 0.0;
|
||||
double T_max = n > 0 ? settings::temperature_range[1] : INFTY;
|
||||
if (T_max > 0.0) {
|
||||
for (auto T : temps_available) {
|
||||
if (T_min <= T && T <= T_max) {
|
||||
|
|
|
|||
|
|
@ -243,7 +243,7 @@ contains
|
|||
minmax, master, i_nuclide)
|
||||
class(Nuclide), intent(inout) :: this
|
||||
integer(HID_T), intent(in) :: group_id
|
||||
type(VectorReal), intent(in) :: temperature ! list of desired temperatures
|
||||
type(VectorReal), intent(in), target :: temperature ! list of desired temperatures
|
||||
integer, intent(inout) :: method
|
||||
real(8), intent(in) :: tolerance
|
||||
real(8), intent(in) :: minmax(2) ! range of temperatures
|
||||
|
|
@ -276,14 +276,19 @@ contains
|
|||
function nuclide_from_hdf5_c(group, temperature, n) result(ptr) bind(C)
|
||||
import HID_T, C_DOUBLE, C_INT, C_PTR
|
||||
integer(HID_T), value :: group
|
||||
real(C_DOUBLE), intent(in) :: temperature(*)
|
||||
type(C_PTR), value :: temperature
|
||||
integer(C_INT), value :: n
|
||||
type(C_PTR) :: ptr
|
||||
end function
|
||||
end interface
|
||||
|
||||
! Read data on C++ side
|
||||
this % ptr = nuclide_from_hdf5_c(group_id, temperature % data(1), temperature % size())
|
||||
if (temperature % size() > 0) then
|
||||
this % ptr = nuclide_from_hdf5_c(group_id, C_LOC(temperature % data(1)), &
|
||||
temperature % size())
|
||||
else
|
||||
this % ptr = nuclide_from_hdf5_c(group_id, C_NULL_PTR, 0)
|
||||
end if
|
||||
|
||||
! Get name of nuclide from group
|
||||
this % name = get_name(group_id)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue