MODFLOW 6 version 6.9.0.dev0
USGS Modular Hydrologic Model
Loading...
Searching...
No Matches
mf6bmi Module Reference

This module contains the MODFLOW 6 BMI. More...

Functions/Subroutines

integer(kind=c_int) function bmi_get_component_name (name)
integer(kind=c_int) function bmi_initialize ()
 Initialize the computational core.
integer(kind=c_int) function bmi_update ()
 Perform a computational time step.
integer(kind=c_int) function bmi_update_until (time)
 Perform time steps until the current time reaches time.
integer(kind=c_int) function bmi_finalize ()
 Clean up the initialized simulation.
integer(kind=c_int) function get_start_time (start_time)
 Get the start time of the simulation.
integer(kind=c_int) function get_end_time (end_time)
 Get the end time of the simulation.
integer(kind=c_int) function get_current_time (current_time)
 Get the current time of the simulation.
integer(kind=c_int) function get_time_step (time_step)
 Get the time step for the simulation.
integer(kind=c_int) function get_time_units (c_time_units)
 Get the time units of the simulation.
integer(kind=c_int) function get_input_item_count (count)
 Get the number of input variables in the simulation.
integer(kind=c_int) function get_output_item_count (count)
 Get the number of output variables in the simulation.
integer(kind=c_int) function get_input_var_names (c_names)
 Returns all input variables in the simulation.
integer(kind=c_int) function get_output_var_names (c_names)
 Returns all output variables in the simulation.
integer(kind=c_int) function get_var_itemsize (c_var_address, var_size)
 Get the size (in bytes) of a single element of a variable.
integer(kind=c_int) function get_var_nbytes (c_var_address, var_nbytes)
 Get size of the variable, in bytes.
integer(kind=c_int) function get_value_double (c_var_address, c_arr_ptr)
 Copy the double precision values of a variable into the array.
integer(kind=c_int) function get_value_int (c_var_address, c_arr_ptr)
 Copy the integer values of a variable into the array.
integer(kind=c_int) function get_value_bool (c_var_address, c_arr_ptr)
 Copy the logical scalar value into the array.
integer(kind=c_int) function get_value_string (c_var_address, c_arr_ptr)
 Copy the string(s) of a variable into the array.
integer(kind=c_int) function get_value (c_var_address, c_arr_ptr)
 Copy the value of a variable into the array.
integer(kind=c_int) function get_value_ptr (c_var_address, c_arr_ptr)
 Get a pointer to an array.
integer(kind=c_int) function get_value_ptr_double (c_var_address, c_arr_ptr)
 Get a pointer to the array of double precision numbers.
integer(kind=c_int) function get_value_ptr_int (c_var_address, c_arr_ptr)
 Get a pointer to the array of integer numbers.
integer(kind=c_int) function get_value_ptr_bool (c_var_address, c_arr_ptr)
 Get a pointer to the logical scalar value.
integer(kind=c_int) function set_value (c_var_address, c_arr_ptr)
 Set new values for a given variable.
integer(kind=c_int) function set_value_double (c_var_address, c_arr_ptr)
 Set new values for a variable of type double.
integer(kind=c_int) function set_value_int (c_var_address, c_arr_ptr)
 Set new values for a variable of type integer.
integer(kind=c_int) function set_value_bool (c_var_address, c_arr_ptr)
 Set new value for a logical scalar variable.
integer(kind=c_int) function get_value_at_indices (c_var_address, c_arr_ptr, c_inds, count)
 Copy the values of a variable at the given indices into the array.
integer(kind=c_int) function set_value_at_indices (c_var_address, c_inds, count, c_arr_ptr)
 Set the values of a variable at the given indices.
logical(lgp) function valid_indices (mem_path, var_name, c_inds, count, nvalues)
 Check that every index is within the variable, and count its values.
integer(kind=c_int) function get_var_type (c_var_address, c_var_type)
 Get the variable type as a string.
integer(kind=c_int) function get_var_units (c_var_address, c_var_units)
 Get the units of a variable.
integer(kind=c_int) function get_var_location (c_var_address, c_var_location)
 Get the grid location of a variable.
integer(kind=c_int) function get_var_rank (c_var_address, c_var_rank)
 Get the variable rank (non-BMI).
integer(kind=c_int) function get_var_shape (c_var_address, c_var_shape)
 Get the shape of the array for the variable (non-BMI).

Variables

integer(c_int), bind(C, name="ISTDOUTTOFILE") istdout_to_file = 1
 output control: =0 to screen, >0 to file

Detailed Description

This BMI interface matches the CSDMS standard, with a few modifications:

  • This interface will build into a shared library that can be called from other executables and scripts, not necessarily written in Fortran. Therefore we have omitted the type-boundness of the routines, since they cannot have the bind(C,"...") attribute.
  • MODFLOW has internal data arrays with rank > 1 that we would like to expose. An example would be access to data in the BOUND array of GWF boundary packages (BndType). The get_value_ptr calls below support this, returning a C-style pointer to the arrays and methods have been added to query the variable's rank and shape.

Note on style: BMI apparently uses underscores, we use underscores in some places but camelcase in other. Since this is a dedicated BMI interface module, we'll use underscores here as well.

Function/Subroutine Documentation

◆ bmi_finalize()

integer(kind=c_int) function mf6bmi::bmi_finalize

Performs teardown tasks for the initialized simulation, this call should match the call to bmi_initialize()

Returns
BMI status code

Definition at line 157 of file mf6bmi.f90.

158 !DIR$ ATTRIBUTES DLLEXPORT :: bmi_finalize
159 ! -- modules
161 ! -- dummy variables
162 integer(kind=c_int) :: bmi_status !< BMI status code
163
164 ! we don't want a full stop() here, this disables it:
165 iforcestop = 0
166 call mf6finalize()
167
168 bmi_status = bmi_success
169
This module contains simulation variables.
integer(i4b) iforcestop
forced stop flag (1) forces a call to ustop(..) when the simulation has ended, (0) doesn't
Here is the call graph for this function:

◆ bmi_get_component_name()

integer(kind=c_int) function mf6bmi::bmi_get_component_name ( character(kind=c_char), dimension(bmi_lencomponentname), intent(inout) name)
Returns
BMI status code

Definition at line 43 of file mf6bmi.f90.

45 !DIR$ ATTRIBUTES DLLEXPORT :: bmi_get_component_name
46 ! -- dummy variables
47 character(kind=c_char), intent(inout) :: name(BMI_LENCOMPONENTNAME)
48 integer(kind=c_int) :: bmi_status !< BMI status code
49 ! -- local variables
50 character(len=*), parameter :: component_name = 'MODFLOW 6'
51
52 name(1:len(component_name) + 1) = &
53 string_to_char_array(component_name, len(component_name))
54 bmi_status = bmi_success
55
Here is the call graph for this function:

◆ bmi_initialize()

integer(kind=c_int) function mf6bmi::bmi_initialize

It is required to have the MODFLOW 6 configuration file 'mfsim.nam' available in the current working directory when calling this routine.

NOTE: initialization should always be matched with a call to bmi_finalize(). However, we currently do not support the reinitialization of a model in the same memory space... You would have to create a new process for that.

Returns
BMI status code

Definition at line 68 of file mf6bmi.f90.

69 !DIR$ ATTRIBUTES DLLEXPORT :: bmi_initialize
70 ! -- dummy variables
71 integer(kind=c_int) :: bmi_status !< BMI status code
72 ! -- local variables
73
74 if (istdout_to_file > 0) then
75 ! -- open stdout file mfsim.stdout
76 istdout = getunit()
77 !
78 ! -- set STDOUT to a physical file unit
79 open (unit=istdout, file=simstdout)
80 end if
81 !
82 ! -- initialize MODFLOW 6
83 call mf6initialize()
84
85 bmi_status = bmi_success
86
Here is the call graph for this function:

◆ bmi_update()

integer(kind=c_int) function mf6bmi::bmi_update

It will prepare the timestep, call the calculation routine on all the solution groups in the simulation, and finalize the timestep by printing out diagnostics and writing output. It can be called in succession to perform multiple steps up to the simulation's end time is reached.

Returns
BMI status code

Definition at line 97 of file mf6bmi.f90.

98 !DIR$ ATTRIBUTES DLLEXPORT :: bmi_update
99 ! -- dummy variables
100 integer(kind=c_int) :: bmi_status !< BMI status code
101 ! -- local variables
102 logical :: hasConverged
103
104 hasconverged = mf6update()
105
106 bmi_status = bmi_success
Here is the call graph for this function:

◆ bmi_update_until()

integer(kind=c_int) function mf6bmi::bmi_update_until ( real(kind=c_double), intent(in), value time)

Time steps are not split, so the current time can pass time. A time before the current time or after the end time is an error.

Parameters
[in]timetime to advance the simulation to
Returns
BMI status code

Definition at line 114 of file mf6bmi.f90.

