MODFLOW 6  version 6.6.0.dev0
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, stage, rank, virtual_items)
 Get indexes of virtual data items to be. More...
 
subroutine vdc_get_recv_items (this, stage, rank, virtual_items)
 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 152 of file VirtualDataContainer.f90.

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

◆ get_items_for_stage()

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

Definition at line 304 of file VirtualDataContainer.f90.

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

◆ get_vdc_from_list()

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

Definition at line 436 of file VirtualDataContainer.f90.

437  type(ListType) :: list
438  integer(I4B) :: idx
439  class(VirtualDataContainerType), pointer :: vdc
440  ! local
441  class(*), pointer :: obj_ptr
442 
443  vdc => null()
444  obj_ptr => list%GetItem(idx)
445  select type (obj_ptr)
446  class is (virtualdatacontainertype)
447  vdc => obj_ptr
448  end select
449 
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 236 of file VirtualDataContainer.f90.

237  class(VirtualDataContainerType) :: this
238  class(VirtualDataType), pointer :: vd
239  integer(I4B) :: nrow
240  integer(I4B), dimension(:) :: stages
241 
242  call this%map_internal(vd, (/nrow/), stages)
243 
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 246 of file VirtualDataContainer.f90.

247  class(VirtualDataContainerType) :: this
248  class(VirtualDataType), pointer :: vd
249  integer(I4B) :: ncol
250  integer(I4B) :: nrow
251  integer(I4B), dimension(:) :: stages
252 
253  call this%map_internal(vd, (/ncol, nrow/), stages)
254 
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 257 of file VirtualDataContainer.f90.

258  class(VirtualDataContainerType) :: this
259  class(VirtualDataType), pointer :: vd
260  integer(I4B), dimension(:) :: shape
261  integer(I4B), dimension(:) :: stages
262  ! local
263  character(len=LENMEMPATH) :: vm_pth
264  logical(LGP) :: found
265 
266  vd%sync_stages = stages
267  if (vd%is_remote) then
268  ! create new virtual memory item
269  vm_pth = this%get_vrt_mem_path(vd%var_name, vd%subcmp_name)
270  call vd%vm_allocate(vd%var_name, vm_pth, shape)
271  call get_from_memorystore(vd%var_name, vm_pth, vd%virtual_mt, found)
272  if (vd%map_type > 0) then
273  vd%remote_to_virtual => this%element_luts(vd%map_type)%remote_to_virtual
274  vd%remote_elem_shift => this%element_maps(vd%map_type)%remote_elem_shift
275  end if
276  end if
277 
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 227 of file VirtualDataContainer.f90.

228  class(VirtualDataContainerType) :: this
229  class(VirtualDataType), pointer :: vd
230  integer(I4B), dimension(:) :: stages
231 
232  call this%map_internal(vd, (/0/), stages)
233 
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 323 of file VirtualDataContainer.f90.

324  class(VirtualDataContainerType) :: this
325  integer(I4B) :: imon
326  type(STLVecInt) :: items
327  ! local
328  integer(I4B) :: i
329  class(VirtualDataType), pointer :: vdi
330 
331  write (imon, *) "=====> items"
332  do i = 1, items%size
333  vdi => get_virtual_data_from_list(this%virtual_data_list, items%at(i))
334  write (imon, *) vdi%var_name, ":", vdi%mem_path
335  end do
336  if (items%size == 0) then
337  write (imon, *) "... empty ...", this%name
338  end if
339  write (imon, *) "<===== items"
340 
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 126 of file VirtualDataContainer.f90.

127  class(VirtualDataContainerType) :: this
128  class(VirtualDataType), pointer :: field
129  character(len=*) :: var_name
130  character(len=*) :: subcmp_name
131  integer(I4B) :: map_id
132  logical(LGP), optional :: is_local
133 
134  field%is_remote = .not. this%is_local
135  field%map_type = map_id
136  if (present(is_local)) field%is_remote = .not. is_local
137  field%var_name = var_name
138  field%subcmp_name = subcmp_name
139  if (subcmp_name == '') then
140  field%mem_path = create_mem_path(this%name)
141  else
142  field%mem_path = create_mem_path(this%name, subcmp_name)
143  end if
144  field%is_reduced = (field%is_remote .and. field%map_type > 0)
145  field%remote_elem_shift => null()
146  field%remote_to_virtual => null()
147  field%virtual_mt => null()
148  call this%add_to_list(field)
149 
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 95 of file VirtualDataContainer.f90.

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

◆ vdc_destroy()

