A BMI should not allocate memory. Instead, when using, e.g., get_value, the caller should create a variable, allocating memory to hold an array output. The variable is passed as a parameter into
get_value, where values are copied into it.
Fortran arrays actually make this easy. For example, in get_grid_shape, these statements
are equivalent, element-wise copies into the variable shape.
In this PR, I've used this concept to rework the the get_value and get_value_at_indices methods, outputting an array, not a pointer, with the values of the specified variable.
(Thank you to @mcflugen for recognizing this problem on his way out the door yesterday.)
A BMI should not allocate memory. Instead, when using, e.g.,
get_value
, the caller should create a variable, allocating memory to hold an array output. The variable is passed as a parameter intoget_value
, where values are copied into it.Fortran arrays actually make this easy. For example, in
get_grid_shape
, these statementsand this statement
are equivalent, element-wise copies into the variable
shape
.In this PR, I've used this concept to rework the the
get_value
andget_value_at_indices
methods, outputting an array, not a pointer, with the values of the specified variable.(Thank you to @mcflugen for recognizing this problem on his way out the door yesterday.)
cc: @sc0tts