116 !DIR$ ATTRIBUTES DLLEXPORT :: bmi_update_until
117 ! -- modules
118 use constantsmodule, only: done, dem10
120 ! -- dummy variables
121 real(kind=c_double), value, intent(in) :: time !< time to advance the simulation to
122 integer(kind=c_int) :: bmi_status !< BMI status code
123 ! -- local variables
124 real(DP) :: tol
125 logical :: hasConverged
126
127 bmi_status = bmi_failure
128
129 ! -- times within a relative 1e-10 are the same time, so that roundoff
130 ! accumulated in the simulation time does not add a time step
131 tol = dem10 * max(done, abs(time))
132 if (time < totim - tol) then
133 write (bmi_last_error, fmt_invalid_time) time, &
134 'which is before the current time'
135 call report_bmi_error(bmi_last_error)
136 return
137 end if
138 if (time > totalsimtime + tol) then
139 write (bmi_last_error, fmt_invalid_time) time, &
140 'which is after the end time'
141 call report_bmi_error(bmi_last_error)
142 return
143 end if
144
145 do while (totim < time - tol .and. .not. endofsimulation)
146 hasconverged = mf6update()
147 end do
148
149 bmi_status = bmi_success
This module contains simulation constants.
Definition Constants.f90:9
real(dp), parameter dem10
real constant 1e-10
real(dp), parameter done
real constant 1
Definition Constants.f90:76
logical(lgp), pointer, public endofsimulation
flag indicating end of simulation
Definition tdis.f90:31
real(dp), pointer, public totim
time relative to start of simulation
Definition tdis.f90:35
real(dp), pointer, public totalsimtime
time at end of simulation
Definition tdis.f90:40
Here is the call graph for this function:

◆ get_current_time()

integer(kind=c_int) function mf6bmi::get_current_time ( real(kind=c_double), intent(out) current_time)

As MODFLOW currently does not have internal time, this will be equal to the time passed w.r.t. the start time of the simulation.

Parameters
[out]current_timecurrent time
Returns
BMI status code

Definition at line 212 of file mf6bmi.f90.

214 !DIR$ ATTRIBUTES DLLEXPORT :: get_current_time
215 ! -- modules
216 use tdismodule, only: totim
217 ! -- dummy variables
218 real(kind=c_double), intent(out) :: current_time !< current time
219 integer(kind=c_int) :: bmi_status !< BMI status code
220
221 current_time = totim
222 bmi_status = bmi_success
223

◆ get_end_time()

integer(kind=c_int) function mf6bmi::get_end_time ( real(kind=c_double), intent(out) end_time)

As MODFLOW does currently does not have internal time, this will be equal to the total runtime.

Parameters
[out]end_timeend time
Returns
BMI status code

Definition at line 194 of file mf6bmi.f90.

195 !DIR$ ATTRIBUTES DLLEXPORT :: get_end_time
196 ! -- modules
197 use tdismodule, only: totalsimtime
198 ! -- dummy variables
199 real(kind=c_double), intent(out) :: end_time !< end time
200 integer(kind=c_int) :: bmi_status !< BMI status code
201
202 end_time = totalsimtime
203 bmi_status = bmi_success
204

◆ get_input_item_count()

integer(kind=c_int) function mf6bmi::get_input_item_count ( integer(kind=c_int), intent(out) count)

This concerns all variables stored in the memory manager

Parameters
[out]countthe number of input variables
Returns
BMI status code

Definition at line 285 of file mf6bmi.f90.

287 !DIR$ ATTRIBUTES DLLEXPORT :: get_input_item_count
288 ! -- dummy variables
289 integer(kind=c_int), intent(out) :: count !< the number of input variables
290 integer(kind=c_int) :: bmi_status !< BMI status code
291
292 count = memorystore%count()
293
294 bmi_status = bmi_success
295

◆ get_input_var_names()

integer(kind=c_int) function mf6bmi::get_input_var_names ( character(kind=c_char, len=1), dimension(*), intent(inout) c_names)

This functions returns the full address for all variables in the memory manager

The array c_names should be pre-allocated of proper size:

size = BMI_LENVARADDRESS * get_input_item_count()

The strings will be written contiguously with stride equal to BMI_LENVARADDRESS and nul-terminated where the trailing spaces start:

c_names = 'variable_address_1\0 ... variable_address_2\0 ... ' etc.

Parameters
[in,out]c_namesarray with memory paths for input variables
Returns
BMI status code

Definition at line 329 of file mf6bmi.f90.

331 !DIR$ ATTRIBUTES DLLEXPORT :: get_input_var_names
332 ! -- dummy variables
333 character(kind=c_char, len=1), intent(inout) :: c_names(*) !< array with memory paths for input variables
334 integer(kind=c_int) :: bmi_status !< BMI status code
335 ! -- local variables
336 integer(I4B) :: start, i
337 type(MemoryContainerIteratorType), allocatable :: itr
338 type(MemoryType), pointer :: mt => null()
339 character(len=LENMEMADDRESS) :: var_address
340
341 start = 1
342 itr = memorystore%iterator()
343 do while (itr%has_next())
344 call itr%next()
345 mt => itr%value()
346 var_address = create_mem_address(mt%path, mt%name)
347 do i = 1, len(trim(var_address))
348 c_names(start + i - 1) = var_address(i:i)
349 end do
350 c_names(start + i) = c_null_char
351 start = start + bmi_lenvaraddress
352 end do
353
354 bmi_status = bmi_success
355
Here is the call graph for this function:

◆ get_output_item_count()

integer(kind=c_int) function mf6bmi::get_output_item_count ( integer(kind=c_int), intent(out) count)

This concerns all variables stored in the memory manager

Parameters
[out]countthe number of output variables
Returns
BMI status code

Definition at line 302 of file mf6bmi.f90.

304 !DIR$ ATTRIBUTES DLLEXPORT :: get_output_item_count
305 ! -- dummy variables
306 integer(kind=c_int), intent(out) :: count !< the number of output variables
307 integer(kind=c_int) :: bmi_status !< BMI status code
308
309 count = memorystore%count()
310
311 bmi_status = bmi_success
312

◆ get_output_var_names()

integer(kind=c_int) function mf6bmi::get_output_var_names ( character(kind=c_char, len=1), dimension(*), intent(inout) c_names)

This function works analogously to get_input_var_names(), and currently returns the same set of memory variables, which is all of them!

Parameters
[in,out]c_namesarray with memory paths for output variables
Returns
BMI status code

Definition at line 364 of file mf6bmi.f90.

366 !DIR$ ATTRIBUTES DLLEXPORT :: get_output_var_names
367 ! -- dummy variables
368 character(kind=c_char, len=1), intent(inout) :: c_names(*) !< array with memory paths for output variables
369 integer(kind=c_int) :: bmi_status !< BMI status code
370 ! -- local variables
371 integer(I4B) :: start, i
372 type(MemoryContainerIteratorType), allocatable :: itr
373 type(MemoryType), pointer :: mt => null()
374 character(len=LENMEMADDRESS) :: var_address
375
376 start = 1
377 itr = memorystore%iterator()
378 do while (itr%has_next())
379 call itr%next()
380 mt => itr%value()
381 var_address = create_mem_address(mt%path, mt%name)
382 do i = 1, len(trim(var_address))
383 c_names(start + i - 1) = var_address(i:i)
384 end do
385 c_names(start + i) = c_null_char
386 start = start + bmi_lenvaraddress
387 end do
388
389 bmi_status = bmi_success
390
Here is the call graph for this function:

◆ get_start_time()

integer(kind=c_int) function mf6bmi::get_start_time ( real(kind=c_double), intent(out) start_time)

As MODFLOW currently does not have internal time, this will be returning 0.0 for now. New version...

Parameters
[out]start_timestart time
Returns
BMI status code

Definition at line 177 of file mf6bmi.f90.

179 !DIR$ ATTRIBUTES DLLEXPORT :: get_start_time
180 ! -- dummy variables
181 real(kind=c_double), intent(out) :: start_time !< start time
182 integer(kind=c_int) :: bmi_status !< BMI status code
183
184 start_time = 0.0_dp
185 bmi_status = bmi_success
186

◆ get_time_step()

integer(kind=c_int) function mf6bmi::get_time_step ( real(kind=c_double), intent(out) time_step)

Note that the returned value may vary between and within stress periods, depending on your time discretization settings in the TDIS package.

Parameters
[out]time_stepcurrent time step
Returns
BMI status code

Definition at line 231 of file mf6bmi.f90.

233 !DIR$ ATTRIBUTES DLLEXPORT :: get_time_step
234 ! -- modules
235 use tdismodule, only: delt
236 ! -- dummy variables
237 real(kind=c_double), intent(out) :: time_step !< current time step
238 integer(kind=c_int) :: bmi_status !< BMI status code
239
240 time_step = delt
241 bmi_status = bmi_success
242
real(dp), pointer, public delt
length of the current time step
Definition tdis.f90:32

◆ get_time_units()

integer(kind=c_int) function mf6bmi::get_time_units ( character(kind=c_char), dimension(bmi_lenunits), intent(out) c_time_units)

The units are those of TIME_UNITS in the TDIS Package, as UDUNITS symbols, or 'unknown' when TIME_UNITS is not given.

Parameters
[out]c_time_unitstime units as a string
Returns
BMI status code

Definition at line 250 of file mf6bmi.f90.

252 !DIR$ ATTRIBUTES DLLEXPORT :: get_time_units
253 ! -- modules
254 use tdismodule, only: itmuni
255 ! -- dummy variables
256 character(kind=c_char), intent(out) :: c_time_units(BMI_LENUNITS) !< time units as a string
257 integer(kind=c_int) :: bmi_status !< BMI status code
258 ! -- local variables
259 character(len=LENUNITS) :: time_units
260
261 select case (itmuni)
262 case (1)
263 time_units = 's'
264 case (2)
265 time_units = 'min'
266 case (3)
267 time_units = 'h'
268 case (4)
269 time_units = 'd'
270 case (5)
271 time_units = 'year'
272 case default
273 time_units = 'unknown'
274 end select
275 c_time_units(1:len_trim(time_units) + 1) = &
276 string_to_char_array(trim(time_units), len_trim(time_units))
277 bmi_status = bmi_success
278
integer(i4b), pointer, public itmuni
flag indicating time units
Definition tdis.f90:25
Here is the call graph for this function:

◆ get_value()

integer(kind=c_int) function mf6bmi::get_value ( character(kind=c_char), dimension(*), intent(in) c_var_address,
type(c_ptr), intent(inout) c_arr_ptr )

The copied variable is located at c_var_address. The caller should provide c_arr_ptr pointing to an array of the proper shape (the BMI function get_var_shape() can be used to create it). Multi-dimensional arrays are supported.

Parameters
[in]c_var_addressmemory address string of the variable
[in,out]c_arr_ptrpointer to the array
Returns
BMI status code

Definition at line 738 of file mf6bmi.f90.

740 !DIR$ ATTRIBUTES DLLEXPORT :: get_value
741 ! -- modules
742 use constantsmodule, only: lenmemtype
743 ! -- dummy variables
744 character(kind=c_char), intent(in) :: c_var_address(*) !< memory address string of the variable
745 type(c_ptr), intent(inout) :: c_arr_ptr !< pointer to the array
746 integer(kind=c_int) :: bmi_status !< BMI status code
747 ! -- local variables
748 character(len=LENMEMPATH) :: mem_path
749 character(len=LENMEMTYPE) :: mem_type
750 character(len=LENVARNAME) :: var_name
751 logical(LGP) :: valid
752
753 bmi_status = bmi_success
754
755 call split_address(c_var_address, mem_path, var_name, valid)
756 if (.not. valid) then
757 bmi_status = bmi_failure
758 return
759 end if
760
761 call get_mem_type(var_name, mem_path, mem_type)
762
763 if (index(mem_type, "DOUBLE") /= 0) then
764 bmi_status = get_value_double(c_var_address, c_arr_ptr)
765 else if (index(mem_type, "INTEGER") /= 0) then
766 bmi_status = get_value_int(c_var_address, c_arr_ptr)
767 else if (index(mem_type, "LOGICAL") /= 0) then
768 bmi_status = get_value_bool(c_var_address, c_arr_ptr)
769 else if (index(mem_type, "STRING") /= 0) then
770 bmi_status = get_value_string(c_var_address, c_arr_ptr)
771 else
772 write (bmi_last_error, fmt_unsupported_type) trim(var_name)
773 call report_bmi_error(bmi_last_error)
774 bmi_status = bmi_failure
775 return
776 end if
777
integer(i4b), parameter, public lenmemtype
maximum length of a memory manager type
Definition Constants.f90:62
Here is the call graph for this function:

◆ get_value_at_indices()

integer(kind=c_int) function mf6bmi::get_value_at_indices ( character(kind=c_char), dimension(*), intent(in) c_var_address,
type(c_ptr), intent(in) c_arr_ptr,
integer(kind=c_int), dimension(*), intent(in) c_inds,
integer(kind=c_int), intent(in) count )

The indices are zero-based positions in the variable's values in C-style (row-major) order of the shape returned by get_var_shape(), so a variable of rank > 1 is indexed as if flattened. The caller should provide c_arr_ptr pointing to an array of size count. Double precision and integer variables are supported.

Parameters
[in]c_var_addressmemory address string of the variable
[in]c_arr_ptrpointer to the array to copy into
[in]c_indszero-based indices of the values
[in]countnumber of indices
Returns
BMI status code

Definition at line 1234 of file mf6bmi.f90.

1236 !DIR$ ATTRIBUTES DLLEXPORT :: get_value_at_indices
1237 ! -- modules
1238 use constantsmodule, only: lenmemtype
1239 ! -- dummy variables
1240 character(kind=c_char), intent(in) :: c_var_address(*) !< memory address string of the variable
1241 type(c_ptr), intent(in) :: c_arr_ptr !< pointer to the array to copy into
1242 integer(kind=c_int), intent(in) :: c_inds(*) !< zero-based indices of the values
1243 integer(kind=c_int), intent(in) :: count !< number of indices
1244 integer(kind=c_int) :: bmi_status !< BMI status code
1245 ! -- local variables
1246 character(len=LENMEMPATH) :: mem_path
1247 character(len=LENMEMTYPE) :: mem_type
1248 character(len=LENVARNAME) :: var_name
1249 logical(LGP) :: valid
1250 integer(I4B) :: i, nvalues
1251 type(c_ptr) :: var_ptr
1252 real(DP), dimension(:), pointer, contiguous :: src_dbl, tgt_dbl
1253 integer(I4B), dimension(:), pointer, contiguous :: src_int, tgt_int
1254
1255 bmi_status = bmi_failure
1256
1257 call split_address(c_var_address, mem_path, var_name, valid)
1258 if (.not. valid) return
1259 if (.not. valid_indices(mem_path, var_name, c_inds, count, nvalues)) return
1260
1261 ! -- the variable's storage, viewed as a flat array in memory order
1262 call get_mem_type(var_name, mem_path, mem_type)
1263 if (index(mem_type, "DOUBLE") /= 0) then
1264 if (get_value_ptr_double(c_var_address, var_ptr) /= bmi_success) return
1265 call c_f_pointer(var_ptr, src_dbl, [nvalues])
1266 call c_f_pointer(c_arr_ptr, tgt_dbl, [count])
1267 do i = 1, count
1268 tgt_dbl(i) = src_dbl(c_inds(i) + 1)
1269 end do
1270 else if (index(mem_type, "INTEGER") /= 0) then
1271 if (get_value_ptr_int(c_var_address, var_ptr) /= bmi_success) return
1272 call c_f_pointer(var_ptr, src_int, [nvalues])
1273 call c_f_pointer(c_arr_ptr, tgt_int, [count])
1274 do i = 1, count
1275 tgt_int(i) = src_int(c_inds(i) + 1)
1276 end do
1277 else
1278 write (bmi_last_error, fmt_unsupported_type) trim(var_name)
1279 call report_bmi_error(bmi_last_error)
1280 return
1281 end if
1282
1283 bmi_status = bmi_success
1284
Here is the call graph for this function:

◆ get_value_bool()

integer(kind=c_int) function mf6bmi::get_value_bool ( character(kind=c_char), dimension(*), intent(in) c_var_address,
type(c_ptr), intent(in) c_arr_ptr )

The copied variable us located at c_var_address. The caller should provide c_arr_ptr pointing to a scalar array with rank=0.

Parameters
[in]c_var_addressmemory address string of the variable
[in]c_arr_ptrpointer to the logical array
Returns
BMI status code

Definition at line 611 of file mf6bmi.f90.

613 !DIR$ ATTRIBUTES DLLEXPORT :: get_value_bool
614 ! -- modules
616 ! -- dummy variables
617 character(kind=c_char), intent(in) :: c_var_address(*) !< memory address string of the variable
618 type(c_ptr), intent(in) :: c_arr_ptr !< pointer to the logical array
619 integer(kind=c_int) :: bmi_status !< BMI status code
620 ! -- local variables
621 character(len=LENMEMPATH) :: mem_path
622 character(len=LENVARNAME) :: var_name
623 logical(LGP) :: valid
624 integer(I4B) :: rank
625 logical(LGP), pointer :: src_ptr, tgt_ptr
626
627 bmi_status = bmi_success
628
629 call split_address(c_var_address, mem_path, var_name, valid)
630 if (.not. valid) then
631 bmi_status = bmi_failure
632 return
633 end if
634
635 rank = -1
636 call get_mem_rank(var_name, mem_path, rank)
637
638 ! convert pointer
639 if (rank == 0) then
640 call mem_setptr(src_ptr, var_name, mem_path)
641 call c_f_pointer(c_arr_ptr, tgt_ptr)
642 tgt_ptr = src_ptr
643 else
644 write (bmi_last_error, fmt_unsupported_rank) trim(var_name)
645 call report_bmi_error(bmi_last_error)
646 bmi_status = bmi_failure
647 return
648 end if
649
subroutine, public on_memory_set(var_name, mem_path, status)
Triggers the calling of the side effect handler for this variable.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_value_double()

integer(kind=c_int) function mf6bmi::get_value_double ( character(kind=c_char), dimension(*), intent(in) c_var_address,
type(c_ptr), intent(in) c_arr_ptr )

The copied variable us located at c_var_address. The caller should provide c_arr_ptr pointing to an array of the proper shape (the BMI function get_var_shape() can be used to create it). Multi-dimensional arrays are supported.

Parameters
[in]c_var_addressmemory address string of the variable
[in]c_arr_ptrpointer to the double precision array
Returns
BMI status code

Definition at line 459 of file mf6bmi.f90.

