MODFLOW 6  version 6.7.0.dev3
USGS Modular Hydrologic Model
virtualdatacontainermodule Module Reference

Data Types

type  vdcptrtype
 Wrapper for virtual data containers. More...
 
type  vdcelementmaptype
 
type  vdcelementluttype
 
type  virtualdatacontainertype
 Container (list) of virtual data items. More...
 

Functions/Subroutines

subroutine vdc_create (this, name, id, is_local)
 
subroutine set (this, field, var_name, subcmp_name, map_id, is_local)
 Init virtual data item, without allocation,. More...
 
subroutine add_to_list (this, virtual_data)
 
subroutine vdc_prepare_stage (this, stage)
 
subroutine vdc_link_items (this, stage)
 Link all local data items to memory. More...
 
subroutine vdc_set_element_map (this, src_indexes, map_id)
 Add the source indexes associated with map_id as a element map to this container, such that. More...
 
subroutine map_scalar (this, vd, stages)
 
subroutine map_array1d (this, vd, nrow, stages)
 
subroutine map_array2d (this, vd, ncol, nrow, stages)
 
subroutine map_internal (this, vd, shape, stages)
 
subroutine vdc_get_send_items (this, stg, rank, vi)
 Get indexes of virtual data items to be. More...
 
subroutine vdc_get_recv_items (this, stg, rank, vi)
 Get indexes of virtual data items to be. More...
 
subroutine get_items_for_stage (this, stage, virtual_items)
 
subroutine print_items (this, imon, items)
 
character(len=lenmempath) function vdc_get_vrt_mem_path (this, var_name, subcomp_name)
 Get virtual memory path for a certain variable. More...
 
class(virtualdatatype) function, pointer vdc_get_virtual_data (this, var_name, subcomp_name)
 
subroutine vdc_destroy (this)
 
subroutine vdc_set_orig_rank (this, rank)
 
class(virtualdatacontainertype) function, pointer, public get_vdc_from_list (list, idx)
 
character(len=24) function, public vdc_type_to_str (cntr_type)
 @ Converts a virtual container type to its string representation More...
 

Variables

integer(i4b), parameter, public vdc_unknown_type = 0
 
integer(i4b), parameter, public vdc_gwfmodel_type = 1
 
integer(i4b), parameter, public vdc_gwtmodel_type = 2
 
integer(i4b), parameter, public vdc_gwemodel_type = 3
 
integer(i4b), parameter, public vdc_gwfexg_type = 4
 
integer(i4b), parameter, public vdc_gwtexg_type = 5
 
integer(i4b), parameter, public vdc_gweexg_type = 6
 
integer(i4b), parameter, public vdc_gwfmvr_type = 7
 
integer(i4b), parameter, public vdc_gwtmvt_type = 8
 
integer(i4b), parameter, public vdc_gwemve_type = 9
 of VdcPtrType instead. More...
 

Function/Subroutine Documentation

◆ add_to_list()

