MODFLOW 6  version 6.8.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, and store it in this container. The 'is_local' flag makes it possible to mark some fields local in an. 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 156 of file VirtualDataContainer.f90.

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

◆ get_items_for_stage()

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

Definition at line 308 of file VirtualDataContainer.f90.

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

◆ get_vdc_from_list()

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

Definition at line 440 of file VirtualDataContainer.f90.

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

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

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

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

232  class(VirtualDataContainerType) :: this
233  class(VirtualDataType), pointer :: vd
234  integer(I4B), dimension(:) :: stages
235 
236  call this%map_internal(vd, (/0/), stages)
237 
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 327 of file VirtualDataContainer.f90.

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

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

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

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

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

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

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

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

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

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

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

◆ vdc_prepare_stage()

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

Definition at line 167 of file VirtualDataContainer.f90.

168  use simmodule, only: ustop
169  class(VirtualDataContainerType) :: this
170  integer(I4B) :: stage
171 
172  write (*, *) 'Error: prepare_stage should be overridden'
173  call ustop()
174 
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 200 of file VirtualDataContainer.f90.

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

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

◆ vdc_type_to_str()

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

Definition at line 458 of file VirtualDataContainer.f90.

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