461 !DIR$ ATTRIBUTES DLLEXPORT :: get_value_double
462 ! -- modules
464 ! -- dummy variables
465 character(kind=c_char), intent(in) :: c_var_address(*) !< memory address string of the variable
466 type(c_ptr), intent(in) :: c_arr_ptr !< pointer to the double precision array
467 integer(kind=c_int) :: bmi_status !< BMI status code
468 ! -- local variables
469 character(len=LENMEMPATH) :: mem_path
470 character(len=LENVARNAME) :: var_name
471 logical(LGP) :: valid
472 integer(I4B) :: rank
473 real(DP), pointer :: src_ptr, tgt_ptr
474 real(DP), dimension(:), pointer, contiguous :: src1D_ptr, tgt1D_ptr
475 real(DP), dimension(:, :), pointer, contiguous :: src2D_ptr, tgt2D_ptr
476 real(DP), dimension(:, :, :), pointer, contiguous :: src3D_ptr, tgt3D_ptr
477 integer(I4B) :: i, j, k
478
479 bmi_status = bmi_success
480
481 call split_address(c_var_address, mem_path, var_name, valid)
482 if (.not. valid) then
483 bmi_status = bmi_failure
484 return
485 end if
486
487 ! convert pointer and copy data from memory manager into
488 ! the passed array, using loops to avoid stack overflow
489 rank = -1
490 call get_mem_rank(var_name, mem_path, rank)
491
492 if (rank == 0) then
493 call mem_setptr(src_ptr, var_name, mem_path)
494 call c_f_pointer(c_arr_ptr, tgt_ptr)
495 tgt_ptr = src_ptr
496 else if (rank == 1) then
497 call mem_setptr(src1d_ptr, var_name, mem_path)
498 call c_f_pointer(c_arr_ptr, tgt1d_ptr, shape(src1d_ptr))
499 do i = 1, size(tgt1d_ptr)
500 tgt1d_ptr(i) = src1d_ptr(i)
501 end do
502 else if (rank == 2) then
503 call mem_setptr(src2d_ptr, var_name, mem_path)
504 call c_f_pointer(c_arr_ptr, tgt2d_ptr, shape(src2d_ptr))
505 do j = 1, size(tgt2d_ptr, 2)
506 do i = 1, size(tgt2d_ptr, 1)
507 tgt2d_ptr(i, j) = src2d_ptr(i, j)
508 end do
509 end do
510 else if (rank == 3) then
511 call mem_setptr(src3d_ptr, var_name, mem_path)
512 call c_f_pointer(c_arr_ptr, tgt3d_ptr, shape(src3d_ptr))
513 do k = 1, size(tgt3d_ptr, 3)
514 do j = 1, size(tgt3d_ptr, 2)
515 do i = 1, size(tgt3d_ptr, 1)
516 tgt3d_ptr(i, j, k) = src3d_ptr(i, j, k)
517 end do
518 end do
519 end do
520 else
521 write (bmi_last_error, fmt_unsupported_rank) trim(var_name)
522 call report_bmi_error(bmi_last_error)
523 bmi_status = bmi_failure
524 return
525 end if
526
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_value_int()

integer(kind=c_int) function mf6bmi::get_value_int ( character(kind=c_char), dimension(*), intent(in) c_var_address,
type(c_ptr), intent(in) c_arr_ptr )

The copied variable is located at c_var_address. The caller should provide c_arr_ptr pointing to an array of the proper shape (the BMI function get_var_shape() can be used to create it). Multi-dimensional arrays are supported.

Parameters
[in]c_var_addressmemory address string of the variable
[in]c_arr_ptrpointer to the integer array
Returns
BMI status code

Definition at line 536 of file mf6bmi.f90.

538 !DIR$ ATTRIBUTES DLLEXPORT :: get_value_int
539 ! -- modules
541 ! -- dummy variables
542 character(kind=c_char), intent(in) :: c_var_address(*) !< memory address string of the variable
543 type(c_ptr), intent(in) :: c_arr_ptr !< pointer to the integer array
544 integer(kind=c_int) :: bmi_status !< BMI status code
545 ! -- local variables
546 character(len=LENMEMPATH) :: mem_path
547 character(len=LENVARNAME) :: var_name
548 logical(LGP) :: valid
549 integer(I4B) :: rank
550 integer(I4B), pointer :: src_ptr, tgt_ptr
551 integer(I4B), dimension(:), pointer, contiguous :: src1D_ptr, tgt1D_ptr
552 integer(I4B), dimension(:, :), pointer, contiguous :: src2D_ptr, tgt2D_ptr
553 integer(I4B), dimension(:, :, :), pointer, contiguous :: src3D_ptr, tgt3D_ptr
554 integer(I4B) :: i, j, k
555
556 bmi_status = bmi_success
557
558 call split_address(c_var_address, mem_path, var_name, valid)
559 if (.not. valid) then
560 bmi_status = bmi_failure
561 return
562 end if
563
564 ! convert pointer and copy data from memory manager into
565 ! the passed array, using loops to avoid stack overflow
566 rank = -1
567 call get_mem_rank(var_name, mem_path, rank)
568
569 if (rank == 0) then
570 call mem_setptr(src_ptr, var_name, mem_path)
571 call c_f_pointer(c_arr_ptr, tgt_ptr)
572 tgt_ptr = src_ptr
573 else if (rank == 1) then
574 call mem_setptr(src1d_ptr, var_name, mem_path)
575 call c_f_pointer(c_arr_ptr, tgt1d_ptr, shape(src1d_ptr))
576 do i = 1, size(tgt1d_ptr)
577 tgt1d_ptr(i) = src1d_ptr(i)
578 end do
579 else if (rank == 2) then
580 call mem_setptr(src2d_ptr, var_name, mem_path)
581 call c_f_pointer(c_arr_ptr, tgt2d_ptr, shape(src2d_ptr))
582 do j = 1, size(tgt2d_ptr, 2)
583 do i = 1, size(tgt2d_ptr, 1)
584 tgt2d_ptr(i, j) = src2d_ptr(i, j)
585 end do
586 end do
587 else if (rank == 3) then
588 call mem_setptr(src3d_ptr, var_name, mem_path)
589 call c_f_pointer(c_arr_ptr, tgt3d_ptr, shape(src3d_ptr))
590 do k = 1, size(tgt3d_ptr, 3)
591 do j = 1, size(tgt3d_ptr, 2)
592 do i = 1, size(tgt3d_ptr, 1)
593 tgt3d_ptr(i, j, k) = src3d_ptr(i, j, k)
594 end do
595 end do
596 end do
597 else
598 write (bmi_last_error, fmt_unsupported_rank) trim(var_name)
599 call report_bmi_error(bmi_last_error)
600 bmi_status = bmi_failure
601 return
602 end if
603
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_value_ptr()

integer(kind=c_int) function mf6bmi::get_value_ptr ( character(kind=c_char), dimension(*), intent(in) c_var_address,
type(c_ptr), intent(inout) c_arr_ptr )

The array is located at c_var_address. There is no copying of data involved. Multi-dimensional arrays are supported and the get_var_rank() function can be used to get the variable's dimensionality, and get_var_shape() for its shape.

Parameters
[in]c_var_addressmemory address string of the variable
[in,out]c_arr_ptrpointer to the array
Returns
BMI status code

Definition at line 787 of file mf6bmi.f90.

789 !DIR$ ATTRIBUTES DLLEXPORT :: get_value_ptr
790 ! -- modules
791 use constantsmodule, only: lenmemtype
792 ! -- dummy variables
793 character(kind=c_char), intent(in) :: c_var_address(*) !< memory address string of the variable
794 type(c_ptr), intent(inout) :: c_arr_ptr !< pointer to the array
795 integer(kind=c_int) :: bmi_status !< BMI status code
796 ! -- local variables
797 character(len=LENMEMPATH) :: mem_path
798 character(len=LENMEMTYPE) :: mem_type
799 character(len=LENVARNAME) :: var_name
800 logical(LGP) :: valid
801
802 bmi_status = bmi_success
803
804 call split_address(c_var_address, mem_path, var_name, valid)
805 if (.not. valid) then
806 bmi_status = bmi_failure
807 return
808 end if
809
810 call get_mem_type(var_name, mem_path, mem_type)
811
812 if (index(mem_type, "DOUBLE") /= 0) then
813 bmi_status = get_value_ptr_double(c_var_address, c_arr_ptr)
814 else if (index(mem_type, "INTEGER") /= 0) then
815 bmi_status = get_value_ptr_int(c_var_address, c_arr_ptr)
816 else if (index(mem_type, "LOGICAL") /= 0) then
817 bmi_status = get_value_ptr_bool(c_var_address, c_arr_ptr)
818 else
819 write (bmi_last_error, fmt_unsupported_type) trim(var_name)
820 call report_bmi_error(bmi_last_error)
821 bmi_status = bmi_failure
822 return
823 end if
824
Here is the call graph for this function:

◆ get_value_ptr_bool()

integer(kind=c_int) function mf6bmi::get_value_ptr_bool ( character(kind=c_char), dimension(*), intent(in) c_var_address,
type(c_ptr), intent(inout) c_arr_ptr )

Only scalar values (with rank=0) are supported.

Parameters
[in]c_var_addressmemory address string of the variable
[in,out]c_arr_ptrpointer to the array
Returns
BMI status code

Definition at line 941 of file mf6bmi.f90.

943 !DIR$ ATTRIBUTES DLLEXPORT :: get_value_ptr_bool
944 ! -- dummy variables
945 character(kind=c_char), intent(in) :: c_var_address(*) !< memory address string of the variable
946 type(c_ptr), intent(inout) :: c_arr_ptr !< pointer to the array
947 integer(kind=c_int) :: bmi_status !< BMI status code
948 ! -- local variables
949 character(len=LENMEMPATH) :: mem_path
950 character(len=LENVARNAME) :: var_name
951 logical(LGP) :: valid
952 logical(LGP), pointer :: scalar_ptr
953 integer(I4B) :: rank
954
955 bmi_status = bmi_success
956
957 call split_address(c_var_address, mem_path, var_name, valid)
958 if (.not. valid) then
959 bmi_status = bmi_failure
960 return
961 end if
962
963 rank = -1
964 call get_mem_rank(var_name, mem_path, rank)
965 if (rank == 0) then
966 call mem_setptr(scalar_ptr, var_name, mem_path)
967 c_arr_ptr = c_loc(scalar_ptr)
968 else
969 write (bmi_last_error, fmt_unsupported_rank) trim(var_name)
970 call report_bmi_error(bmi_last_error)
971 bmi_status = bmi_failure
972 return
973 end if
974
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_value_ptr_double()