subroutine virtualdatacontainermodule::add_to_list ( class(virtualdatacontainertype this,
class(virtualdatatype), pointer  virtual_data 
)
private

Definition at line 154 of file VirtualDataContainer.f90.

155  class(VirtualDataContainerType) :: this
156  class(VirtualDataType), pointer :: virtual_data
157  ! local
158  class(*), pointer :: vdata_ptr
159 
160  vdata_ptr => virtual_data
161  call this%virtual_data_list%Add(vdata_ptr)
162 

◆ get_items_for_stage()

subroutine virtualdatacontainermodule::get_items_for_stage ( class(virtualdatacontainertype this,
integer(i4b)  stage,
type(stlvecint virtual_items 
)
private

Definition at line 306 of file VirtualDataContainer.f90.

307  class(VirtualDataContainerType) :: this
308  integer(I4B) :: stage
309  type(STLVecInt) :: virtual_items
310  ! local
311  integer(I4B) :: i
312  class(*), pointer :: obj_ptr
313 
314  do i = 1, this%virtual_data_list%Count()
315  obj_ptr => this%virtual_data_list%GetItem(i)
316  select type (obj_ptr)
317  class is (virtualdatatype)
318  if (.not. obj_ptr%check_stage(stage)) cycle
319  call virtual_items%push_back(i)
320  end select
321  end do
322 

◆ get_vdc_from_list()

class(virtualdatacontainertype) function, pointer, public virtualdatacontainermodule::get_vdc_from_list ( type(listtype list,
integer(i4b)  idx 
)

Definition at line 438 of file VirtualDataContainer.f90.

439  type(ListType) :: list
440  integer(I4B) :: idx
441  class(VirtualDataContainerType), pointer :: vdc
442  ! local
443  class(*), pointer :: obj_ptr
444 
445  vdc => null()
446  obj_ptr => list%GetItem(idx)
447  select type (obj_ptr)
448  class is (virtualdatacontainertype)
449  vdc => obj_ptr
450  end select
451 
Here is the caller graph for this function:

◆ map_array1d()

subroutine virtualdatacontainermodule::map_array1d ( class(virtualdatacontainertype this,
class(virtualdatatype), pointer  vd,
integer(i4b)  nrow,
integer(i4b), dimension(:)  stages 
)
private

Definition at line 238 of file VirtualDataContainer.f90.

239  class(VirtualDataContainerType) :: this
240  class(VirtualDataType), pointer :: vd
241  integer(I4B) :: nrow
242  integer(I4B), dimension(:) :: stages
243 
244  call this%map_internal(vd, (/nrow/), stages)
245 
Here is the caller graph for this function:

◆ map_array2d()

subroutine virtualdatacontainermodule::map_array2d ( class(virtualdatacontainertype this,
class(virtualdatatype), pointer  vd,
integer(i4b)  ncol,
integer(i4b)  nrow,
integer(i4b), dimension(:)  stages 
)
private

Definition at line 248 of file VirtualDataContainer.f90.

249  class(VirtualDataContainerType) :: this
250  class(VirtualDataType), pointer :: vd
251  integer(I4B) :: ncol
252  integer(I4B) :: nrow
253  integer(I4B), dimension(:) :: stages
254 
255  call this%map_internal(vd, (/ncol, nrow/), stages)
256 
Here is the caller graph for this function:

◆ map_internal()

subroutine virtualdatacontainermodule::map_internal ( class(virtualdatacontainertype this,
class(virtualdatatype), pointer  vd,
integer(i4b), dimension(:)  shape,
integer(i4b), dimension(:)  stages 
)
private

Definition at line 259 of file VirtualDataContainer.f90.

260  class(VirtualDataContainerType) :: this
261  class(VirtualDataType), pointer :: vd
262  integer(I4B), dimension(:) :: shape
263  integer(I4B), dimension(:) :: stages
264  ! local
265  character(len=LENMEMPATH) :: vm_pth
266  logical(LGP) :: found
267 
268  vd%sync_stages = stages
269  if (vd%is_remote) then
270  ! create new virtual memory item
271  vm_pth = this%get_vrt_mem_path(vd%var_name, vd%subcmp_name)
272  call vd%vm_allocate(vd%var_name, vm_pth, shape)
273  call get_from_memorystore(vd%var_name, vm_pth, vd%virtual_mt, found)
274  if (vd%map_type > 0) then
275  vd%remote_to_virtual => this%element_luts(vd%map_type)%remote_to_virtual
276  vd%remote_elem_shift => this%element_maps(vd%map_type)%remote_elem_shift
277  end if
278  end if
279 
Here is the call graph for this function:

◆ map_scalar()

subroutine virtualdatacontainermodule::map_scalar ( class(virtualdatacontainertype this,
class(virtualdatatype), pointer  vd,
integer(i4b), dimension(:)  stages 
)
private

Definition at line 229 of file VirtualDataContainer.f90.

230  class(VirtualDataContainerType) :: this
231  class(VirtualDataType), pointer :: vd
232  integer(I4B), dimension(:) :: stages
233 
234  call this%map_internal(vd, (/0/), stages)
235 
Here is the caller graph for this function:

◆ print_items()

subroutine virtualdatacontainermodule::print_items ( class(virtualdatacontainertype this,
integer(i4b)  imon,
type(stlvecint items 
)
private

Definition at line 325 of file VirtualDataContainer.f90.

326  class(VirtualDataContainerType) :: this
327  integer(I4B) :: imon
328  type(STLVecInt) :: items
329  ! local
330  integer(I4B) :: i
331  class(VirtualDataType), pointer :: vdi
332 
333  write (imon, *) "=====> items"
334  do i = 1, items%size
335  vdi => get_virtual_data_from_list(this%virtual_data_list, items%at(i))
336  write (imon, *) vdi%var_name, ":", vdi%mem_path
337  end do
338  if (items%size == 0) then
339  write (imon, *) "... empty ...", this%name
340  end if
341  write (imon, *) "<===== items"
342 
Here is the call graph for this function:

◆ set()

subroutine virtualdatacontainermodule::set ( class(virtualdatacontainertype this,
class(virtualdatatype), pointer  field,
character(len=*)  var_name,
character(len=*)  subcmp_name,
integer(i4b)  map_id,
logical(lgp), optional  is_local 
)
private

Definition at line 128 of file VirtualDataContainer.f90.

129  class(VirtualDataContainerType) :: this
130  class(VirtualDataType), pointer :: field
131  character(len=*) :: var_name
132  character(len=*) :: subcmp_name
133  integer(I4B) :: map_id
134  logical(LGP), optional :: is_local
135 
136  field%is_remote = .not. this%is_local
137  field%map_type = map_id
138  if (present(is_local)) field%is_remote = .not. is_local
139  field%var_name = var_name
140  field%subcmp_name = subcmp_name
141  if (subcmp_name == '') then
142  field%mem_path = create_mem_path(this%name)
143  else
144  field%mem_path = create_mem_path(this%name, subcmp_name)
145  end if
146  field%is_reduced = (field%is_remote .and. field%map_type > 0)
147  field%remote_elem_shift => null()
148  field%remote_to_virtual => null()
149  field%virtual_mt => null()
150  call this%add_to_list(field)
151 
Here is the call graph for this function:

◆ vdc_create()

subroutine virtualdatacontainermodule::vdc_create ( class(virtualdatacontainertype this,
character(len=*)  name,
integer(i4b)  id,
logical(lgp)  is_local 
)

Definition at line 97 of file VirtualDataContainer.f90.

98  class(VirtualDataContainerType) :: this
99  character(len=*) :: name
100  integer(I4B) :: id
101  logical(LGP) :: is_local
102  ! local
103  integer(I4B) :: i
104 
105  this%name = name
106  this%id = id
107  this%is_local = is_local
108  this%vmem_ctx = 'undefined'
109  this%orig_rank = 0
110  this%is_active = .true.
111  this%container_type = vdc_unknown_type
112 
113  do i = 1, size(this%element_maps)
114  this%element_maps(i)%nr_virt_elems = 0
115  this%element_maps(i)%remote_elem_shift => null()
116  end do
117  do i = 1, size(this%element_luts)
118  this%element_luts(i)%max_remote_idx = 0
119  this%element_luts(i)%remote_to_virtual => null()
120  end do
121 
122  call this%rcv_ranks%init()
123 

◆ vdc_destroy()

subroutine virtualdatacontainermodule::vdc_destroy ( class(virtualdatacontainertype this)

Definition at line 397 of file VirtualDataContainer.f90.

398  class(VirtualDataContainerType) :: this
399  ! local
400  integer(I4B) :: i
401  class(*), pointer :: obj
402 
403  call this%rcv_ranks%destroy()
404 
405  do i = 1, size(this%element_maps)
406  if (associated(this%element_maps(i)%remote_elem_shift)) then
407  deallocate (this%element_maps(i)%remote_elem_shift)
408  end if
409  end do
410  do i = 1, size(this%element_luts)
411  if (associated(this%element_luts(i)%remote_to_virtual)) then
412  deallocate (this%element_luts(i)%remote_to_virtual)
413  end if
414  end do
415 
416  do i = 1, this%virtual_data_list%Count()
417  obj => this%virtual_data_list%GetItem(i)
418  select type (obj)
419  class is (virtualdatatype)
420  if (associated(obj%virtual_mt)) then
421  call obj%vm_deallocate()
422  end if
423  end select
424  end do
425  call this%virtual_data_list%Clear()
426 

◆ vdc_get_recv_items()

subroutine virtualdatacontainermodule::vdc_get_recv_items ( class(virtualdatacontainertype this,
integer(i4b)  stg,
integer(i4b)  rank,
type(stlvecint vi 
)
private

Definition at line 296 of file VirtualDataContainer.f90.

297  class(VirtualDataContainerType) :: this
298  integer(I4B) :: stg
299  integer(I4B) :: rank
300  type(STLVecInt) :: vi
301 
302  call this%get_items_for_stage(stg, vi)
303 

◆ vdc_get_send_items()

subroutine virtualdatacontainermodule::vdc_get_send_items ( class(virtualdatacontainertype this,
integer(i4b)  stg,
integer(i4b)  rank,
type(stlvecint vi 
)
private

Definition at line 284 of file VirtualDataContainer.f90.

285  class(VirtualDataContainerType) :: this
286  integer(I4B) :: stg
287  integer(I4B) :: rank
288  type(STLVecInt) :: vi
289 
290  call this%get_items_for_stage(stg, vi)
291 

◆ vdc_get_virtual_data()

class(virtualdatatype) function, pointer virtualdatacontainermodule::vdc_get_virtual_data ( class(virtualdatacontainertype this,
character(len=*)  var_name,
character(len=*)  subcomp_name 
)
private

Definition at line 372 of file VirtualDataContainer.f90.

373  use simmodule, only: ustop
374  class(VirtualDataContainerType) :: this
375  character(len=*) :: var_name
376  character(len=*) :: subcomp_name
377  class(VirtualDataType), pointer :: virtual_data
378  ! local
379  integer(I4B) :: i
380  class(VirtualDataType), pointer :: vd
381 
382  virtual_data => null()
383  do i = 1, this%virtual_data_list%Count()
384  vd => get_virtual_data_from_list(this%virtual_data_list, i)
385  if (vd%var_name == var_name .and. &
386  vd%subcmp_name == subcomp_name) then
387  virtual_data => vd
388  return
389  end if
390  end do
391 
392  write (*, *) 'Error: unknown virtual variable ', var_name, ' ', subcomp_name
393  call ustop()
394 
This module contains simulation methods.
Definition: Sim.f90:10
subroutine, public ustop(stopmess, ioutlocal)
Stop the simulation.
Definition: Sim.f90:312
Here is the call graph for this function:

◆ vdc_get_vrt_mem_path()

character(len=lenmempath) function virtualdatacontainermodule::vdc_get_vrt_mem_path ( class(virtualdatacontainertype this,
character(len=*)  var_name,
character(len=*)  subcomp_name 
)
private

Definition at line 347 of file VirtualDataContainer.f90.

348  class(VirtualDataContainerType) :: this
349  character(len=*) :: var_name
350  character(len=*) :: subcomp_name
351  character(len=LENMEMPATH) :: vrt_path
352  ! local
353  class(VirtualDataType), pointer :: vdi
354 
355  vdi => this%vdc_get_virtual_data(var_name, subcomp_name)
356  if (vdi%is_remote) then
357  if (subcomp_name == '') then
358  vrt_path = create_mem_path(this%name, context=this%vmem_ctx)
359  else
360  vrt_path = create_mem_path(this%name, subcomp_name, context=this%vmem_ctx)
361  end if
362  else
363  if (subcomp_name == '') then
364  vrt_path = create_mem_path(this%name)
365  else
366  vrt_path = create_mem_path(this%name, subcomp_name)
367  end if
368  end if
369 
Here is the call graph for this function:

◆ vdc_link_items()

subroutine virtualdatacontainermodule::vdc_link_items ( class(virtualdatacontainertype this,
integer(i4b)  stage 
)

Definition at line 177 of file VirtualDataContainer.f90.

178  class(VirtualDataContainerType) :: this
179  integer(I4B) :: stage
180  ! local
181  integer(I4B) :: i
182  class(*), pointer :: vdi
183 
184  do i = 1, this%virtual_data_list%Count()
185  vdi => this%virtual_data_list%GetItem(i)
186  select type (vdi)
187  class is (virtualdatatype)
188  if (vdi%is_remote) cycle
189  if (vdi%check_stage(stage)) call vdi%link()
190  end select
191  end do
192 

◆ vdc_prepare_stage()

subroutine virtualdatacontainermodule::vdc_prepare_stage ( class(virtualdatacontainertype this,
integer(i4b)  stage 
)
private

Definition at line 165 of file VirtualDataContainer.f90.

166  use simmodule, only: ustop
167  class(VirtualDataContainerType) :: this
168  integer(I4B) :: stage
169 
170  write (*, *) 'Error: prepare_stage should be overridden'
171  call ustop()
172 
Here is the call graph for this function:

◆ vdc_set_element_map()

subroutine virtualdatacontainermodule::vdc_set_element_map ( class(virtualdatacontainertype this,
integer(i4b), dimension(:), pointer, contiguous  src_indexes,
integer(i4b)  map_id 
)
private

Definition at line 198 of file VirtualDataContainer.f90.

199  class(VirtualDataContainerType) :: this
200  integer(I4B), dimension(:), pointer, contiguous :: src_indexes
201  integer(I4B) :: map_id
202  ! local
203  integer(I4B) :: i, idx_remote, max_remote_idx
204 
205  if (this%element_maps(map_id)%nr_virt_elems > 0) then
206  write (*, *) "Error, VDC element map already set"
207  call ustop()
208  end if
209 
210  this%element_maps(map_id)%nr_virt_elems = size(src_indexes)
211  allocate (this%element_maps(map_id)%remote_elem_shift(size(src_indexes)))
212  do i = 1, size(src_indexes)
213  this%element_maps(map_id)%remote_elem_shift(i) = src_indexes(i) - 1
214  end do
215 
216  max_remote_idx = maxval(src_indexes)
217  this%element_luts(map_id)%max_remote_idx = max_remote_idx
218  allocate (this%element_luts(map_id)%remote_to_virtual(max_remote_idx))
219  do i = 1, max_remote_idx
220  this%element_luts(map_id)%remote_to_virtual(i) = -1
221  end do
222  do i = 1, size(src_indexes)
223  idx_remote = src_indexes(i)
224  this%element_luts(map_id)%remote_to_virtual(idx_remote) = i
225  end do
226 
Here is the call graph for this function:

◆ vdc_set_orig_rank()

subroutine virtualdatacontainermodule::vdc_set_orig_rank ( class(virtualdatacontainertype this,
integer(i4b)  rank 
)
private

Definition at line 429 of file VirtualDataContainer.f90.

430  class(VirtualDataContainerType) :: this
431  integer(I4B) :: rank
432 
433  this%orig_rank = rank
434  write (this%vmem_ctx, '(a,i0,a)') '__P', rank, '__'
435 

◆ vdc_type_to_str()

character(len=24) function, public virtualdatacontainermodule::vdc_type_to_str ( integer(i4b)  cntr_type)

Definition at line 456 of file VirtualDataContainer.f90.

457  integer(I4B) :: cntr_type
458  character(len=24) :: cntr_str
459 
460  if (cntr_type == vdc_unknown_type) then; cntr_str = "unknown"
461  else if (cntr_type == vdc_gwfmodel_type) then; cntr_str = "GWF Model"
462  else if (cntr_type == vdc_gwtmodel_type) then; cntr_str = "GWT Model"
463  else if (cntr_type == vdc_gwemodel_type) then; cntr_str = "GWE Model"
464  else if (cntr_type == vdc_gwfexg_type) then; cntr_str = "GWF Exchange"
465  else if (cntr_type == vdc_gwtexg_type) then; cntr_str = "GWT Exchange"
466  else if (cntr_type == vdc_gweexg_type) then; cntr_str = "GWE Exchange"
467  else if (cntr_type == vdc_gwfmvr_type) then; cntr_str = "GWF Mover"
468  else if (cntr_type == vdc_gwtmvt_type) then; cntr_str = "GWT Mover"
469  else if (cntr_type == vdc_gwemve_type) then; cntr_str = "GWE Mover"
470  else; cntr_str = "Undefined"
471  end if
472 
Here is the caller graph for this function:

Variable Documentation

◆ vdc_gweexg_type

integer(i4b), parameter, public virtualdatacontainermodule::vdc_gweexg_type = 6

Definition at line 22 of file VirtualDataContainer.f90.

22  integer(I4B), public, parameter :: VDC_GWEEXG_TYPE = 6

◆ vdc_gwemodel_type

integer(i4b), parameter, public virtualdatacontainermodule::vdc_gwemodel_type = 3

Definition at line 19 of file VirtualDataContainer.f90.

19  integer(I4B), public, parameter :: VDC_GWEMODEL_TYPE = 3

◆ vdc_gwemve_type

integer(i4b), parameter, public virtualdatacontainermodule::vdc_gwemve_type = 9

Definition at line 25 of file VirtualDataContainer.f90.

25  integer(I4B), public, parameter :: VDC_GWEMVE_TYPE = 9

◆ vdc_gwfexg_type

integer(i4b), parameter, public virtualdatacontainermodule::vdc_gwfexg_type = 4

Definition at line 20 of file VirtualDataContainer.f90.

20  integer(I4B), public, parameter :: VDC_GWFEXG_TYPE = 4

◆ vdc_gwfmodel_type

integer(i4b), parameter, public virtualdatacontainermodule::vdc_gwfmodel_type = 1

Definition at line 17 of file VirtualDataContainer.f90.

17  integer(I4B), public, parameter :: VDC_GWFMODEL_TYPE = 1

◆ vdc_gwfmvr_type

integer(i4b), parameter, public virtualdatacontainermodule::vdc_gwfmvr_type = 7

Definition at line 23 of file VirtualDataContainer.f90.

23  integer(I4B), public, parameter :: VDC_GWFMVR_TYPE = 7

◆ vdc_gwtexg_type

integer(i4b), parameter, public virtualdatacontainermodule::vdc_gwtexg_type = 5

Definition at line 21 of file VirtualDataContainer.f90.

21  integer(I4B), public, parameter :: VDC_GWTEXG_TYPE = 5

◆ vdc_gwtmodel_type

integer(i4b), parameter, public virtualdatacontainermodule::vdc_gwtmodel_type = 2

Definition at line 18 of file VirtualDataContainer.f90.

18  integer(I4B), public, parameter :: VDC_GWTMODEL_TYPE = 2

◆ vdc_gwtmvt_type

integer(i4b), parameter, public virtualdatacontainermodule::vdc_gwtmvt_type = 8

Definition at line 24 of file VirtualDataContainer.f90.

24  integer(I4B), public, parameter :: VDC_GWTMVT_TYPE = 8

◆ vdc_unknown_type

integer(i4b), parameter, public virtualdatacontainermodule::vdc_unknown_type = 0

Definition at line 16 of file VirtualDataContainer.f90.

16  integer(I4B), public, parameter :: VDC_UNKNOWN_TYPE = 0