subroutine virtualdatacontainermodule::vdc_destroy ( class(virtualdatacontainertype this)

Definition at line 395 of file VirtualDataContainer.f90.

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

◆ vdc_get_recv_items()

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

Definition at line 294 of file VirtualDataContainer.f90.

295  class(VirtualDataContainerType) :: this
296  integer(I4B) :: stage
297  integer(I4B) :: rank
298  type(STLVecInt) :: virtual_items
299 
300  call this%get_items_for_stage(stage, virtual_items)
301 

◆ vdc_get_send_items()

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

Definition at line 282 of file VirtualDataContainer.f90.

283  class(VirtualDataContainerType) :: this
284  integer(I4B) :: stage
285  integer(I4B) :: rank
286  type(STLVecInt) :: virtual_items
287 
288  call this%get_items_for_stage(stage, virtual_items)
289 

◆ 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 370 of file VirtualDataContainer.f90.

371  use simmodule, only: ustop
372  class(VirtualDataContainerType) :: this
373  character(len=*) :: var_name
374  character(len=*) :: subcomp_name
375  class(VirtualDataType), pointer :: virtual_data
376  ! local
377  integer(I4B) :: i
378  class(VirtualDataType), pointer :: vd
379 
380  virtual_data => null()
381  do i = 1, this%virtual_data_list%Count()
382  vd => get_virtual_data_from_list(this%virtual_data_list, i)
383  if (vd%var_name == var_name .and. &
384  vd%subcmp_name == subcomp_name) then
385  virtual_data => vd
386  return
387  end if
388  end do
389 
390  write (*, *) 'Error: unknown virtual variable ', var_name, ' ', subcomp_name
391  call ustop()
392 
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 345 of file VirtualDataContainer.f90.

346  class(VirtualDataContainerType) :: this
347  character(len=*) :: var_name
348  character(len=*) :: subcomp_name
349  character(len=LENMEMPATH) :: vrt_path
350  ! local
351  class(VirtualDataType), pointer :: vdi
352 
353  vdi => this%vdc_get_virtual_data(var_name, subcomp_name)
354  if (vdi%is_remote) then
355  if (subcomp_name == '') then
356  vrt_path = create_mem_path(this%name, context=this%vmem_ctx)
357  else
358  vrt_path = create_mem_path(this%name, subcomp_name, context=this%vmem_ctx)
359  end if
360  else
361  if (subcomp_name == '') then
362  vrt_path = create_mem_path(this%name)
363  else
364  vrt_path = create_mem_path(this%name, subcomp_name)
365  end if
366  end if
367 
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 175 of file VirtualDataContainer.f90.

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

◆ vdc_prepare_stage()

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

Definition at line 163 of file VirtualDataContainer.f90.

164  use simmodule, only: ustop
165  class(VirtualDataContainerType) :: this
166  integer(I4B) :: stage
167 
168  write (*, *) 'Error: prepare_stage should be overridden'
169  call ustop()
170 
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 196 of file VirtualDataContainer.f90.

197  class(VirtualDataContainerType) :: this
198  integer(I4B), dimension(:), pointer, contiguous :: src_indexes
199  integer(I4B) :: map_id
200  ! local
201  integer(I4B) :: i, idx_remote, max_remote_idx
202 
203  if (this%element_maps(map_id)%nr_virt_elems > 0) then
204  write (*, *) "Error, VDC element map already set"
205  call ustop()
206  end if
207 
208  this%element_maps(map_id)%nr_virt_elems = size(src_indexes)
209  allocate (this%element_maps(map_id)%remote_elem_shift(size(src_indexes)))
210  do i = 1, size(src_indexes)
211  this%element_maps(map_id)%remote_elem_shift(i) = src_indexes(i) - 1
212  end do
213 
214  max_remote_idx = maxval(src_indexes)
215  this%element_luts(map_id)%max_remote_idx = max_remote_idx
216  allocate (this%element_luts(map_id)%remote_to_virtual(max_remote_idx))
217  do i = 1, max_remote_idx
218  this%element_luts(map_id)%remote_to_virtual(i) = -1
219  end do
220  do i = 1, size(src_indexes)
221  idx_remote = src_indexes(i)
222  this%element_luts(map_id)%remote_to_virtual(idx_remote) = i
223  end do
224 
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 427 of file VirtualDataContainer.f90.

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

◆ vdc_type_to_str()

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

Definition at line 454 of file VirtualDataContainer.f90.

455  integer(I4B) :: cntr_type
456  character(len=24) :: cntr_str
457 
458  if (cntr_type == vdc_unknown_type) then; cntr_str = "unknown"
459  else if (cntr_type == vdc_gwfmodel_type) then; cntr_str = "GWF Model"
460  else if (cntr_type == vdc_gwtmodel_type) then; cntr_str = "GWT Model"
461  else if (cntr_type == vdc_gwemodel_type) then; cntr_str = "GWE Model"
462  else if (cntr_type == vdc_gwfexg_type) then; cntr_str = "GWF Exchange"
463  else if (cntr_type == vdc_gwtexg_type) then; cntr_str = "GWT Exchange"
464  else if (cntr_type == vdc_gweexg_type) then; cntr_str = "GWE Exchange"
465  else if (cntr_type == vdc_gwfmvr_type) then; cntr_str = "GWF Mover"
466  else if (cntr_type == vdc_gwtmvt_type) then; cntr_str = "GWT Mover"
467  else if (cntr_type == vdc_gwemve_type) then; cntr_str = "GWE Mover"
468  else; cntr_str = "Undefined"
469  end if
470 
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