integer(kind=c_int) function mf6bmi::get_value_ptr_double ( character(kind=c_char), dimension(*), intent(in) c_var_address,
type(c_ptr), intent(inout) c_arr_ptr )

The array is located at c_var_address. There is no copying of data involved. Multi-dimensional arrays are supported and the get_var_rank() function can be used to get the variable's dimensionality, and get_var_shape() for its shape.

Parameters
[in]c_var_addressmemory address string of the variable
[in,out]c_arr_ptrpointer to the array
Returns
BMI status code

Definition at line 834 of file mf6bmi.f90.

836 !DIR$ ATTRIBUTES DLLEXPORT :: get_value_ptr_double
837 ! -- dummy variables
838 character(kind=c_char), intent(in) :: c_var_address(*) !< memory address string of the variable
839 type(c_ptr), intent(inout) :: c_arr_ptr !< pointer to the array
840 integer(kind=c_int) :: bmi_status !< BMI status code
841 ! -- local variables
842 character(len=LENMEMPATH) :: mem_path
843 character(len=LENVARNAME) :: var_name
844 logical(LGP) :: valid
845 real(DP), pointer :: scalar_ptr
846 real(DP), dimension(:), pointer, contiguous :: array_ptr
847 real(DP), dimension(:, :), pointer, contiguous :: array2D_ptr
848 real(DP), dimension(:, :, :), pointer, contiguous :: array3D_ptr
849 integer(I4B) :: rank
850
851 bmi_status = bmi_success
852
853 call split_address(c_var_address, mem_path, var_name, valid)
854 if (.not. valid) then
855 bmi_status = bmi_failure
856 return
857 end if
858
859 rank = -1
860 call get_mem_rank(var_name, mem_path, rank)
861 if (rank == 0) then
862 call mem_setptr(scalar_ptr, var_name, mem_path)
863 c_arr_ptr = c_loc(scalar_ptr)
864 else if (rank == 1) then
865 call mem_setptr(array_ptr, var_name, mem_path)
866 c_arr_ptr = c_loc(array_ptr)
867 else if (rank == 2) then
868 call mem_setptr(array2d_ptr, var_name, mem_path)
869 c_arr_ptr = c_loc(array2d_ptr)
870 else if (rank == 3) then
871 call mem_setptr(array3d_ptr, var_name, mem_path)
872 c_arr_ptr = c_loc(array3d_ptr)
873 else
874 write (bmi_last_error, fmt_unsupported_rank) trim(var_name)
875 call report_bmi_error(bmi_last_error)
876 bmi_status = bmi_failure
877 return
878 end if
879
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_value_ptr_int()

integer(kind=c_int) function mf6bmi::get_value_ptr_int ( character(kind=c_char), dimension(*), intent(in) c_var_address,
type(c_ptr), intent(inout) c_arr_ptr )

The array is located at c_var_address. There is no copying of data involved. Multi-dimensional arrays are supported and the get_var_rank() function can be used to get the variable's dimensionality.

Parameters
[in]c_var_addressmemory address string of the variable
[in,out]c_arr_ptrpointer to the array
Returns
BMI status code

Definition at line 888 of file mf6bmi.f90.

890 !DIR$ ATTRIBUTES DLLEXPORT :: get_value_ptr_int
891 ! -- dummy variables
892 character(kind=c_char), intent(in) :: c_var_address(*) !< memory address string of the variable
893 type(c_ptr), intent(inout) :: c_arr_ptr !< pointer to the array
894 integer(kind=c_int) :: bmi_status !< BMI status code
895 ! -- local variables
896 character(len=LENMEMPATH) :: mem_path
897 character(len=LENVARNAME) :: var_name
898 logical(LGP) :: valid
899 integer(I4B) :: rank
900 integer(I4B), pointer :: scalar_ptr
901 integer(I4B), dimension(:), pointer, contiguous :: array_ptr
902 integer(I4B), dimension(:, :), pointer, contiguous :: array2D_ptr
903 integer(I4B), dimension(:, :, :), pointer, contiguous :: array3D_ptr
904
905 bmi_status = bmi_success
906
907 call split_address(c_var_address, mem_path, var_name, valid)
908 if (.not. valid) then
909 bmi_status = bmi_failure
910 return
911 end if
912
913 rank = -1
914 call get_mem_rank(var_name, mem_path, rank)
915
916 if (rank == 0) then
917 call mem_setptr(scalar_ptr, var_name, mem_path)
918 c_arr_ptr = c_loc(scalar_ptr)
919 else if (rank == 1) then
920 call mem_setptr(array_ptr, var_name, mem_path)
921 c_arr_ptr = c_loc(array_ptr)
922 else if (rank == 2) then
923 call mem_setptr(array2d_ptr, var_name, mem_path)
924 c_arr_ptr = c_loc(array2d_ptr)
925 else if (rank == 3) then
926 call mem_setptr(array3d_ptr, var_name, mem_path)
927 c_arr_ptr = c_loc(array3d_ptr)
928 else
929 write (bmi_last_error, fmt_unsupported_rank) trim(var_name)
930 call report_bmi_error(bmi_last_error)
931 bmi_status = bmi_failure
932 return
933 end if
934
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_value_string()

integer(kind=c_int) function mf6bmi::get_value_string ( character(kind=c_char), dimension(*), intent(in) c_var_address,
type(c_ptr), intent(in) c_arr_ptr )

The copied variable is located at c_var_address. The caller should provide c_arr_ptr pointing to an array of the proper shape (the BMI function get_var_shape() can be used to create it). For strings currently scalars and 1d arrays (of CharacterStringType) are

Parameters
[in]c_var_addressmemory address string of the variable
[in]c_arr_ptrpointer to the string array
Returns
BMI status code

Definition at line 659 of file mf6bmi.f90.

661 !DIR$ ATTRIBUTES DLLEXPORT :: get_value_string
662 ! -- modules
663 ! -- dummy variables
664 character(kind=c_char), intent(in) :: c_var_address(*) !< memory address string of the variable
665 type(c_ptr), intent(in) :: c_arr_ptr !< pointer to the string array
666 integer(kind=c_int) :: bmi_status !< BMI status code
667 ! -- local variables
668 character(len=LENMEMPATH) :: mem_path
669 character(len=LENVARNAME) :: var_name
670 logical(LGP) :: valid
671 integer(I4B) :: rank
672 character(len=:), pointer :: srcstr
673 character(kind=c_char), pointer :: tgtstr(:)
674 type(CharacterStringType), dimension(:), pointer, contiguous :: srccharstr1d
675 character(kind=c_char), pointer :: tgtstr1d(:, :)
676 character(:), allocatable :: tempstr
677 integer(I4B) :: i, ilen, isize
678
679 bmi_status = bmi_success
680
681 call split_address(c_var_address, mem_path, var_name, valid)
682 if (.not. valid) then
683 bmi_status = bmi_failure
684 return
685 end if
686
687 ! single string, or array of strings (CharacterStringType)
688 rank = -1
689 call get_mem_rank(var_name, mem_path, rank)
690
691 if (rank == 0) then
692 ! a string scalar
693 call mem_setptr(srcstr, var_name, mem_path)
694 call get_mem_elem_size(var_name, mem_path, ilen)
695 call c_f_pointer(c_arr_ptr, tgtstr, shape=[ilen + 1])
696
697 tgtstr(1:len(srcstr) + 1) = string_to_char_array(srcstr, len(srcstr))
698
699 else if (rank == 1) then
700 ! an array of strings
701 call mem_setptr(srccharstr1d, var_name, mem_path)
702 if (.not. associated(srccharstr1d)) then
703 write (bmi_last_error, fmt_general_err) 'string type not supported in API'
704 call report_bmi_error(bmi_last_error)
705 bmi_status = bmi_failure
706 return
707 end if
708
709 ! create fortran pointer to C data array
710 call get_isize(var_name, mem_path, isize)
711 call get_mem_elem_size(var_name, mem_path, ilen)
712 call c_f_pointer(c_arr_ptr, tgtstr1d, shape=[ilen + 1, isize])
713
714 ! allocate work array to handle CharacterStringType,
715 ! and copy the strings
716 allocate (character(ilen) :: tempstr)
717 do i = 1, isize
718 tempstr = srccharstr1d(i)
719 tgtstr1d(1:ilen + 1, i) = string_to_char_array(tempstr, ilen)
720 end do
721 deallocate (tempstr)
722 else
723 write (bmi_last_error, fmt_unsupported_rank) trim(var_name)
724 call report_bmi_error(bmi_last_error)
725 bmi_status = bmi_failure
726 return
727 end if
728
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_var_itemsize()

integer(kind=c_int) function mf6bmi::get_var_itemsize ( character(kind=c_char), dimension(*), intent(in) c_var_address,
integer(kind=c_int), intent(out) var_size )
Parameters
[in]c_var_addressmemory address string of the variable
[out]var_sizesize of the element in bytes
Returns
BMI status code

Definition at line 395 of file mf6bmi.f90.

397 !DIR$ ATTRIBUTES DLLEXPORT :: get_var_itemsize
398 ! -- dummy variables
399 character(kind=c_char), intent(in) :: c_var_address(*) !< memory address string of the variable
400 integer(kind=c_int), intent(out) :: var_size !< size of the element in bytes
401 integer(kind=c_int) :: bmi_status !< BMI status code
402 ! -- local variables
403 character(len=LENMEMPATH) :: mem_path
404 character(len=LENVARNAME) :: var_name
405 logical(LGP) :: valid
406
407 bmi_status = bmi_success
408
409 call split_address(c_var_address, mem_path, var_name, valid)
410 if (.not. valid) then
411 bmi_status = bmi_failure
412 return
413 end if
414
415 call get_mem_elem_size(var_name, mem_path, var_size)
416 if (var_size == -1) bmi_status = bmi_failure
417
Here is the call graph for this function:

◆ get_var_location()

integer(kind=c_int) function mf6bmi::get_var_location ( character(kind=c_char), dimension(*), intent(in) c_var_address,
character(kind=c_char), dimension(bmi_lenvarlocation), intent(out) c_var_location )

Every variable is reported at the grid nodes.

Parameters
[in]c_var_addressmemory address string of the variable
[out]c_var_locationvariable location as a string
Returns
BMI status code

Definition at line 1471 of file mf6bmi.f90.

1473 !DIR$ ATTRIBUTES DLLEXPORT :: get_var_location
1474 ! -- dummy variables
1475 character(kind=c_char), intent(in) :: c_var_address(*) !< memory address string of the variable
1476 character(kind=c_char), intent(out) :: c_var_location(BMI_LENVARLOCATION) !< variable location as a string
1477 integer(kind=c_int) :: bmi_status !< BMI status code
1478 ! -- local variables
1479 character(len=LENMEMPATH) :: mem_path
1480 character(len=LENVARNAME) :: var_name
1481 character(len=*), parameter :: var_location = 'node'
1482 logical(LGP) :: valid
1483
1484 bmi_status = bmi_failure
1485
1486 call split_address(c_var_address, mem_path, var_name, valid)
1487 if (.not. valid) return
1488
1489 c_var_location(1:len(var_location) + 1) = &
1490 string_to_char_array(var_location, len(var_location))
1491 bmi_status = bmi_success
1492
Here is the call graph for this function:

◆ get_var_nbytes()

integer(kind=c_int) function mf6bmi::get_var_nbytes ( character(kind=c_char), dimension(*), intent(in) c_var_address,
integer(kind=c_int), intent(out) var_nbytes )
Parameters
[in]c_var_addressmemory address string of the variable
[out]var_nbytessize in bytes
Returns
BMI status code

Definition at line 422 of file mf6bmi.f90.

424 !DIR$ ATTRIBUTES DLLEXPORT :: get_var_nbytes
425 ! -- dummy variables
426 character(kind=c_char), intent(in) :: c_var_address(*) !< memory address string of the variable
427 integer(kind=c_int), intent(out) :: var_nbytes !< size in bytes
428 integer(kind=c_int) :: bmi_status !< BMI status code
429 ! -- local variables
430 integer(I4B) :: var_size, isize
431 character(len=LENMEMPATH) :: mem_path
432 character(len=LENVARNAME) :: var_name
433 logical(LGP) :: valid
434
435 bmi_status = bmi_success
436
437 call split_address(c_var_address, mem_path, var_name, valid)
438 if (.not. valid) then
439 bmi_status = bmi_failure
440 return
441 end if
442
443 call get_mem_elem_size(var_name, mem_path, var_size)
444 if (var_size == -1) bmi_status = bmi_failure
445 call get_isize(var_name, mem_path, isize)
446 if (isize == -1) bmi_status = bmi_failure
447
448 var_nbytes = var_size * isize
449
Here is the call graph for this function:

◆ get_var_rank()

integer(kind=c_int) function mf6bmi::get_var_rank ( character(kind=c_char), dimension(*), intent(in) c_var_address,
integer(kind=c_int), intent(out) c_var_rank )

In order to support multi-dimensional arrays, this function gives access to the rank of the array.

Parameters
[in]c_var_addressmemory address string of the variable
[out]c_var_rankvariable rank
Returns
BMI status code

Definition at line 1500 of file mf6bmi.f90.

1502 !DIR$ ATTRIBUTES DLLEXPORT :: get_var_rank
1503 ! -- dummy variables
1504 character(kind=c_char), intent(in) :: c_var_address(*) !< memory address string of the variable
1505 integer(kind=c_int), intent(out) :: c_var_rank !< variable rank
1506 integer(kind=c_int) :: bmi_status !< BMI status code
1507 ! -- local variables
1508 character(len=LENMEMPATH) :: mem_path
1509 character(len=LENVARNAME) :: var_name
1510 logical(LGP) :: valid
1511
1512 bmi_status = bmi_success
1513
1514 call split_address(c_var_address, mem_path, var_name, valid)
1515 if (.not. valid) then
1516 bmi_status = bmi_failure
1517 return
1518 end if
1519
1520 call get_mem_rank(var_name, mem_path, c_var_rank)
1521 if (c_var_rank == -1) then
1522 bmi_status = bmi_failure
1523 return
1524 end if
1525
Here is the call graph for this function:

◆ get_var_shape()

integer(kind=c_int) function mf6bmi::get_var_shape ( character(kind=c_char), dimension(*), intent(in) c_var_address,
integer(c_int), dimension(*), intent(inout) c_var_shape )

The shape is an integer array with size equal to the rank of the variable (see get_var_rank()) and values that give the length of the array in each dimension. The target shape array c_var_shape should be allocated before calling this routine.

Note that the returned shape representation will has been converted to C-style.

Parameters
[in]c_var_addressmemory address string of the variable
[in,out]c_var_shape1D array with the variable's shape
Returns
BMI status code

Definition at line 1538 of file mf6bmi.f90.

1540 !DIR$ ATTRIBUTES DLLEXPORT :: get_var_shape
1541 ! -- modules
1542 use constantsmodule, only: maxmemrank
1543 ! -- dummy variables
1544 character(kind=c_char), intent(in) :: c_var_address(*) !< memory address string of the variable
1545 integer(c_int), intent(inout) :: c_var_shape(*) !< 1D array with the variable's shape
1546 integer(kind=c_int) :: bmi_status !< BMI status code
1547 ! -- local variables
1548 integer(I4B), dimension(MAXMEMRANK) :: var_shape
1549 integer(I4B) :: var_rank
1550 character(len=LENMEMPATH) :: mem_path
1551 character(len=LENVARNAME) :: var_name
1552 logical(LGP) :: valid
1553
1554 bmi_status = bmi_success
1555
1556 call split_address(c_var_address, mem_path, var_name, valid)
1557 if (.not. valid) then
1558 bmi_status = bmi_failure
1559 return
1560 end if
1561
1562 var_shape = 0
1563 var_rank = 0
1564 call get_mem_rank(var_name, mem_path, var_rank)
1565 call get_mem_shape(var_name, mem_path, var_shape)
1566 if (var_shape(1) == -1 .or. var_rank == -1) then
1567 bmi_status = bmi_failure
1568 return
1569 end if
1570
1571 ! External calls to this BMI are assumed C style, so if the internal shape
1572 ! is (100,1) we get (100,1,undef) from the call get_mem_shape
1573 ! This we need to convert to C-style which should be (1,100).
1574 ! Hence, we reverse the array and drop undef:
1575 c_var_shape(1:var_rank) = var_shape(var_rank:1:-1)
1576
integer(i4b), parameter, public maxmemrank
maximum memory manager length (up to 3-dimensional arrays)
Definition Constants.f90:61
Here is the call graph for this function:

◆ get_var_type()

integer(kind=c_int) function mf6bmi::get_var_type ( character(kind=c_char), dimension(*), intent(in) c_var_address,
character(kind=c_char), dimension(bmi_lenvartype), intent(out) c_var_type )

The type returned is that of a single element. When the variable cannot be found, the string

Parameters
[in]c_var_addressmemory address string of the variable
[out]c_var_typevariable type as a string
Returns
BMI status code

Definition at line 1403 of file mf6bmi.f90.

1405 !DIR$ ATTRIBUTES DLLEXPORT :: get_var_type
1406 ! -- modules
1407 use constantsmodule, only: lenmemtype
1408 ! -- dummy variables
1409 character(kind=c_char), intent(in) :: c_var_address(*) !< memory address string of the variable
1410 character(kind=c_char), intent(out) :: c_var_type(BMI_LENVARTYPE) !< variable type as a string
1411 integer(kind=c_int) :: bmi_status !< BMI status code
1412 ! -- local variables
1413 character(len=LENMEMPATH) :: mem_path
1414 character(len=LENVARNAME) :: var_name
1415 character(len=LENMEMTYPE) :: mem_type
1416 logical(LGP) :: valid
1417
1418 bmi_status = bmi_success
1419
1420 call split_address(c_var_address, mem_path, var_name, valid)
1421 if (.not. valid) then
1422 bmi_status = bmi_failure
1423 return
1424 end if
1425
1426 call get_mem_type(var_name, mem_path, mem_type)
1427 c_var_type(1:len(trim(mem_type)) + 1) = &
1428 string_to_char_array(trim(mem_type), len(trim(mem_type)))
1429
1430 if (mem_type == 'UNKNOWN') then
1431 write (bmi_last_error, fmt_general_err) 'unknown memory type'
1432 call report_bmi_error(bmi_last_error)
1433 bmi_status = bmi_failure
1434 end if
1435
Here is the call graph for this function:

◆ get_var_units()

integer(kind=c_int) function mf6bmi::get_var_units ( character(kind=c_char), dimension(*), intent(in) c_var_address,
character(kind=c_char), dimension(bmi_lenunits), intent(out) c_var_units )

The memory manager does not store units, so 'unknown' is returned for every variable.

Parameters
[in]c_var_addressmemory address string of the variable
[out]c_var_unitsvariable units as a string
Returns
BMI status code

Definition at line 1443 of file mf6bmi.f90.

1445 !DIR$ ATTRIBUTES DLLEXPORT :: get_var_units
1446 ! -- dummy variables
1447 character(kind=c_char), intent(in) :: c_var_address(*) !< memory address string of the variable
1448 character(kind=c_char), intent(out) :: c_var_units(BMI_LENUNITS) !< variable units as a string
1449 integer(kind=c_int) :: bmi_status !< BMI status code
1450 ! -- local variables
1451 character(len=LENMEMPATH) :: mem_path
1452 character(len=LENVARNAME) :: var_name
1453 character(len=*), parameter :: var_units = 'unknown'
1454 logical(LGP) :: valid
1455
1456 bmi_status = bmi_failure
1457
1458 call split_address(c_var_address, mem_path, var_name, valid)
1459 if (.not. valid) return
1460
1461 c_var_units(1:len(var_units) + 1) = &
1462 string_to_char_array(var_units, len(var_units))
1463 bmi_status = bmi_success
1464
Here is the call graph for this function:

◆ set_value()

integer(kind=c_int) function mf6bmi::set_value ( character(kind=c_char), dimension(*), intent(in) c_var_address,
type(c_ptr), intent(inout) c_arr_ptr )

The array pointed to by c_arr_ptr can have rank equal to 0, 1, or 2 and should have a C-style layout, which is particularly important for rank > 1.

Parameters
[in]c_var_addressmemory address string of the variable
[in,out]c_arr_ptrpointer to the array
Returns
BMI status code

Definition at line 983 of file mf6bmi.f90.

985 !DIR$ ATTRIBUTES DLLEXPORT :: set_value
986 ! -- modules
987 use constantsmodule, only: lenmemtype
988 ! -- dummy variables
989 character(kind=c_char), intent(in) :: c_var_address(*) !< memory address string of the variable
990 type(c_ptr), intent(inout) :: c_arr_ptr !< pointer to the array
991 integer(kind=c_int) :: bmi_status !< BMI status code
992 ! -- local variables
993 character(len=LENMEMPATH) :: mem_path
994 character(len=LENMEMTYPE) :: mem_type
995 character(len=LENVARNAME) :: var_name
996 logical(LGP) :: valid
997
998 bmi_status = bmi_success
999
1000 call split_address(c_var_address, mem_path, var_name, valid)
1001 if (.not. valid) then
1002 bmi_status = bmi_failure
1003 return
1004 end if
1005
1006 call get_mem_type(var_name, mem_path, mem_type)
1007
1008 if (index(mem_type, "DOUBLE") /= 0) then
1009 bmi_status = set_value_double(c_var_address, c_arr_ptr)
1010 else if (index(mem_type, "INTEGER") /= 0) then
1011 bmi_status = set_value_int(c_var_address, c_arr_ptr)
1012 else if (index(mem_type, "LOGICAL") /= 0) then
1013 bmi_status = set_value_bool(c_var_address, c_arr_ptr)
1014 else
1015 write (bmi_last_error, fmt_unsupported_type) trim(var_name)
1016 call report_bmi_error(bmi_last_error)
1017 bmi_status = bmi_failure
1018 return
1019 end if
1020
Here is the call graph for this function:

◆ set_value_at_indices()

integer(kind=c_int) function mf6bmi::set_value_at_indices ( character(kind=c_char), dimension(*), intent(in) c_var_address,
integer(kind=c_int), dimension(*), intent(in) c_inds,
integer(kind=c_int), intent(in) count,
type(c_ptr), intent(in) c_arr_ptr )

The indices are zero-based positions in the variable's values in C-style (row-major) order of the shape returned by get_var_shape(), as in get_value_at_indices(). The array pointed to by c_arr_ptr holds count values. Double precision and integer variables are supported. A new hydraulic conductivity does not change the saturated conductance until NPF recalculates it, as it does for TVK.

Parameters
[in]c_var_addressmemory address string of the variable
[in]c_indszero-based indices of the values
[in]countnumber of indices
[in]c_arr_ptrpointer to the array with the new values
Returns
BMI status code

Definition at line 1296 of file mf6bmi.f90.

1298 !DIR$ ATTRIBUTES DLLEXPORT :: set_value_at_indices
1299 ! -- modules
1300 use constantsmodule, only: lenmemtype
1302 ! -- dummy variables
1303 character(kind=c_char), intent(in) :: c_var_address(*) !< memory address string of the variable
1304 integer(kind=c_int), intent(in) :: c_inds(*) !< zero-based indices of the values
1305 integer(kind=c_int), intent(in) :: count !< number of indices
1306 type(c_ptr), intent(in) :: c_arr_ptr !< pointer to the array with the new values
1307 integer(kind=c_int) :: bmi_status !< BMI status code
1308 ! -- local variables
1309 character(len=LENMEMPATH) :: mem_path
1310 character(len=LENMEMTYPE) :: mem_type
1311 character(len=LENVARNAME) :: var_name
1312 logical(LGP) :: valid
1313 integer(I4B) :: i, nvalues, status
1314 type(c_ptr) :: var_ptr
1315 real(DP), dimension(:), pointer, contiguous :: src_dbl, tgt_dbl
1316 integer(I4B), dimension(:), pointer, contiguous :: src_int, tgt_int
1317
1318 bmi_status = bmi_failure
1319
1320 call split_address(c_var_address, mem_path, var_name, valid)
1321 if (.not. valid) return
1322 if (.not. valid_indices(mem_path, var_name, c_inds, count, nvalues)) return
1323
1324 ! -- the variable's storage, viewed as a flat array in memory order
1325 call get_mem_type(var_name, mem_path, mem_type)
1326 if (index(mem_type, "DOUBLE") /= 0) then
1327 if (get_value_ptr_double(c_var_address, var_ptr) /= bmi_success) return
1328 call c_f_pointer(var_ptr, tgt_dbl, [nvalues])
1329 call c_f_pointer(c_arr_ptr, src_dbl, [count])
1330 do i = 1, count
1331 tgt_dbl(c_inds(i) + 1) = src_dbl(i)
1332 end do
1333 else if (index(mem_type, "INTEGER") /= 0) then
1334 if (get_value_ptr_int(c_var_address, var_ptr) /= bmi_success) return
1335 call c_f_pointer(var_ptr, tgt_int, [nvalues])
1336 call c_f_pointer(c_arr_ptr, src_int, [count])
1337 do i = 1, count
1338 tgt_int(c_inds(i) + 1) = src_int(i)
1339 end do
1340 else
1341 write (bmi_last_error, fmt_unsupported_type) trim(var_name)
1342 call report_bmi_error(bmi_last_error)
1343 return
1344 end if
1345
1346 ! trigger event:
1347 call on_memory_set(var_name, mem_path, status)
1348 if (status /= 0) then
1349 write (bmi_last_error, fmt_invalid_mem_access) trim(var_name)
1350 call report_bmi_error(bmi_last_error)
1351 return
1352 end if
1353
1354 bmi_status = bmi_success
1355
Here is the call graph for this function:

◆ set_value_bool()

integer(kind=c_int) function mf6bmi::set_value_bool ( character(kind=c_char), dimension(*), intent(in) c_var_address,
type(c_ptr), intent(in) c_arr_ptr )

The array pointed to by c_arr_ptr must have a rank equal to 0.

Parameters
[in]c_var_addressmemory address string of the variable
[in]c_arr_ptrpointer to the logical array
Returns
BMI status code

Definition at line 1175 of file mf6bmi.f90.

1177 !DIR$ ATTRIBUTES DLLEXPORT :: set_value_bool
1178 ! -- modules
1180 ! -- dummy variables
1181 character(kind=c_char), intent(in) :: c_var_address(*) !< memory address string of the variable
1182 type(c_ptr), intent(in) :: c_arr_ptr !< pointer to the logical array
1183 integer(kind=c_int) :: bmi_status !< BMI status code
1184 ! -- local variables
1185 character(len=LENMEMPATH) :: mem_path
1186 character(len=LENVARNAME) :: var_name
1187 logical(LGP) :: valid
1188 integer(I4B) :: rank
1189 logical(LGP), pointer :: src_ptr, tgt_ptr
1190 integer(I4B) :: status
1191
1192 bmi_status = bmi_success
1193
1194 call split_address(c_var_address, mem_path, var_name, valid)
1195 if (.not. valid) then
1196 bmi_status = bmi_failure
1197 return
1198 end if
1199
1200 rank = -1
1201 call get_mem_rank(var_name, mem_path, rank)
1202
1203 ! convert pointer
1204 if (rank == 0) then
1205 call mem_setptr(tgt_ptr, var_name, mem_path)
1206 call c_f_pointer(c_arr_ptr, src_ptr)
1207 tgt_ptr = src_ptr
1208 else
1209 write (bmi_last_error, fmt_unsupported_rank) trim(var_name)
1210 call report_bmi_error(bmi_last_error)
1211 bmi_status = bmi_failure
1212 return
1213 end if
1214
1215 ! trigger event:
1216 call on_memory_set(var_name, mem_path, status)
1217 if (status /= 0) then
1218 ! something went terribly wrong here, aborting
1219 write (bmi_last_error, fmt_invalid_mem_access) trim(var_name)
1220 call report_bmi_error(bmi_last_error)
1221 bmi_status = bmi_failure
1222 return
1223 end if
1224
Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_value_double()

integer(kind=c_int) function mf6bmi::set_value_double ( character(kind=c_char), dimension(*), intent(in) c_var_address,
type(c_ptr), intent(in) c_arr_ptr )

The array pointed to by c_arr_ptr can have rank equal to 0, 1, or 2 and should have a C-style layout, which is particularly important for rank > 1.

Parameters
[in]c_var_addressmemory address string of the variable
[in]c_arr_ptrpointer to the double precision array
Returns
BMI status code

Definition at line 1029 of file mf6bmi.f90.

1031 !DIR$ ATTRIBUTES DLLEXPORT :: set_value_double
1032 ! -- modules
1034 ! -- dummy variables
1035 character(kind=c_char), intent(in) :: c_var_address(*) !< memory address string of the variable
1036 type(c_ptr), intent(in) :: c_arr_ptr !< pointer to the double precision array
1037 integer(kind=c_int) :: bmi_status !< BMI status code
1038 ! -- local variables
1039 character(len=LENMEMPATH) :: mem_path
1040 character(len=LENVARNAME) :: var_name
1041 logical(LGP) :: valid
1042 integer(I4B) :: rank
1043 real(DP), pointer :: src_ptr, tgt_ptr
1044 real(DP), dimension(:), pointer, contiguous :: src1D_ptr, tgt1D_ptr
1045 real(DP), dimension(:, :), pointer, contiguous :: src2D_ptr, tgt2D_ptr
1046 integer(I4B) :: i, j
1047 integer(I4B) :: status
1048
1049 bmi_status = bmi_success
1050
1051 call split_address(c_var_address, mem_path, var_name, valid)
1052 if (.not. valid) then
1053 bmi_status = bmi_failure
1054 return
1055 end if
1056
1057 ! convert pointer and copy, using loops to avoid stack overflow
1058 rank = -1
1059 call get_mem_rank(var_name, mem_path, rank)
1060
1061 if (rank == 0) then
1062 call mem_setptr(tgt_ptr, var_name, mem_path)
1063 call c_f_pointer(c_arr_ptr, src_ptr)
1064 tgt_ptr = src_ptr
1065 else if (rank == 1) then
1066 call mem_setptr(tgt1d_ptr, var_name, mem_path)
1067 call c_f_pointer(c_arr_ptr, src1d_ptr, shape(tgt1d_ptr))
1068 do i = 1, size(tgt1d_ptr)
1069 tgt1d_ptr(i) = src1d_ptr(i)
1070 end do
1071 else if (rank == 2) then
1072 call mem_setptr(tgt2d_ptr, var_name, mem_path)
1073 call c_f_pointer(c_arr_ptr, src2d_ptr, shape(tgt2d_ptr))
1074 do j = 1, size(tgt2d_ptr, 2)
1075 do i = 1, size(tgt2d_ptr, 1)
1076 tgt2d_ptr(i, j) = src2d_ptr(i, j)
1077 end do
1078 end do
1079 else
1080 write (bmi_last_error, fmt_unsupported_rank) trim(var_name)
1081 call report_bmi_error(bmi_last_error)
1082 bmi_status = bmi_failure
1083 return
1084 end if
1085
1086 ! trigger event:
1087 call on_memory_set(var_name, mem_path, status)
1088 if (status /= 0) then
1089 ! something went terribly wrong here, aborting
1090 write (bmi_last_error, fmt_invalid_mem_access) trim(var_name)
1091 call report_bmi_error(bmi_last_error)
1092 bmi_status = bmi_failure
1093 return
1094 end if
1095
Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_value_int()

integer(kind=c_int) function mf6bmi::set_value_int ( character(kind=c_char), dimension(*), intent(in) c_var_address,
type(c_ptr), intent(in) c_arr_ptr )

The array pointed to by c_arr_ptr can have rank equal to 0, 1, or 2.

Parameters
[in]c_var_addressmemory address string of the variable
[in]c_arr_ptrpointer to the integer array
Returns
BMI status code

Definition at line 1102 of file mf6bmi.f90.

1104 !DIR$ ATTRIBUTES DLLEXPORT :: set_value_int
1105 ! -- modules
1107 ! -- dummy variables
1108 character(kind=c_char), intent(in) :: c_var_address(*) !< memory address string of the variable
1109 type(c_ptr), intent(in) :: c_arr_ptr !< pointer to the integer array
1110 integer(kind=c_int) :: bmi_status !< BMI status code
1111 ! -- local variables
1112 character(len=LENMEMPATH) :: mem_path
1113 character(len=LENVARNAME) :: var_name
1114 logical(LGP) :: valid
1115 integer(I4B) :: rank
1116 integer(I4B), pointer :: src_ptr, tgt_ptr
1117 integer(I4B), dimension(:), pointer, contiguous :: src1D_ptr, tgt1D_ptr
1118 integer(I4B), dimension(:, :), pointer, contiguous :: src2D_ptr, tgt2D_ptr
1119 integer(I4B) :: i, j
1120 integer(I4B) :: status
1121
1122 bmi_status = bmi_success
1123
1124 call split_address(c_var_address, mem_path, var_name, valid)
1125 if (.not. valid) then
1126 bmi_status = bmi_failure
1127 return
1128 end if
1129
1130 ! convert pointer and copy, using loops to avoid stack overflow
1131 rank = -1
1132 call get_mem_rank(var_name, mem_path, rank)
1133
1134 if (rank == 0) then
1135 call mem_setptr(tgt_ptr, var_name, mem_path)
1136 call c_f_pointer(c_arr_ptr, src_ptr)
1137 tgt_ptr = src_ptr
1138 else if (rank == 1) then
1139 call mem_setptr(tgt1d_ptr, var_name, mem_path)
1140 call c_f_pointer(c_arr_ptr, src1d_ptr, shape(tgt1d_ptr))
1141 do i = 1, size(tgt1d_ptr)
1142 tgt1d_ptr(i) = src1d_ptr(i)
1143 end do
1144 else if (rank == 2) then
1145 call mem_setptr(tgt2d_ptr, var_name, mem_path)
1146 call c_f_pointer(c_arr_ptr, src2d_ptr, shape(tgt2d_ptr))
1147 do j = 1, size(tgt2d_ptr, 2)
1148 do i = 1, size(tgt2d_ptr, 1)
1149 tgt2d_ptr(i, j) = src2d_ptr(i, j)
1150 end do
1151 end do
1152 else
1153 write (bmi_last_error, fmt_unsupported_rank) trim(var_name)
1154 call report_bmi_error(bmi_last_error)
1155 bmi_status = bmi_failure
1156 return
1157 end if
1158
1159 ! trigger event:
1160 call on_memory_set(var_name, mem_path, status)
1161 if (status /= 0) then
1162 ! something went terribly wrong here, aborting
1163 write (bmi_last_error, fmt_invalid_mem_access) trim(var_name)
1164 call report_bmi_error(bmi_last_error)
1165 bmi_status = bmi_failure
1166 return
1167 end if
1168
Here is the call graph for this function:
Here is the caller graph for this function:

◆ valid_indices()

logical(lgp) function mf6bmi::valid_indices ( character(len=*), intent(in) mem_path,
character(len=*), intent(in) var_name,
integer(kind=c_int), dimension(*), intent(in) c_inds,
integer(kind=c_int), intent(in) count,
integer(i4b), intent(out) nvalues )
Parameters
[in]mem_pathmemory path of the variable
[in]var_namename of the variable
[in]c_indszero-based indices
[in]countnumber of indices
[out]nvaluesnumber of values in the variable
Returns
true when all indices are valid

Definition at line 1360 of file mf6bmi.f90.

1362 ! -- dummy variables
1363 character(len=*), intent(in) :: mem_path !< memory path of the variable
1364 character(len=*), intent(in) :: var_name !< name of the variable
1365 integer(kind=c_int), intent(in) :: c_inds(*) !< zero-based indices
1366 integer(kind=c_int), intent(in) :: count !< number of indices
1367 integer(I4B), intent(out) :: nvalues !< number of values in the variable
1368 logical(LGP) :: valid !< true when all indices are valid
1369 ! -- local variables
1370 integer(I4B) :: i, rank
1371
1372 valid = .false.
1373 if (count < 0) then
1374 write (bmi_last_error, fmt_invalid_count) count, trim(var_name)
1375 call report_bmi_error(bmi_last_error)
1376 return
1377 end if
1378 rank = -1
1379 call get_mem_rank(var_name, mem_path, rank)
1380 if (rank < 0 .or. rank > 3) then
1381 write (bmi_last_error, fmt_unsupported_rank) trim(var_name)
1382 call report_bmi_error(bmi_last_error)
1383 return
1384 end if
1385
1386 call get_isize(var_name, mem_path, nvalues)
1387 do i = 1, count
1388 if (c_inds(i) < 0 .or. c_inds(i) >= nvalues) then
1389 write (bmi_last_error, fmt_invalid_index) c_inds(i), trim(var_name)
1390 call report_bmi_error(bmi_last_error)
1391 return
1392 end if
1393 end do
1394 valid = .true.
1395
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ istdout_to_file

integer(c_int), bind(C, name="ISTDOUTTOFILE") mf6bmi::istdout_to_file = 1

Definition at line 38 of file mf6bmi.f90.