MODFLOW 6  version 6.9.0.dev0
USGS Modular Hydrologic Model
memorymanagermodule Module Reference

Data Types

interface  mem_allocate
 
interface  mem_checkin
 
interface  mem_reallocate
 
interface  mem_setptr
 
interface  mem_copyptr
 
interface  mem_reassignptr
 
interface  mem_deallocate
 

Functions/Subroutines

subroutine, public get_mem_type (name, mem_path, var_type)
 @ brief Get the variable memory type More...
 
subroutine, public get_mem_rank (name, mem_path, rank)
 @ brief Get the variable rank More...
 
subroutine, public get_mem_elem_size (name, mem_path, size)
 @ brief Get the memory size of a single element of the stored variable More...
 
subroutine, public get_mem_shape (name, mem_path, mem_shape)
 @ brief Get the variable memory shape More...
 
subroutine, public get_isize (name, mem_path, isize)
 @ brief Get the number of elements for this variable More...
 
subroutine, public get_from_memorystore (name, mem_path, mt, found, check)
 @ brief Get a memory type entry from the memory list More...
 
subroutine allocate_error (varname, mem_path, istat, isize)
 Issue allocation error message and stop program execution. More...
 
subroutine allocate_logical (sclr, name, mem_path)
 Allocate a logical scalar. More...
 
subroutine allocate_logical1d (alog, nrow, name, mem_path)
 Allocate a 1-dimensional logical array. More...
 
subroutine allocate_str (sclr, ilen, name, mem_path)
 Allocate a character string. More...
 
subroutine allocate_str1d (astr1d, ilen, nrow, name, mem_path)
 Allocate a 1-dimensional defined length string array. More...
 
subroutine allocate_charstr1d (acharstr1d, ilen, nrow, name, mem_path)
 Allocate a 1-dimensional array of deferred-length CharacterStringType. More...
 
subroutine allocate_int (sclr, name, mem_path)
 Allocate a integer scalar. More...
 
subroutine allocate_int1d (aint, nrow, name, mem_path)
 Allocate a 1-dimensional integer array. More...
 
subroutine allocate_int2d (aint, ncol, nrow, name, mem_path)
 Allocate a 2-dimensional integer array. More...
 
subroutine allocate_int3d (aint, ncol, nrow, nlay, name, mem_path)
 Allocate a 3-dimensional integer array. More...
 
subroutine allocate_dbl (sclr, name, mem_path)
 Allocate a real scalar. More...
 
subroutine allocate_dbl1d (adbl, nrow, name, mem_path)
 Allocate a 1-dimensional real array. More...
 
subroutine allocate_dbl2d (adbl, ncol, nrow, name, mem_path)
 Allocate a 2-dimensional real array. More...
 
subroutine allocate_dbl3d (adbl, ncol, nrow, nlay, name, mem_path)
 Allocate a 3-dimensional real array. More...
 
subroutine checkin_logical1d (alog, name, mem_path, name2, mem_path2)
 Check in an existing 1d logical array with a new address (name + path) More...
 
subroutine checkin_int1d (aint, name, mem_path, name2, mem_path2)
 Check in an existing 1d integer array with a new address (name + path) More...
 
subroutine checkin_int2d (aint2d, name, mem_path, name2, mem_path2)
 Check in an existing 2d integer array with a new address (name + path) More...
 
subroutine checkin_dbl1d (adbl, name, mem_path, name2, mem_path2)
 Check in an existing 1d double precision array with a new address (name + path) More...
 
subroutine checkin_dbl2d (adbl2d, name, mem_path, name2, mem_path2)
 Check in an existing 2d double precision array with a new address (name + path) More...
 
subroutine checkin_charstr1d (acharstr1d, ilen, name, mem_path, name2, mem_path2)
 Check in an existing 1d CharacterStringType array with a new address (name + path) More...
 
subroutine reallocate_str1d (astr, ilen, nrow, name, mem_path)
 Reallocate a 1-dimensional defined length string array. More...
 
subroutine reallocate_charstr1d (acharstr1d, ilen, nrow, name, mem_path)
 Reallocate a 1-dimensional deferred length string array. More...
 
subroutine reallocate_logical1d (alog, nrow, name, mem_path)
 Reallocate a 1-dimensional logical array. More...
 
subroutine reallocate_int1d (aint, nrow, name, mem_path)
 Reallocate a 1-dimensional integer array. More...
 
subroutine reallocate_int2d (aint, ncol, nrow, name, mem_path)
 Reallocate a 2-dimensional integer array. More...
 
subroutine reallocate_dbl1d (adbl, nrow, name, mem_path)
 Reallocate a 1-dimensional real array. More...
 
subroutine reallocate_dbl2d (adbl, ncol, nrow, name, mem_path)
 Reallocate a 2-dimensional real array. More...
 
subroutine setptr_logical (sclr, name, mem_path)
 Set pointer to a logical scalar. More...
 
subroutine setptr_int (sclr, name, mem_path)
 Set pointer to integer scalar. More...
 
subroutine setptr_logical1d (alog, name, mem_path)
 Set pointer to 1d logical array. More...
 
subroutine setptr_int1d (aint, name, mem_path)
 Set pointer to 1d integer array. More...
 
subroutine setptr_int2d (aint, name, mem_path)
 Set pointer to 2d integer array. More...
 
subroutine setptr_int3d (aint, name, mem_path)
 Set pointer to 3d integer array. More...
 
subroutine setptr_dbl (sclr, name, mem_path)
 Set pointer to a real scalar. More...
 
subroutine setptr_dbl1d (adbl, name, mem_path)
 Set pointer to a 1d real array. More...
 
subroutine setptr_dbl2d (adbl, name, mem_path)
 Set pointer to a 2d real array. More...
 
subroutine setptr_dbl3d (adbl, name, mem_path)
 Set pointer to a 3d real array. More...
 
subroutine setptr_str (asrt, name, mem_path)
 Set pointer to a string (scalar) More...
 
subroutine setptr_str1d (astr1d, name, mem_path)
 Set pointer to a fixed-length string array. More...
 
subroutine setptr_charstr1d (acharstr1d, name, mem_path)
 Set pointer to an array of CharacterStringType. More...
 
subroutine copyptr_logical1d (alog, name, mem_path, mem_path_copy)
 Make a copy of a 1-dimensional logical array. More...
 
subroutine copyptr_int1d (aint, name, mem_path, mem_path_copy)
 Make a copy of a 1-dimensional integer array. More...
 
subroutine copyptr_int2d (aint, name, mem_path, mem_path_copy)
 Make a copy of a 2-dimensional integer array. More...
 
subroutine copyptr_dbl1d (adbl, name, mem_path, mem_path_copy)
 Make a copy of a 1-dimensional real array. More...
 
subroutine copyptr_dbl2d (adbl, name, mem_path, mem_path_copy)
 Make a copy of a 2-dimensional real array. More...
 
subroutine, public copy_dbl1d (adbl, name, mem_path)
 Copy values from a 1-dimensional real array in the memory. More...
 
subroutine reassignptr_int (sclr, name, mem_path, name_target, mem_path_target)
 Set the pointer for an integer scalar to. More...
 
subroutine reassignptr_logical1d (alog, name, mem_path, name_target, mem_path_target)
 Set the pointer for a 1-dimensional logical array to. More...
 
subroutine reassignptr_int1d (aint, name, mem_path, name_target, mem_path_target)
 Set the pointer for a 1-dimensional integer array to. More...
 
subroutine reassignptr_int2d (aint, name, mem_path, name_target, mem_path_target)
 Set the pointer for a 2-dimensional integer array to. More...
 
subroutine reassignptr_dbl1d (adbl, name, mem_path, name_target, mem_path_target)
 Set the pointer for a 1-dimensional real array to. More...
 
subroutine reassignptr_dbl2d (adbl, name, mem_path, name_target, mem_path_target)
 Set the pointer for a 2-dimensional real array to. More...
 
subroutine deallocate_str (sclr, name, mem_path)
 DEPRECATED. The memory manager will handle the deallocation of the pointer. More...
 
subroutine deallocate_str1d (astr1d, name, mem_path)
 Deallocate an array of defined-length character strings. More...
 
subroutine deallocate_charstr1d (astr1d, name, mem_path)
 DEPRECATED. The memory manager will handle the deallocation of the pointer. More...
 
subroutine deallocate_logical (sclr)
 DEPRECATED. The memory manager will handle the deallocation of the pointer. More...
 
subroutine deallocate_int (sclr)
 DEPRECATED. The memory manager will handle the deallocation of the pointer. More...
 
subroutine deallocate_dbl (sclr)
 DEPRECATED. The memory manager will handle the deallocation of the pointer. More...
 
subroutine deallocate_logical1d (alog, name, mem_path)
 DEPRECATED. The memory manager will handle the deallocation of the pointer. More...
 
subroutine deallocate_int1d (aint, name, mem_path)
 DEPRECATED. The memory manager will handle the deallocation of the pointer. More...
 
subroutine deallocate_int2d (aint, name, mem_path)
 DEPRECATED. The memory manager will handle the deallocation of the pointer. More...
 
subroutine deallocate_int3d (aint, name, mem_path)
 DEPRECATED. The memory manager will handle the deallocation of the pointer. More...
 
subroutine deallocate_dbl1d (adbl, name, mem_path)
 DEPRECATED. The memory manager will handle the deallocation of the pointer. More...
 
subroutine deallocate_dbl2d (adbl, name, mem_path)
 DEPRECATED. The memory manager will handle the deallocation of the pointer. More...
 
subroutine deallocate_dbl3d (adbl, name, mem_path)
 DEPRECATED. The memory manager will handle the deallocation of the pointer. More...
 
subroutine, public mem_set_print_option (iout, keyword, error_msg)
 Set the memory print option. More...
 
subroutine mem_summary_table (iout, nrows, cunits)
 Create a table if memory_print_option is 'SUMMARY'. More...
 
subroutine mem_detailed_table (iout, nrows)
 Create a table if memory_print_option is 'ALL'. More...
 
subroutine mem_summary_line (component, rchars, rlog, rint, rreal, bytes)
 Write a row for the memory_print_option 'SUMMARY' table. More...
 
subroutine mem_units (bytes, fact, cunits)
 Determine appropriate memory unit and conversion factor. More...
 
subroutine mem_summary_total (iout, bytes)
 Create and fill a table with the total allocated memory. More...
 
subroutine mem_cleanup_table ()
 Generic function to clean a memory manager table. More...
 
subroutine, public mem_write_usage (iout)
 Write memory manager memory usage based on the user-specified memory_print_option. More...
 
subroutine, public mem_print_detailed (iout)
 
real(dp) function calc_virtual_mem ()
 Sum up virtual memory, i.e. memory. More...
 
subroutine, public mem_release (mt)
 Release a memory store entry: deallocate data and update counters. More...
 
subroutine, public mem_da ()
 Deallocate memory in the memory manager. More...
 
subroutine mem_da_check (mt)
 
subroutine mem_unique_origins (cunique)
 Create a array with unique first components from all memory paths. Only the first component of the memory path is evaluated. More...
 

Variables

type(memorystoretype), public memorystore
 
type(tabletype), pointer memtab => null()
 
integer(i8b) nvalues_alogical = 0
 
integer(i8b) nvalues_astr = 0
 
integer(i8b) nvalues_aint = 0
 
integer(i8b) nvalues_adbl = 0
 
integer(i4b) iprmem = 0
 

Function/Subroutine Documentation

◆ allocate_charstr1d()

subroutine memorymanagermodule::allocate_charstr1d ( type(characterstringtype), dimension(:), intent(inout), pointer, contiguous  acharstr1d,
integer(i4b), intent(in)  ilen,
integer(i4b), intent(in)  nrow,
character(len=*), intent(in)  name,
character(len=*), intent(in)  mem_path 
)
private
Parameters
[in,out]acharstr1dvariable for allocation
[in]ilenstring length
[in]nrownumber of strings in array
[in]namevariable name
[in]mem_pathpath where the variable is stored

Definition at line 554 of file MemoryManager.f90.

555  type(CharacterStringType), dimension(:), &
556  pointer, contiguous, intent(inout) :: acharstr1d !< variable for allocation
557  integer(I4B), intent(in) :: ilen !< string length
558  integer(I4B), intent(in) :: nrow !< number of strings in array
559  character(len=*), intent(in) :: name !< variable name
560  character(len=*), intent(in) :: mem_path !< path where the variable is stored
561  ! -- local variables
562  character(len=ilen) :: string
563  type(MemoryType), pointer :: mt
564  integer(I4B) :: n
565  integer(I4B) :: istat
566  integer(I4B) :: isize
567  ! -- code
568  !
569  ! -- initialize string
570  string = ''
571  !
572  ! -- check variable name length
573  call mem_check_length(name, lenvarname, "variable")
574  !
575  ! -- calculate isize
576  isize = nrow
577  !
578  ! -- allocate deferred length string array
579  allocate (acharstr1d(nrow), stat=istat, errmsg=errmsg)
580  !
581  ! -- check for error condition
582  if (istat /= 0) then
583  call allocate_error(name, mem_path, istat, isize)
584  end if
585  !
586  ! -- fill deferred length string with empty string
587  do n = 1, nrow
588  acharstr1d(n) = string
589  end do
590  !
591  ! -- update counter
592  nvalues_astr = nvalues_astr + isize
593  !
594  ! -- allocate memory type
595  allocate (mt)
596  !
597  ! -- set memory type
598  mt%acharstr1d => acharstr1d
599  mt%element_size = ilen
600  mt%isize = isize
601  mt%name = name
602  mt%path = mem_path
603  write (mt%memtype, "(a,' LEN=',i0,' (',i0,')')") 'STRING', ilen, nrow
604  !
605  ! -- add deferred length character array to the memory manager list
606  call memorystore%add(mt)

◆ allocate_dbl()

subroutine memorymanagermodule::allocate_dbl ( real(dp), intent(inout), pointer  sclr,
character(len=*), intent(in)  name,
character(len=*), intent(in)  mem_path 
)
private
Parameters
[in,out]sclrvariable for allocation
[in]namevariable name
[in]mem_pathpath where variable is stored

Definition at line 782 of file MemoryManager.f90.

783  real(DP), pointer, intent(inout) :: sclr !< variable for allocation
784  character(len=*), intent(in) :: name !< variable name
785  character(len=*), intent(in) :: mem_path !< path where variable is stored
786  ! -- local
787  type(MemoryType), pointer :: mt
788  integer(I4B) :: istat
789  ! -- code
790  !
791  ! -- check variable name length
792  call mem_check_length(name, lenvarname, "variable")
793  !
794  ! -- allocate real scalar
795  allocate (sclr, stat=istat, errmsg=errmsg)
796  if (istat /= 0) then
797  call allocate_error(name, mem_path, istat, 1)
798  end if
799  !
800  ! -- update counter
801  nvalues_adbl = nvalues_adbl + 1
802  !
803  ! -- allocate memory type
804  allocate (mt)
805  !
806  ! -- set memory type
807  mt%dblsclr => sclr
808  mt%element_size = dp
809  mt%isize = 1
810  mt%name = name
811  mt%path = mem_path
812  write (mt%memtype, "(a)") 'DOUBLE'
813  !
814  ! -- add memory type to the memory list
815  call memorystore%add(mt)

◆ allocate_dbl1d()

subroutine memorymanagermodule::allocate_dbl1d ( real(dp), dimension(:), intent(inout), pointer, contiguous  adbl,
integer(i4b), intent(in)  nrow,
character(len=*), intent(in)  name,
character(len=*), intent(in)  mem_path 
)
private
Parameters
[in,out]adblvariable for allocation
[in]nrownumber of rows
[in]namevariable name
[in]mem_pathpath where variable is stored

Definition at line 820 of file MemoryManager.f90.

821  real(DP), dimension(:), pointer, contiguous, intent(inout) :: adbl !< variable for allocation
822  integer(I4B), intent(in) :: nrow !< number of rows
823  character(len=*), intent(in) :: name !< variable name
824  character(len=*), intent(in) :: mem_path !< path where variable is stored
825  ! -- local
826  type(MemoryType), pointer :: mt
827  integer(I4B) :: istat
828  integer(I4B) :: isize
829  ! -- code
830  !
831  ! -- check the variable name length
832  call mem_check_length(name, lenvarname, "variable")
833  !
834  ! -- set isize
835  isize = nrow
836  !
837  ! -- allocate the real array
838  allocate (adbl(nrow), stat=istat, errmsg=errmsg)
839  if (istat /= 0) then
840  call allocate_error(name, mem_path, istat, isize)
841  end if
842  !
843  ! -- update counter
844  nvalues_adbl = nvalues_adbl + isize
845  !
846  ! -- allocate memory type
847  allocate (mt)
848  !
849  ! -- set memory type
850  mt%adbl1d => adbl
851  mt%element_size = dp
852  mt%isize = isize
853  mt%name = name
854  mt%path = mem_path
855  write (mt%memtype, "(a,' (',i0,')')") 'DOUBLE', isize
856  !
857  ! -- add memory type to the memory list
858  call memorystore%add(mt)
Here is the caller graph for this function:

◆ allocate_dbl2d()

subroutine memorymanagermodule::allocate_dbl2d ( real(dp), dimension(:, :), intent(inout), pointer, contiguous  adbl,
integer(i4b), intent(in)  ncol,
integer(i4b), intent(in)  nrow,
character(len=*), intent(in)  name,
character(len=*), intent(in)  mem_path 
)
private
Parameters
[in,out]adblvariable for allocation
[in]ncolnumber of columns
[in]nrownumber of rows
[in]namevariable name
[in]mem_pathpath where variable is stored

Definition at line 863 of file MemoryManager.f90.

864  real(DP), dimension(:, :), pointer, contiguous, intent(inout) :: adbl !< variable for allocation
865  integer(I4B), intent(in) :: ncol !< number of columns
866  integer(I4B), intent(in) :: nrow !< number of rows
867  character(len=*), intent(in) :: name !< variable name
868  character(len=*), intent(in) :: mem_path !< path where variable is stored
869  ! -- local
870  type(MemoryType), pointer :: mt
871  integer(I4B) :: istat
872  integer(I4B) :: isize
873  ! -- code
874  !
875  ! -- check the variable name length
876  call mem_check_length(name, lenvarname, "variable")
877  !
878  ! -- set isize
879  isize = ncol * nrow
880  !
881  ! -- allocate the real array
882  allocate (adbl(ncol, nrow), stat=istat, errmsg=errmsg)
883  if (istat /= 0) then
884  call allocate_error(name, mem_path, istat, isize)
885  end if
886  !
887  ! -- update counter
888  nvalues_adbl = nvalues_adbl + isize
889  !
890  ! -- allocate memory type
891  allocate (mt)
892  !
893  ! -- set memory type
894  mt%adbl2d => adbl
895  mt%element_size = dp
896  mt%isize = isize
897  mt%name = name
898  mt%path = mem_path
899  write (mt%memtype, "(a,' (',i0,',',i0,')')") 'DOUBLE', ncol, nrow
900  !
901  ! -- add memory type to the memory list
902  call memorystore%add(mt)
Here is the caller graph for this function:

◆ allocate_dbl3d()

subroutine memorymanagermodule::allocate_dbl3d ( real(dp), dimension(:, :, :), intent(inout), pointer, contiguous  adbl,
integer(i4b), intent(in)  ncol,
integer(i4b), intent(in)  nrow,
integer(i4b), intent(in)  nlay,
character(len=*), intent(in)  name,
character(len=*), intent(in)  mem_path 
)
private
Parameters
[in,out]adblvariable for allocation
[in]ncolnumber of columns
[in]nrownumber of rows
[in]nlaynumber of layers
[in]namevariable name
[in]mem_pathpath where variable is stored

Definition at line 907 of file MemoryManager.f90.

908  real(DP), dimension(:, :, :), pointer, contiguous, intent(inout) :: adbl !< variable for allocation
909  integer(I4B), intent(in) :: ncol !< number of columns
910  integer(I4B), intent(in) :: nrow !< number of rows
911  integer(I4B), intent(in) :: nlay !< number of layers
912  character(len=*), intent(in) :: name !< variable name
913  character(len=*), intent(in) :: mem_path !< path where variable is stored
914  ! -- local
915  type(MemoryType), pointer :: mt
916  integer(I4B) :: istat
917  integer(I4B) :: isize
918  ! -- code
919  !
920  ! -- check the variable name length
921  call mem_check_length(name, lenvarname, "variable")
922  !
923  ! -- set isize
924  isize = ncol * nrow * nlay
925  !
926  ! -- allocate the real array
927  allocate (adbl(ncol, nrow, nlay), stat=istat, errmsg=errmsg)
928  if (istat /= 0) then
929  call allocate_error(name, mem_path, istat, isize)
930  end if
931  !
932  ! -- update the counter
933  nvalues_adbl = nvalues_adbl + isize
934  !
935  ! -- allocate memory type
936  allocate (mt)
937  !
938  ! -- set memory type
939  mt%adbl3d => adbl
940  mt%element_size = dp
941  mt%isize = isize
942  mt%name = name
943  mt%path = mem_path
944  write (mt%memtype, "(a,' (',i0,',',i0,',',i0,')')") 'DOUBLE', ncol, &
945  nrow, nlay
946  !
947  ! -- add memory type to the memory list
948  call memorystore%add(mt)

◆ allocate_error()

subroutine memorymanagermodule::allocate_error ( character(len=*), intent(in)  varname,
character(len=*), intent(in)  mem_path,
integer(i4b), intent(in)  istat,
integer(i4b), intent(in)  isize 
)
private
Parameters
[in]varnamevariable name
[in]mem_pathpath where the variable is stored
[in]istatstatus code
[in]isizesize of allocation

Definition at line 334 of file MemoryManager.f90.

335  character(len=*), intent(in) :: varname !< variable name
336  character(len=*), intent(in) :: mem_path !< path where the variable is stored
337  integer(I4B), intent(in) :: istat !< status code
338  integer(I4B), intent(in) :: isize !< size of allocation
339  ! -- local
340  character(len=20) :: csize
341  character(len=20) :: cstat
342  ! -- code
343  !
344  ! -- initialize character variables
345  write (csize, '(i0)') isize
346  write (cstat, '(i0)') istat
347  !
348  ! -- create error message
349  errmsg = "Error trying to allocate memory. Path '"//trim(mem_path)// &
350  "' variable name '"//trim(varname)//"' size '"//trim(csize)// &
351  "'. Error message is '"//trim(adjustl(errmsg))// &
352  "'. Status code is "//trim(cstat)//'.'
353  !
354  ! -- store error and stop program execution
355  call store_error(errmsg, terminate=.true.)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ allocate_int()

subroutine memorymanagermodule::allocate_int ( integer(i4b), intent(inout), pointer  sclr,
character(len=*), intent(in)  name,
character(len=*), intent(in)  mem_path 
)
private
Parameters
[in,out]sclrvariable for allocation
[in]namevariable name
[in]mem_pathpath where the variable is stored

Definition at line 611 of file MemoryManager.f90.

612  integer(I4B), pointer, intent(inout) :: sclr !< variable for allocation
613  character(len=*), intent(in) :: name !< variable name
614  character(len=*), intent(in) :: mem_path !< path where the variable is stored
615  ! -- local
616  type(MemoryType), pointer :: mt
617  integer(I4B) :: istat
618  ! -- code
619  !
620  ! -- check variable name length
621  call mem_check_length(name, lenvarname, "variable")
622  !
623  ! -- allocate integer scalar
624  allocate (sclr, stat=istat, errmsg=errmsg)
625  if (istat /= 0) then
626  call allocate_error(name, mem_path, istat, 1)
627  end if
628  !
629  ! -- update counter
630  nvalues_aint = nvalues_aint + 1
631  !
632  ! -- allocate memory type
633  allocate (mt)
634  !
635  ! -- set memory type
636  mt%intsclr => sclr
637  mt%element_size = i4b
638  mt%isize = 1
639  mt%name = name
640  mt%path = mem_path
641  write (mt%memtype, "(a)") 'INTEGER'
642  !
643  ! -- add memory type to the memory list
644  call memorystore%add(mt)

◆ allocate_int1d()

subroutine memorymanagermodule::allocate_int1d ( integer(i4b), dimension(:), intent(inout), pointer, contiguous  aint,
integer(i4b), intent(in)  nrow,
character(len=*), intent(in)  name,
character(len=*), intent(in)  mem_path 
)
private
Parameters
[in,out]aintvariable for allocation
[in]nrowinteger array number of rows
[in]namevariable name
[in]mem_pathpath where variable is stored

Definition at line 649 of file MemoryManager.f90.

650  integer(I4B), dimension(:), pointer, contiguous, intent(inout) :: aint !< variable for allocation
651  integer(I4B), intent(in) :: nrow !< integer array number of rows
652  character(len=*), intent(in) :: name !< variable name
653  character(len=*), intent(in) :: mem_path !< path where variable is stored
654  ! --local
655  type(MemoryType), pointer :: mt
656  integer(I4B) :: istat
657  integer(I4B) :: isize
658  ! -- code
659  !
660  ! -- check variable name length
661  call mem_check_length(name, lenvarname, "variable")
662  !
663  ! -- set isize
664  isize = nrow
665  !
666  ! -- allocate integer array
667  allocate (aint(nrow), stat=istat, errmsg=errmsg)
668  if (istat /= 0) then
669  call allocate_error(name, mem_path, istat, isize)
670  end if
671  !
672  ! -- update counter
673  nvalues_aint = nvalues_aint + isize
674  !
675  ! -- allocate memory type
676  allocate (mt)
677  !
678  ! -- set memory type
679  mt%aint1d => aint
680  mt%element_size = i4b
681  mt%isize = isize
682  mt%name = name
683  mt%path = mem_path
684  write (mt%memtype, "(a,' (',i0,')')") 'INTEGER', isize
685  !
686  ! -- add memory type to the memory list
687  call memorystore%add(mt)
Here is the caller graph for this function:

◆ allocate_int2d()

subroutine memorymanagermodule::allocate_int2d ( integer(i4b), dimension(:, :), intent(inout), pointer, contiguous  aint,
integer(i4b), intent(in)  ncol,
integer(i4b), intent(in)  nrow,
character(len=*), intent(in)  name,
character(len=*), intent(in)  mem_path 
)
private
Parameters
[in,out]aintvariable for allocation
[in]ncolnumber of columns
[in]nrownumber of rows
[in]namevariable name
[in]mem_pathpath where variable is stored

Definition at line 692 of file MemoryManager.f90.

693  integer(I4B), dimension(:, :), pointer, contiguous, intent(inout) :: aint !< variable for allocation
694  integer(I4B), intent(in) :: ncol !< number of columns
695  integer(I4B), intent(in) :: nrow !< number of rows
696  character(len=*), intent(in) :: name !< variable name
697  character(len=*), intent(in) :: mem_path !< path where variable is stored
698  ! -- local
699  type(MemoryType), pointer :: mt
700  integer(I4B) :: istat
701  integer(I4B) :: isize
702  ! -- code
703  !
704  ! -- check the variable name length
705  call mem_check_length(name, lenvarname, "variable")
706  !
707  ! -- set isize
708  isize = ncol * nrow
709  !
710  ! -- allocate the integer array
711  allocate (aint(ncol, nrow), stat=istat, errmsg=errmsg)
712  if (istat /= 0) then
713  call allocate_error(name, mem_path, istat, isize)
714  end if
715  !
716  ! -- update the counter
717  nvalues_aint = nvalues_aint + isize
718  !
719  ! -- allocate memory type
720  allocate (mt)
721  !
722  ! -- set memory type
723  mt%aint2d => aint
724  mt%element_size = i4b
725  mt%isize = isize
726  mt%name = name
727  mt%path = mem_path
728  write (mt%memtype, "(a,' (',i0,',',i0,')')") 'INTEGER', ncol, nrow
729  !
730  ! -- add memory type to the memory list
731  call memorystore%add(mt)
Here is the caller graph for this function:

◆ allocate_int3d()

subroutine memorymanagermodule::allocate_int3d ( integer(i4b), dimension(:, :, :), intent(inout), pointer, contiguous  aint,
integer(i4b), intent(in)  ncol,
integer(i4b), intent(in)  nrow,
integer(i4b), intent(in)  nlay,
character(len=*), intent(in)  name,
character(len=*), intent(in)  mem_path 
)
private
Parameters
[in,out]aintvariable for allocation
[in]ncolnumber of columns
[in]nrownumber of rows
[in]nlaynumber of layers
[in]namevariable name
[in]mem_pathpath where variable is stored

Definition at line 736 of file MemoryManager.f90.

737  integer(I4B), dimension(:, :, :), pointer, contiguous, intent(inout) :: aint !< variable for allocation
738  integer(I4B), intent(in) :: ncol !< number of columns
739  integer(I4B), intent(in) :: nrow !< number of rows
740  integer(I4B), intent(in) :: nlay !< number of layers
741  character(len=*), intent(in) :: name !< variable name
742  character(len=*), intent(in) :: mem_path !< path where variable is stored
743  ! -- local
744  type(MemoryType), pointer :: mt
745  integer(I4B) :: istat
746  integer(I4B) :: isize
747  ! -- code
748  !
749  ! -- check variable name length
750  call mem_check_length(name, lenvarname, "variable")
751  !
752  ! -- set isize
753  isize = ncol * nrow * nlay
754  !
755  ! -- allocate integer array
756  allocate (aint(ncol, nrow, nlay), stat=istat, errmsg=errmsg)
757  if (istat /= 0) then
758  call allocate_error(name, mem_path, istat, isize)
759  end if
760  !
761  ! -- update counter
762  nvalues_aint = nvalues_aint + isize
763  !
764  ! -- allocate memory type
765  allocate (mt)
766  !
767  ! -- set memory type
768  mt%aint3d => aint
769  mt%element_size = i4b
770  mt%isize = isize
771  mt%name = name
772  mt%path = mem_path
773  write (mt%memtype, "(a,' (',i0,',',i0,',',i0,')')") 'INTEGER', ncol, &
774  nrow, nlay
775  !
776  ! -- add memory type to the memory list
777  call memorystore%add(mt)

◆ allocate_logical()

subroutine memorymanagermodule::allocate_logical ( logical(lgp), intent(inout), pointer  sclr,
character(len=*), intent(in)  name,
character(len=*), intent(in)  mem_path 
)
private
Parameters
[in,out]sclrvariable for allocation
[in]namevariable name
[in]mem_pathpath where the variable is stored

Definition at line 360 of file MemoryManager.f90.

361  logical(LGP), pointer, intent(inout) :: sclr !< variable for allocation
362  character(len=*), intent(in) :: name !< variable name
363  character(len=*), intent(in) :: mem_path !< path where the variable is stored
364  ! -- local
365  integer(I4B) :: istat
366  type(MemoryType), pointer :: mt
367  ! -- code
368  !
369  ! -- check variable name length
370  call mem_check_length(name, lenvarname, "variable")
371  !
372  ! -- allocate the logical scalar
373  allocate (sclr, stat=istat, errmsg=errmsg)
374  if (istat /= 0) then
375  call allocate_error(name, mem_path, istat, 1)
376  end if
377  !
378  ! -- update counter
379  nvalues_alogical = nvalues_alogical + 1
380  !
381  ! -- allocate memory type
382  allocate (mt)
383  !
384  ! -- set memory type
385  mt%logicalsclr => sclr
386  mt%element_size = lgp
387  mt%isize = 1
388  mt%name = name
389  mt%path = mem_path
390  write (mt%memtype, "(a)") 'LOGICAL'
391  !
392  ! -- add memory type to the memory list
393  call memorystore%add(mt)

◆ allocate_logical1d()

subroutine memorymanagermodule::allocate_logical1d ( logical(lgp), dimension(:), intent(inout), pointer, contiguous  alog,
integer(i4b), intent(in)  nrow,
character(len=*), intent(in)  name,
character(len=*), intent(in)  mem_path 
)
private
Parameters
[in,out]alogvariable for allocation
[in]nrownumber of rows
[in]namevariable name
[in]mem_pathpath where variable is stored

Definition at line 398 of file MemoryManager.f90.

399  logical(LGP), dimension(:), pointer, contiguous, intent(inout) :: alog !< variable for allocation
400  integer(I4B), intent(in) :: nrow !< number of rows
401  character(len=*), intent(in) :: name !< variable name
402  character(len=*), intent(in) :: mem_path !< path where variable is stored
403  ! --local
404  type(MemoryType), pointer :: mt
405  integer(I4B) :: istat
406  integer(I4B) :: isize
407  ! -- code
408  !
409  ! -- check variable name length
410  call mem_check_length(name, lenvarname, "variable")
411  !
412  ! -- set isize
413  isize = nrow
414  !
415  ! -- allocate logical array
416  allocate (alog(nrow), stat=istat, errmsg=errmsg)
417  if (istat /= 0) then
418  call allocate_error(name, mem_path, istat, isize)
419  end if
420  !
421  ! -- update counter
422  nvalues_alogical = nvalues_alogical + isize
423  !
424  ! -- allocate memory type
425  allocate (mt)
426  !
427  ! -- set memory type
428  mt%alogical1d => alog
429  mt%element_size = lgp
430  mt%isize = isize
431  mt%name = name
432  mt%path = mem_path
433  write (mt%memtype, "(a,' (',i0,')')") 'LOGICAL', isize
434  !
435  ! -- add memory type to the memory list
436  call memorystore%add(mt)
Here is the caller graph for this function:

◆ allocate_str()

subroutine memorymanagermodule::allocate_str ( character(len=ilen), intent(inout), pointer  sclr,
integer(i4b), intent(in)  ilen,
character(len=*), intent(in)  name,
character(len=*), intent(in)  mem_path 
)
private
Parameters
[in]ilenstring length
[in,out]sclrvariable for allocation
[in]namevariable name
[in]mem_pathpath where the variable is stored

Definition at line 441 of file MemoryManager.f90.

442  integer(I4B), intent(in) :: ilen !< string length
443  character(len=ilen), pointer, intent(inout) :: sclr !< variable for allocation
444  character(len=*), intent(in) :: name !< variable name
445  character(len=*), intent(in) :: mem_path !< path where the variable is stored
446  ! -- local
447  integer(I4B) :: istat
448  type(MemoryType), pointer :: mt
449  ! -- format
450  ! -- code
451  !
452  ! -- make sure ilen is greater than 0
453  if (ilen < 1) then
454  errmsg = 'Programming error in allocate_str. ILEN must be greater than 0.'
455  call store_error(errmsg, terminate=.true.)
456  end if
457  !
458  ! -- check variable name length
459  call mem_check_length(name, lenvarname, "variable")
460  !
461  ! -- allocate string
462  allocate (character(len=ilen) :: sclr, stat=istat, errmsg=errmsg)
463  if (istat /= 0) then
464  call allocate_error(name, mem_path, istat, 1)
465  end if
466  !
467  ! -- set sclr to a empty string
468  sclr = ' '
469  !
470  ! -- update counter
471  nvalues_astr = nvalues_astr + ilen
472  !
473  ! -- allocate memory type
474  allocate (mt)
475  !
476  ! -- set memory type
477  mt%strsclr => sclr
478  mt%element_size = ilen
479  mt%isize = 1
480  mt%name = name
481  mt%path = mem_path
482  write (mt%memtype, "(a,' LEN=',i0)") 'STRING', ilen
483  !
484  ! -- add defined length string to the memory manager list
485  call memorystore%add(mt)

◆ allocate_str1d()

subroutine memorymanagermodule::allocate_str1d ( character(len=ilen), dimension(:), intent(inout), pointer, contiguous  astr1d,
integer(i4b), intent(in)  ilen,
integer(i4b), intent(in)  nrow,
character(len=*), intent(in)  name,
character(len=*), intent(in)  mem_path 
)
private
Parameters
[in]ilenstring length
[in,out]astr1dvariable for allocation
[in]nrownumber of strings in array
[in]namevariable name
[in]mem_pathpath where the variable is stored

Definition at line 490 of file MemoryManager.f90.

491  integer(I4B), intent(in) :: ilen !< string length
492  character(len=ilen), dimension(:), &
493  pointer, contiguous, intent(inout) :: astr1d !< variable for allocation
494  integer(I4B), intent(in) :: nrow !< number of strings in array
495  character(len=*), intent(in) :: name !< variable name
496  character(len=*), intent(in) :: mem_path !< path where the variable is stored
497  ! -- local variables
498  type(MemoryType), pointer :: mt
499  character(len=ilen) :: string
500  integer(I4B) :: n
501  integer(I4B) :: istat
502  integer(I4B) :: isize
503  ! -- code
504  !
505  ! -- initialize string
506  string = ''
507  !
508  ! -- make sure ilen is greater than 0
509  if (ilen < 1) then
510  errmsg = 'Programming error in allocate_str1d. '// &
511  'ILEN must be greater than 0.'
512  call store_error(errmsg, terminate=.true.)
513  end if
514  !
515  ! -- check variable name length
516  call mem_check_length(name, lenvarname, "variable")
517  !
518  ! -- calculate isize
519  isize = nrow
520  !
521  ! -- allocate defined length string array
522  allocate (character(len=ilen) :: astr1d(nrow), stat=istat, errmsg=errmsg)
523  !
524  ! -- check for error condition
525  if (istat /= 0) then
526  call allocate_error(name, mem_path, istat, isize)
527  end if
528  !
529  ! -- fill deferred length string with empty string
530  do n = 1, nrow
531  astr1d(n) = string
532  end do
533  !
534  ! -- update counter
535  nvalues_astr = nvalues_astr + isize
536  !
537  ! -- allocate memory type
538  allocate (mt)
539  !
540  ! -- set memory type
541  mt%astr1d => astr1d
542  mt%element_size = ilen
543  mt%isize = isize
544  mt%name = name
545  mt%path = mem_path
546  write (mt%memtype, "(a,' LEN=',i0,' (',i0,')')") 'STRING', ilen, nrow
547  !
548  ! -- add deferred length character array to the memory manager list
549  call memorystore%add(mt)

◆ calc_virtual_mem()

real(dp) function memorymanagermodule::calc_virtual_mem
private

Definition at line 2644 of file MemoryManager.f90.

2645  real(DP) :: vmem_size
2646  ! local
2647  type(MemoryContainerIteratorType), allocatable :: itr
2648  type(MemoryType), pointer :: mt
2649 
2650  vmem_size = dzero
2651  itr = memorystore%iterator()
2652  do while (itr%has_next())
2653  call itr%next()
2654  mt => itr%value()
2655  if (index(mt%path, "__P") == 1) then
2656  vmem_size = mt%element_size * mt%isize + vmem_size
2657  end if
2658  end do
2659 
Here is the caller graph for this function:

◆ checkin_charstr1d()

subroutine memorymanagermodule::checkin_charstr1d ( type(characterstringtype), dimension(:), intent(inout), pointer, contiguous  acharstr1d,
integer(i4b), intent(in)  ilen,
character(len=*), intent(in)  name,
character(len=*), intent(in)  mem_path,
character(len=*), intent(in)  name2,
character(len=*), intent(in)  mem_path2 
)
private
Parameters
[in,out]acharstr1dthe existing array
[in]namenew variable name
[in]mem_pathnew path where variable is stored
[in]name2existing variable name
[in]mem_path2existing path where variable is stored

Definition at line 1150 of file MemoryManager.f90.

1151  type(CharacterStringType), dimension(:), &
1152  pointer, contiguous, intent(inout) :: acharstr1d !< the existing array
1153  integer(I4B), intent(in) :: ilen
1154  character(len=*), intent(in) :: name !< new variable name
1155  character(len=*), intent(in) :: mem_path !< new path where variable is stored
1156  character(len=*), intent(in) :: name2 !< existing variable name
1157  character(len=*), intent(in) :: mem_path2 !< existing path where variable is stored
1158  ! --local
1159  type(MemoryType), pointer :: mt
1160  integer(I4B) :: isize
1161  ! -- code
1162  !
1163  ! -- check variable name length
1164  call mem_check_length(name, lenvarname, "variable")
1165  !
1166  ! -- set isize
1167  isize = size(acharstr1d)
1168  !
1169  ! -- allocate memory type
1170  allocate (mt)
1171  !
1172  ! -- set memory type
1173  mt%acharstr1d => acharstr1d
1174  mt%element_size = ilen
1175  mt%isize = isize
1176  mt%name = name
1177  mt%path = mem_path
1178  write (mt%memtype, "(a,' LEN=',i0,' (',i0,')')") 'STRING', ilen, isize
1179  !
1180  ! -- set master information
1181  mt%master = .false.
1182  mt%mastername = name2
1183  mt%masterPath = mem_path2
1184  !
1185  ! -- add memory type to the memory list
1186  call memorystore%add(mt)

◆ checkin_dbl1d()

subroutine memorymanagermodule::checkin_dbl1d ( real(dp), dimension(:), intent(inout), pointer, contiguous  adbl,
character(len=*), intent(in)  name,
character(len=*), intent(in)  mem_path,
character(len=*), intent(in)  name2,
character(len=*), intent(in)  mem_path2 
)
private
Parameters
[in,out]adblthe existing array
[in]namenew variable name
[in]mem_pathnew path where variable is stored
[in]name2existing variable name
[in]mem_path2existing path where variable is stored

Definition at line 1071 of file MemoryManager.f90.

1072  real(DP), dimension(:), pointer, contiguous, intent(inout) :: adbl !< the existing array
1073  character(len=*), intent(in) :: name !< new variable name
1074  character(len=*), intent(in) :: mem_path !< new path where variable is stored
1075  character(len=*), intent(in) :: name2 !< existing variable name
1076  character(len=*), intent(in) :: mem_path2 !< existing path where variable is stored
1077  ! -- local
1078  type(MemoryType), pointer :: mt
1079  integer(I4B) :: isize
1080  ! -- code
1081  !
1082  ! -- check the variable name length
1083  call mem_check_length(name, lenvarname, "variable")
1084  !
1085  ! -- set isize
1086  isize = size(adbl)
1087  !
1088  ! -- allocate memory type
1089  allocate (mt)
1090  !
1091  ! -- set memory type
1092  mt%adbl1d => adbl
1093  mt%element_size = dp
1094  mt%isize = isize
1095  mt%name = name
1096  mt%path = mem_path
1097  write (mt%memtype, "(a,' (',i0,')')") 'DOUBLE', isize
1098  !
1099  ! -- set master information
1100  mt%master = .false.
1101  mt%mastername = name2
1102  mt%masterPath = mem_path2
1103  !
1104  ! -- add memory type to the memory list
1105  call memorystore%add(mt)

◆ checkin_dbl2d()

subroutine memorymanagermodule::checkin_dbl2d ( real(dp), dimension(:, :), intent(inout), pointer, contiguous  adbl2d,
character(len=*), intent(in)  name,
character(len=*), intent(in)  mem_path,
character(len=*), intent(in)  name2,
character(len=*), intent(in)  mem_path2 
)
private
Parameters
[in,out]adbl2dthe existing 2d array
[in]namenew variable name
[in]mem_pathnew path where variable is stored
[in]name2existing variable name
[in]mem_path2existing path where variable is stored

Definition at line 1110 of file MemoryManager.f90.

1111  real(DP), dimension(:, :), pointer, contiguous, intent(inout) :: adbl2d !< the existing 2d array
1112  character(len=*), intent(in) :: name !< new variable name
1113  character(len=*), intent(in) :: mem_path !< new path where variable is stored
1114  character(len=*), intent(in) :: name2 !< existing variable name
1115  character(len=*), intent(in) :: mem_path2 !< existing path where variable is stored
1116  ! -- local
1117  type(MemoryType), pointer :: mt
1118  integer(I4B) :: ncol, nrow, isize
1119  ! -- code
1120  !
1121  ! -- check the variable name length
1122  call mem_check_length(name, lenvarname, "variable")
1123  !
1124  ! -- set isize
1125  ncol = size(adbl2d, dim=1)
1126  nrow = size(adbl2d, dim=2)
1127  isize = ncol * nrow
1128  !
1129  ! -- allocate memory type
1130  allocate (mt)
1131  !
1132  ! -- set memory type
1133  mt%adbl2d => adbl2d
1134  mt%isize = isize
1135  mt%name = name
1136  mt%path = mem_path
1137  write (mt%memtype, "(a,' (',i0,',',i0,')')") 'DOUBLE', ncol, nrow
1138  !
1139  ! -- set master information
1140  mt%master = .false.
1141  mt%mastername = name2
1142  mt%masterPath = mem_path2
1143  !
1144  ! -- add memory type to the memory list
1145  call memorystore%add(mt)

◆ checkin_int1d()

subroutine memorymanagermodule::checkin_int1d ( integer(i4b), dimension(:), intent(in), pointer, contiguous  aint,
character(len=*), intent(in)  name,
character(len=*), intent(in)  mem_path,
character(len=*), intent(in)  name2,
character(len=*), intent(in)  mem_path2 
)
private
Parameters
[in]aintthe existing array
[in]namenew variable name
[in]mem_pathnew path where variable is stored
[in]name2existing variable name
[in]mem_path2existing path where variable is stored

Definition at line 992 of file MemoryManager.f90.

993  integer(I4B), dimension(:), pointer, contiguous, intent(in) :: aint !< the existing array
994  character(len=*), intent(in) :: name !< new variable name
995  character(len=*), intent(in) :: mem_path !< new path where variable is stored
996  character(len=*), intent(in) :: name2 !< existing variable name
997  character(len=*), intent(in) :: mem_path2 !< existing path where variable is stored
998  ! --local
999  type(MemoryType), pointer :: mt
1000  integer(I4B) :: isize
1001  ! -- code
1002  !
1003  ! -- check variable name length
1004  call mem_check_length(name, lenvarname, "variable")
1005  !
1006  ! -- set isize
1007  isize = size(aint)
1008  !
1009  ! -- allocate memory type
1010  allocate (mt)
1011  !
1012  ! -- set memory type
1013  mt%aint1d => aint
1014  mt%element_size = i4b
1015  mt%isize = isize
1016  mt%name = name
1017  mt%path = mem_path
1018  write (mt%memtype, "(a,' (',i0,')')") 'INTEGER', isize
1019  !
1020  ! -- set master information
1021  mt%master = .false.
1022  mt%mastername = name2
1023  mt%masterPath = mem_path2
1024  !
1025  ! -- add memory type to the memory list
1026  call memorystore%add(mt)

◆ checkin_int2d()

subroutine memorymanagermodule::checkin_int2d ( integer(i4b), dimension(:, :), intent(inout), pointer, contiguous  aint2d,
character(len=*), intent(in)  name,
character(len=*), intent(in)  mem_path,
character(len=*), intent(in)  name2,
character(len=*), intent(in)  mem_path2 
)
private
Parameters
[in,out]aint2dthe existing 2d array
[in]namenew variable name
[in]mem_pathnew path where variable is stored
[in]name2existing variable name
[in]mem_path2existing path where variable is stored

Definition at line 1031 of file MemoryManager.f90.

1032  integer(I4B), dimension(:, :), pointer, contiguous, intent(inout) :: aint2d !< the existing 2d array
1033  character(len=*), intent(in) :: name !< new variable name
1034  character(len=*), intent(in) :: mem_path !< new path where variable is stored
1035  character(len=*), intent(in) :: name2 !< existing variable name
1036  character(len=*), intent(in) :: mem_path2 !< existing path where variable is stored
1037  ! -- local
1038  type(MemoryType), pointer :: mt
1039  integer(I4B) :: ncol, nrow, isize
1040  ! -- code
1041  !
1042  ! -- check the variable name length
1043  call mem_check_length(name, lenvarname, "variable")
1044  !
1045  ! -- set isize
1046  ncol = size(aint2d, dim=1)
1047  nrow = size(aint2d, dim=2)
1048  isize = ncol * nrow
1049  !
1050  ! -- allocate memory type
1051  allocate (mt)
1052  !
1053  ! -- set memory type
1054  mt%aint2d => aint2d
1055  mt%isize = isize
1056  mt%name = name
1057  mt%path = mem_path
1058  write (mt%memtype, "(a,' (',i0,',',i0,')')") 'INTEGER', ncol, nrow
1059  !
1060  ! -- set master information
1061  mt%master = .false.
1062  mt%mastername = name2
1063  mt%masterPath = mem_path2
1064  !
1065  ! -- add memory type to the memory list
1066  call memorystore%add(mt)

◆ checkin_logical1d()

subroutine memorymanagermodule::checkin_logical1d ( logical(lgp), dimension(:), intent(in), pointer, contiguous  alog,
character(len=*), intent(in)  name,
character(len=*), intent(in)  mem_path,
character(len=*), intent(in)  name2,
character(len=*), intent(in)  mem_path2 
)
private
Parameters
[in]alogthe existing array
[in]namenew variable name
[in]mem_pathnew path where variable is stored
[in]name2existing variable name
[in]mem_path2existing path where variable is stored

Definition at line 953 of file MemoryManager.f90.

954  logical(LGP), dimension(:), pointer, contiguous, intent(in) :: alog !< the existing array
955  character(len=*), intent(in) :: name !< new variable name
956  character(len=*), intent(in) :: mem_path !< new path where variable is stored
957  character(len=*), intent(in) :: name2 !< existing variable name
958  character(len=*), intent(in) :: mem_path2 !< existing path where variable is stored
959  ! --local
960  type(MemoryType), pointer :: mt
961  integer(I4B) :: isize
962  ! -- code
963  !
964  ! -- check variable name length
965  call mem_check_length(name, lenvarname, "variable")
966  !
967  ! -- set isize
968  isize = size(alog)
969  !
970  ! -- allocate memory type
971  allocate (mt)
972  !
973  ! -- set memory type
974  mt%alogical1d => alog
975  mt%element_size = lgp
976  mt%isize = isize
977  mt%name = name
978  mt%path = mem_path
979  write (mt%memtype, "(a,' (',i0,')')") 'LOGICAL', isize
980  !
981  ! -- set master information
982  mt%master = .false.
983  mt%mastername = name2
984  mt%masterPath = mem_path2
985  !
986  ! -- add memory type to the memory list
987  call memorystore%add(mt)

◆ copy_dbl1d()

subroutine, public memorymanagermodule::copy_dbl1d ( real(dp), dimension(:), intent(inout)  adbl,
character(len=*), intent(in)  name,
character(len=*), intent(in)  mem_path 
)
Parameters
[in,out]adbltarget array
[in]namevariable name
[in]mem_pathpath where variable is stored

Definition at line 1933 of file MemoryManager.f90.

1934  real(DP), dimension(:), intent(inout) :: adbl !< target array
1935  character(len=*), intent(in) :: name !< variable name
1936  character(len=*), intent(in) :: mem_path !< path where variable is stored
1937  ! -- local
1938  type(MemoryType), pointer :: mt
1939  logical(LGP) :: found
1940  integer(I4B) :: n
1941  ! -- code
1942  call get_from_memorystore(name, mem_path, mt, found)
1943  do n = 1, size(mt%adbl1d)
1944  adbl(n) = mt%adbl1d(n)
1945  end do
Here is the call graph for this function:

◆ copyptr_dbl1d()

subroutine memorymanagermodule::copyptr_dbl1d ( real(dp), dimension(:), intent(inout), pointer, contiguous  adbl,
character(len=*), intent(in)  name,
character(len=*), intent(in)  mem_path,
character(len=*), intent(in), optional  mem_path_copy 
)
private
Parameters
[in,out]adblreturned copy of 1d real array
[in]namevariable name
[in]mem_pathpath where variable is stored
[in]mem_path_copyoptional path where the copy will be stored, if passed then the copy is added to the memory manager

Definition at line 1870 of file MemoryManager.f90.

1871  real(DP), dimension(:), pointer, contiguous, intent(inout) :: adbl !< returned copy of 1d real array
1872  character(len=*), intent(in) :: name !< variable name
1873  character(len=*), intent(in) :: mem_path !< path where variable is stored
1874  character(len=*), intent(in), optional :: mem_path_copy !< optional path where the copy will be stored,
1875  !! if passed then the copy is added to the
1876  !! memory manager
1877  ! -- local
1878  type(MemoryType), pointer :: mt
1879  logical(LGP) :: found
1880  integer(I4B) :: n
1881  ! -- code
1882  call get_from_memorystore(name, mem_path, mt, found)
1883  adbl => null()
1884  ! -- check the copy into the memory manager
1885  if (present(mem_path_copy)) then
1886  call allocate_dbl1d(adbl, size(mt%adbl1d), mt%name, mem_path_copy)
1887  ! -- create a local copy
1888  else
1889  allocate (adbl(size(mt%adbl1d)))
1890  end if
1891  do n = 1, size(mt%adbl1d)
1892  adbl(n) = mt%adbl1d(n)
1893  end do

◆ copyptr_dbl2d()

subroutine memorymanagermodule::copyptr_dbl2d ( real(dp), dimension(:, :), intent(inout), pointer, contiguous  adbl,
character(len=*), intent(in)  name,
character(len=*), intent(in)  mem_path,
character(len=*), intent(in), optional  mem_path_copy 
)
private
Parameters
[in,out]adblreturned copy of 2d real array
[in]namevariable name
[in]mem_pathpath where variable is stored
[in]mem_path_copyoptional path where the copy will be stored, if passed then the copy is added to the memory manager

Definition at line 1898 of file MemoryManager.f90.

1899  real(DP), dimension(:, :), pointer, contiguous, intent(inout) :: adbl !< returned copy of 2d real array
1900  character(len=*), intent(in) :: name !< variable name
1901  character(len=*), intent(in) :: mem_path !< path where variable is stored
1902  character(len=*), intent(in), optional :: mem_path_copy !< optional path where the copy will be stored,
1903  !! if passed then the copy is added to the
1904  !! memory manager
1905  ! -- local
1906  type(MemoryType), pointer :: mt
1907  logical(LGP) :: found
1908  integer(I4B) :: i
1909  integer(I4B) :: j
1910  integer(I4B) :: ncol
1911  integer(I4B) :: nrow
1912  ! -- code
1913  call get_from_memorystore(name, mem_path, mt, found)
1914  adbl => null()
1915  ncol = size(mt%adbl2d, dim=1)
1916  nrow = size(mt%adbl2d, dim=2)
1917  ! -- check the copy into the memory manager
1918  if (present(mem_path_copy)) then
1919  call allocate_dbl2d(adbl, ncol, nrow, mt%name, mem_path_copy)
1920  ! -- create a local copy
1921  else
1922  allocate (adbl(ncol, nrow))
1923  end if
1924  do i = 1, nrow
1925  do j = 1, ncol
1926  adbl(j, i) = mt%adbl2d(j, i)
1927  end do
1928  end do

◆ copyptr_int1d()

subroutine memorymanagermodule::copyptr_int1d ( integer(i4b), dimension(:), intent(inout), pointer, contiguous  aint,
character(len=*), intent(in)  name,
character(len=*), intent(in)  mem_path,
character(len=*), intent(in), optional  mem_path_copy 
)
private
Parameters
[in,out]aintreturned copy of 1d integer array
[in]namevariable name
[in]mem_pathpath where variable is stored
[in]mem_path_copyoptional path where the copy will be stored, if passed then the copy is added to the memory manager

Definition at line 1807 of file MemoryManager.f90.

1808  integer(I4B), dimension(:), pointer, contiguous, intent(inout) :: aint !< returned copy of 1d integer array
1809  character(len=*), intent(in) :: name !< variable name
1810  character(len=*), intent(in) :: mem_path !< path where variable is stored
1811  character(len=*), intent(in), optional :: mem_path_copy !< optional path where the copy will be stored,
1812  !! if passed then the copy is added to the
1813  !! memory manager
1814  ! -- local
1815  type(MemoryType), pointer :: mt
1816  logical(LGP) :: found
1817  integer(I4B) :: n
1818  ! -- code
1819  call get_from_memorystore(name, mem_path, mt, found)
1820  aint => null()
1821  ! -- check the copy into the memory manager
1822  if (present(mem_path_copy)) then
1823  call allocate_int1d(aint, size(mt%aint1d), mt%name, mem_path_copy)
1824  ! -- create a local copy
1825  else
1826  allocate (aint(size(mt%aint1d)))
1827  end if
1828  do n = 1, size(mt%aint1d)
1829  aint(n) = mt%aint1d(n)
1830  end do

◆ copyptr_int2d()

subroutine memorymanagermodule::copyptr_int2d ( integer(i4b), dimension(:, :), intent(inout), pointer, contiguous  aint,
character(len=*), intent(in)  name,
character(len=*), intent(in)  mem_path,
character(len=*), intent(in), optional  mem_path_copy 
)
private
Parameters
[in,out]aintreturned copy of 2d integer array
[in]namevariable name
[in]mem_pathpath where variable is stored
[in]mem_path_copyoptional path where the copy will be stored, if passed then the copy is added to the memory manager

Definition at line 1835 of file MemoryManager.f90.

1836  integer(I4B), dimension(:, :), pointer, contiguous, intent(inout) :: aint !< returned copy of 2d integer array
1837  character(len=*), intent(in) :: name !< variable name
1838  character(len=*), intent(in) :: mem_path !< path where variable is stored
1839  character(len=*), intent(in), optional :: mem_path_copy !< optional path where the copy will be stored,
1840  !! if passed then the copy is added to the
1841  !! memory manager
1842  ! -- local
1843  type(MemoryType), pointer :: mt
1844  logical(LGP) :: found
1845  integer(I4B) :: i
1846  integer(I4B) :: j
1847  integer(I4B) :: ncol
1848  integer(I4B) :: nrow
1849  ! -- code
1850  call get_from_memorystore(name, mem_path, mt, found)
1851  aint => null()
1852  ncol = size(mt%aint2d, dim=1)
1853  nrow = size(mt%aint2d, dim=2)
1854  ! -- check the copy into the memory manager
1855  if (present(mem_path_copy)) then
1856  call allocate_int2d(aint, ncol, nrow, mt%name, mem_path_copy)
1857  ! -- create a local copy
1858  else
1859  allocate (aint(ncol, nrow))
1860  end if
1861  do i = 1, nrow
1862  do j = 1, ncol
1863  aint(j, i) = mt%aint2d(j, i)
1864  end do
1865  end do

◆ copyptr_logical1d()

subroutine memorymanagermodule::copyptr_logical1d ( logical(lgp), dimension(:), intent(inout), pointer, contiguous  alog,
character(len=*), intent(in)  name,
character(len=*), intent(in)  mem_path,
character(len=*), intent(in), optional  mem_path_copy 
)
private
Parameters
[in,out]alogreturned copy of 1d logical array
[in]namevariable name
[in]mem_pathpath where variable is stored
[in]mem_path_copyoptional path where the copy will be stored, if passed then the copy is added to the memory manager

Definition at line 1779 of file MemoryManager.f90.

1780  logical(LGP), dimension(:), pointer, contiguous, intent(inout) :: alog !< returned copy of 1d logical array
1781  character(len=*), intent(in) :: name !< variable name
1782  character(len=*), intent(in) :: mem_path !< path where variable is stored
1783  character(len=*), intent(in), optional :: mem_path_copy !< optional path where the copy will be stored,
1784  !! if passed then the copy is added to the
1785  !! memory manager
1786  ! -- local
1787  type(MemoryType), pointer :: mt
1788  logical(LGP) :: found
1789  integer(I4B) :: n
1790  ! -- code
1791  call get_from_memorystore(name, mem_path, mt, found)
1792  alog => null()
1793  ! -- check the copy into the memory manager
1794  if (present(mem_path_copy)) then
1795  call allocate_logical1d(alog, size(mt%alogical1d), mt%name, mem_path_copy)
1796  ! -- create a local copy
1797  else
1798  allocate (alog(size(mt%alogical1d)))
1799  end if
1800  do n = 1, size(mt%alogical1d)
1801  alog(n) = mt%alogical1d(n)
1802  end do

◆ deallocate_charstr1d()

subroutine memorymanagermodule::deallocate_charstr1d ( type(characterstringtype), dimension(:), intent(inout), pointer, contiguous  astr1d,
character(len=*), intent(in), optional  name,
character(len=*), intent(in), optional  mem_path 
)
private
Parameters
[in,out]astr1darray of strings
[in]namevariable name
[in]mem_pathpath where variable is stored

Definition at line 2168 of file MemoryManager.f90.

2169  type(CharacterStringType), dimension(:), pointer, contiguous, &
2170  intent(inout) :: astr1d !< array of strings
2171  character(len=*), optional, intent(in) :: name !< variable name
2172  character(len=*), optional, intent(in) :: mem_path !< path where variable is stored
2173  ! -- code
2174  return

◆ deallocate_dbl()

subroutine memorymanagermodule::deallocate_dbl ( real(dp), intent(inout), pointer  sclr)
private
Parameters
[in,out]sclrreal variable to deallocate

Definition at line 2195 of file MemoryManager.f90.

2196  real(DP), pointer, intent(inout) :: sclr !< real variable to deallocate
2197  ! -- code
2198  return

◆ deallocate_dbl1d()

subroutine memorymanagermodule::deallocate_dbl1d ( real(dp), dimension(:), intent(inout), pointer, contiguous  adbl,
character(len=*), optional  name,
character(len=*), optional  mem_path 
)
private
Parameters
[in,out]adbl1d real array to deallocate
namevariable name
mem_pathpath where variable is stored

Definition at line 2243 of file MemoryManager.f90.

2244  real(DP), dimension(:), pointer, contiguous, intent(inout) :: adbl !< 1d real array to deallocate
2245  character(len=*), optional :: name !< variable name
2246  character(len=*), optional :: mem_path !< path where variable is stored
2247  ! -- code
2248  return

◆ deallocate_dbl2d()

subroutine memorymanagermodule::deallocate_dbl2d ( real(dp), dimension(:, :), intent(inout), pointer, contiguous  adbl,
character(len=*), optional  name,
character(len=*), optional  mem_path 
)
private
Parameters
[in,out]adbl2d real array to deallocate
namevariable name
mem_pathpath where variable is stored

Definition at line 2253 of file MemoryManager.f90.

2254  real(DP), dimension(:, :), pointer, contiguous, intent(inout) :: adbl !< 2d real array to deallocate
2255  character(len=*), optional :: name !< variable name
2256  character(len=*), optional :: mem_path !< path where variable is stored
2257  ! -- code
2258  return

◆ deallocate_dbl3d()

subroutine memorymanagermodule::deallocate_dbl3d ( real(dp), dimension(:, :, :), intent(inout), pointer, contiguous  adbl,
character(len=*), optional  name,
character(len=*), optional  mem_path 
)
private
Parameters
[in,out]adbl3d real array to deallocate
namevariable name
mem_pathpath where variable is stored

Definition at line 2263 of file MemoryManager.f90.

2264  real(DP), dimension(:, :, :), pointer, contiguous, intent(inout) :: adbl !< 3d real array to deallocate
2265  character(len=*), optional :: name !< variable name
2266  character(len=*), optional :: mem_path !< path where variable is stored
2267  ! -- code
2268  return

◆ deallocate_int()

subroutine memorymanagermodule::deallocate_int ( integer(i4b), intent(inout), pointer  sclr)
private
Parameters
[in,out]sclrinteger variable to deallocate

Definition at line 2187 of file MemoryManager.f90.

2188  integer(I4B), pointer, intent(inout) :: sclr !< integer variable to deallocate
2189  ! -- code
2190  return

◆ deallocate_int1d()

subroutine memorymanagermodule::deallocate_int1d ( integer(i4b), dimension(:), intent(inout), pointer, contiguous  aint,
character(len=*), optional  name,
character(len=*), optional  mem_path 
)
private
Parameters
[in,out]aint1d integer array to deallocate
namevariable name
mem_pathpath where variable is stored

Definition at line 2213 of file MemoryManager.f90.

2214  integer(I4B), dimension(:), pointer, contiguous, intent(inout) :: aint !< 1d integer array to deallocate
2215  character(len=*), optional :: name !< variable name
2216  character(len=*), optional :: mem_path !< path where variable is stored
2217  ! -- code
2218  return

◆ deallocate_int2d()

subroutine memorymanagermodule::deallocate_int2d ( integer(i4b), dimension(:, :), intent(inout), pointer, contiguous  aint,
character(len=*), optional  name,
character(len=*), optional  mem_path 
)
private
Parameters
[in,out]aint2d integer array to deallocate
namevariable name
mem_pathpath where variable is stored

Definition at line 2223 of file MemoryManager.f90.

2224  integer(I4B), dimension(:, :), pointer, contiguous, intent(inout) :: aint !< 2d integer array to deallocate
2225  character(len=*), optional :: name !< variable name
2226  character(len=*), optional :: mem_path !< path where variable is stored
2227  ! -- code
2228  return

◆ deallocate_int3d()

subroutine memorymanagermodule::deallocate_int3d ( integer(i4b), dimension(:, :, :), intent(inout), pointer, contiguous  aint,
character(len=*), optional  name,
character(len=*), optional  mem_path 
)
private
Parameters
[in,out]aint3d integer array to deallocate
namevariable name
mem_pathpath where variable is stored

Definition at line 2233 of file MemoryManager.f90.

2234  integer(I4B), dimension(:, :, :), pointer, contiguous, intent(inout) :: aint !< 3d integer array to deallocate
2235  character(len=*), optional :: name !< variable name
2236  character(len=*), optional :: mem_path !< path where variable is stored
2237  ! -- code
2238  return

◆ deallocate_logical()

subroutine memorymanagermodule::deallocate_logical ( logical(lgp), intent(inout), pointer  sclr)
private
Parameters
[in,out]sclrlogical scalar to deallocate

Definition at line 2179 of file MemoryManager.f90.

2180  logical(LGP), pointer, intent(inout) :: sclr !< logical scalar to deallocate
2181  ! -- code
2182  return

◆ deallocate_logical1d()

subroutine memorymanagermodule::deallocate_logical1d ( logical(lgp), dimension(:), intent(inout), pointer, contiguous  alog,
character(len=*), optional  name,
character(len=*), optional  mem_path 
)
private
Parameters
[in,out]alog1d logical array to deallocate
namevariable name
mem_pathpath where variable is stored

Definition at line 2203 of file MemoryManager.f90.

2204  logical(LGP), dimension(:), pointer, contiguous, intent(inout) :: alog !< 1d logical array to deallocate
2205  character(len=*), optional :: name !< variable name
2206  character(len=*), optional :: mem_path !< path where variable is stored
2207  ! -- code
2208  return

◆ deallocate_str()

subroutine memorymanagermodule::deallocate_str ( character(len=*), intent(inout), pointer  sclr,
character(len=*), intent(in), optional  name,
character(len=*), intent(in), optional  mem_path 
)
private
Parameters
[in,out]sclrpointer to string
[in]namevariable name
[in]mem_pathpath where variable is stored

Definition at line 2145 of file MemoryManager.f90.

2146  character(len=*), pointer, intent(inout) :: sclr !< pointer to string
2147  character(len=*), intent(in), optional :: name !< variable name
2148  character(len=*), intent(in), optional :: mem_path !< path where variable is stored
2149  ! -- code
2150  return

◆ deallocate_str1d()

subroutine memorymanagermodule::deallocate_str1d ( character(len=*), dimension(:), intent(inout), pointer, contiguous  astr1d,
character(len=*), intent(in), optional  name,
character(len=*), intent(in), optional  mem_path 
)
private
Parameters
[in,out]astr1darray of strings
[in]namevariable name
[in]mem_pathpath where variable is stored

Definition at line 2156 of file MemoryManager.f90.

2157  character(len=*), dimension(:), pointer, contiguous, intent(inout) :: astr1d !< array of strings
2158  character(len=*), optional, intent(in) :: name !< variable name
2159  character(len=*), optional, intent(in) :: mem_path !< path where variable is stored
2160  ! -- code
2161  return
2162 

◆ get_from_memorystore()

subroutine, public memorymanagermodule::get_from_memorystore ( character(len=*), intent(in)  name,
character(len=*), intent(in)  mem_path,
type(memorytype), intent(inout), pointer  mt,
logical(lgp), intent(out)  found,
logical(lgp), intent(in), optional  check 
)

Default value for

check is .true. which means that this
routine will kill the program when the memory entry cannot be found.
Parameters
[in]namevariable name
[in]mem_pathpath where the variable is stored
[in,out]mtmemory type entry
[out]foundset to .true. when found
[in]checkto suppress aborting the program when not found, set check = .false.

Definition at line 305 of file MemoryManager.f90.

306  character(len=*), intent(in) :: name !< variable name
307  character(len=*), intent(in) :: mem_path !< path where the variable is stored
308  type(MemoryType), pointer, intent(inout) :: mt !< memory type entry
309  logical(LGP), intent(out) :: found !< set to .true. when found
310  logical(LGP), intent(in), optional :: check !< to suppress aborting the program when not found,
311  !! set check = .false.
312  ! -- local
313  logical(LGP) check_opt
314  ! -- code
315  mt => memorystore%get(name, mem_path)
316  found = associated(mt)
317 
318  check_opt = .true.
319  if (present(check)) then
320  check_opt = check
321  end if
322  if (check_opt) then
323  if (.not. found) then
324  errmsg = "Programming error in memory manager. Variable '"// &
325  trim(name)//"' in '"//trim(mem_path)//"' cannot be "// &
326  "assigned because it does not exist in memory manager."
327  call store_error(errmsg, terminate=.true.)
328  end if
329  end if
Here is the call graph for this function:

◆ get_isize()

subroutine, public memorymanagermodule::get_isize ( character(len=*), intent(in)  name,
character(len=*), intent(in)  mem_path,
integer(i4b), intent(out)  isize 
)

Returns with isize = -1 when not found. Return 1 for scalars.

Parameters
[in]namevariable name
[in]mem_pathpath where the variable is stored
[out]isizenumber of elements (flattened)

Definition at line 275 of file MemoryManager.f90.

276  character(len=*), intent(in) :: name !< variable name
277  character(len=*), intent(in) :: mem_path !< path where the variable is stored
278  integer(I4B), intent(out) :: isize !< number of elements (flattened)
279  ! -- local
280  type(MemoryType), pointer :: mt => null()
281  logical(LGP) :: found
282  logical(LGP) :: terminate
283  ! -- code
284  !
285  ! -- initialize isize to a value to communicate failure
286  isize = -1
287  !
288  ! -- don't exit program if variable not found
289  terminate = .false.
290  !
291  ! -- get the entry from the memory manager
292  call get_from_memorystore(name, mem_path, mt, found, terminate)
293  !
294  ! -- set isize
295  if (found) then
296  isize = mt%isize
297  end if
Here is the call graph for this function:

◆ get_mem_elem_size()

subroutine, public memorymanagermodule::get_mem_elem_size ( character(len=*), intent(in)  name,
character(len=*), intent(in)  mem_path,
integer(i4b), intent(out)  size 
)

Memory size in bytes, returns size = -1 when not found. This is

Parameters
[in]namevariable name
[in]mem_pathpath where the variable is stored
[out]sizesize of the variable in bytes

Definition at line 211 of file MemoryManager.f90.

212  character(len=*), intent(in) :: name !< variable name
213  character(len=*), intent(in) :: mem_path !< path where the variable is stored
214  integer(I4B), intent(out) :: size !< size of the variable in bytes
215  ! -- local
216  type(MemoryType), pointer :: mt => null()
217  logical(LGP) :: found
218  ! -- code
219  !
220  ! -- initialize size to a value to communicate failure
221  size = -1
222  !
223  ! -- get the entry from the memory manager
224  call get_from_memorystore(name, mem_path, mt, found)
225  !
226  ! -- set memory size
227  if (found) then
228  size = mt%element_size
229  end if
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_mem_rank()

subroutine, public memorymanagermodule::get_mem_rank ( character(len=*), intent(in)  name,
character(len=*), intent(in)  mem_path,
integer(i4b), intent(out)  rank 
)

Returns rank = -1 when not found.

Parameters
[in]namevariable name

Definition at line 173 of file MemoryManager.f90.

174  character(len=*), intent(in) :: name !< variable name
175  character(len=*), intent(in) :: mem_path !< mem_path
176  integer(I4B), intent(out) :: rank !< rank
177  ! -- local
178  type(MemoryType), pointer :: mt => null()
179  logical(LGP) :: found
180  ! -- code
181  !
182  ! -- initialize rank to a value to communicate failure
183  rank = -1
184  !
185  ! -- get the entry from the memory manager; check=.false. so a missing
186  ! variable returns rank=-1 instead of terminating
187  call get_from_memorystore(name, mem_path, mt, found, check=.false.)
188  !
189  ! -- set rank
190  if (found) then
191  if (associated(mt%logicalsclr)) rank = 0
192  if (associated(mt%intsclr)) rank = 0
193  if (associated(mt%dblsclr)) rank = 0
194  if (associated(mt%alogical1d)) rank = 1
195  if (associated(mt%aint1d)) rank = 1
196  if (associated(mt%aint2d)) rank = 2
197  if (associated(mt%aint3d)) rank = 3
198  if (associated(mt%adbl1d)) rank = 1
199  if (associated(mt%adbl2d)) rank = 2
200  if (associated(mt%adbl3d)) rank = 3
201  if (associated(mt%strsclr)) rank = 0
202  if (associated(mt%astr1d)) rank = 1
203  if (associated(mt%acharstr1d)) rank = 1
204  end if
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_mem_shape()

subroutine, public memorymanagermodule::get_mem_shape ( character(len=*), intent(in)  name,
character(len=*), intent(in)  mem_path,
integer(i4b), dimension(:), intent(out)  mem_shape 
)

Returns an integer array with the shape (Fortran ordering), and set shape(1) = -1 when not found.

Parameters
[in]namevariable name
[in]mem_pathpath where the variable is stored
[out]mem_shapeshape of the variable

Definition at line 237 of file MemoryManager.f90.

238  character(len=*), intent(in) :: name !< variable name
239  character(len=*), intent(in) :: mem_path !< path where the variable is stored
240  integer(I4B), dimension(:), intent(out) :: mem_shape !< shape of the variable
241  ! -- local
242  type(MemoryType), pointer :: mt => null()
243  logical(LGP) :: found
244  ! -- code
245  !
246  ! -- get the entry from the memory manager
247  call get_from_memorystore(name, mem_path, mt, found)
248  !
249  ! -- set shape
250  if (found) then
251  if (associated(mt%logicalsclr)) mem_shape = shape(mt%logicalsclr)
252  if (associated(mt%intsclr)) mem_shape = shape(mt%logicalsclr)
253  if (associated(mt%dblsclr)) mem_shape = shape(mt%dblsclr)
254  if (associated(mt%alogical1d)) mem_shape = shape(mt%alogical1d)
255  if (associated(mt%aint1d)) mem_shape = shape(mt%aint1d)
256  if (associated(mt%aint2d)) mem_shape = shape(mt%aint2d)
257  if (associated(mt%aint3d)) mem_shape = shape(mt%aint3d)
258  if (associated(mt%adbl1d)) mem_shape = shape(mt%adbl1d)
259  if (associated(mt%adbl2d)) mem_shape = shape(mt%adbl2d)
260  if (associated(mt%adbl3d)) mem_shape = shape(mt%adbl3d)
261  if (associated(mt%strsclr)) mem_shape = shape(mt%strsclr)
262  if (associated(mt%astr1d)) mem_shape = shape(mt%astr1d)
263  if (associated(mt%acharstr1d)) mem_shape = shape(mt%acharstr1d)
264  ! -- to communicate failure
265  else
266  mem_shape(1) = -1
267  end if
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_mem_type()

subroutine, public memorymanagermodule::get_mem_type ( character(len=*), intent(in)  name,
character(len=*), intent(in)  mem_path,
character(len=lenmemtype), intent(out)  var_type 
)

Returns any of 'LOGICAL', 'INTEGER', 'DOUBLE', 'STRING'. returns 'UNKNOWN' when the variable is not found.

Parameters
[in]namevariable name
[in]mem_pathpath where the variable is stored
[out]var_typememory type

Definition at line 153 of file MemoryManager.f90.

154  character(len=*), intent(in) :: name !< variable name
155  character(len=*), intent(in) :: mem_path !< path where the variable is stored
156  character(len=LENMEMTYPE), intent(out) :: var_type !< memory type
157  ! -- local
158  type(MemoryType), pointer :: mt
159  logical(LGP) :: found
160  ! -- code
161  mt => null()
162  var_type = 'UNKNOWN'
163  call get_from_memorystore(name, mem_path, mt, found)
164  if (found) then
165  var_type = mt%memtype
166  end if
Here is the call graph for this function:
Here is the caller graph for this function:

◆ mem_cleanup_table()

subroutine memorymanagermodule::mem_cleanup_table
private

Definition at line 2515 of file MemoryManager.f90.

2516  ! -- local
2517  ! -- formats
2518  ! -- code
2519  call memtab%table_da()
2520  deallocate (memtab)
2521  nullify (memtab)
Here is the caller graph for this function:

◆ mem_da()

subroutine, public memorymanagermodule::mem_da

Definition at line 2699 of file MemoryManager.f90.

2700  ! -- modules
2701  use versionmodule, only: idevelopmode
2702  ! -- local
2703  class(MemoryType), pointer :: mt
2704  type(MemoryContainerIteratorType), allocatable :: itr
2705  ! -- code
2706  itr = memorystore%iterator()
2707  do while (itr%has_next())
2708  call itr%next()
2709  mt => itr%value()
2710  call mt%mt_deallocate()
2711  if (idevelopmode == 1) call mem_da_check(mt)
2712  deallocate (mt)
2713  end do
2714 
2715  call memorystore%clear()
2716  if (count_errors() > 0) then
2717  call store_error('Could not clear memory list.', terminate=.true.)
2718  end if
This module contains version information.
Definition: version.f90:7
integer(i4b), parameter idevelopmode
Definition: version.f90:19
Here is the call graph for this function:
Here is the caller graph for this function:

◆ mem_da_check()

subroutine memorymanagermodule::mem_da_check ( class(memorytype), pointer  mt)

Definition at line 2721 of file MemoryManager.f90.

2722  ! -- modules
2723  use inputoutputmodule, only: upcase
2724  ! -- dummy
2725  class(MemoryType), pointer :: mt
2726  ! -- local
2727  character(len=LINELENGTH) :: error_msg
2728  character(len=LENVARNAME) :: ucname
2729  !
2730  ! -- check if memory has been deallocated
2731  if (mt%mt_associated() .and. mt%element_size == -1) then
2732  error_msg = trim(adjustl(mt%path))//' '// &
2733  trim(adjustl(mt%name))//' has invalid element size'
2734  call store_error(trim(error_msg))
2735  end if
2736  !
2737  ! -- check if memory has been deallocated
2738  if (mt%mt_associated() .and. mt%isize > 0) then
2739  error_msg = trim(adjustl(mt%path))//' '// &
2740  trim(adjustl(mt%name))//' not deallocated'
2741  call store_error(trim(error_msg))
2742  end if
2743  !
2744  ! -- check case of varname
2745  ucname = mt%name
2746  call upcase(ucname)
2747  if (mt%name /= ucname) then
2748  error_msg = trim(adjustl(mt%path))//' '// &
2749  trim(adjustl(mt%name))//' not upper case'
2750  call store_error(trim(error_msg))
2751  end if
subroutine, public upcase(word)
Convert to upper case.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ mem_detailed_table()

subroutine memorymanagermodule::mem_detailed_table ( integer(i4b), intent(in)  iout,
integer(i4b), intent(in)  nrows 
)
private
Parameters
[in]ioutunit number for mfsim.lst
[in]nrowsnumber of table rows

Definition at line 2347 of file MemoryManager.f90.

2348  integer(I4B), intent(in) :: iout !< unit number for mfsim.lst
2349  integer(I4B), intent(in) :: nrows !< number of table rows
2350  ! -- local
2351  character(len=LINELENGTH) :: title
2352  character(len=LINELENGTH) :: text
2353  integer(I4B) :: nterms
2354  ! -- formats
2355  ! -- code
2356  nterms = 5
2357  !
2358  ! -- set up table title
2359  title = 'DETAILED INFORMATION ON VARIABLES STORED IN THE MEMORY MANAGER'
2360  !
2361  ! -- set up stage tableobj
2362  call table_cr(memtab, 'MEM DET', title)
2363  call memtab%table_df(nrows, nterms, iout)
2364  !
2365  ! -- origin
2366  text = 'ORIGIN'
2367  call memtab%initialize_column(text, lenmempath, alignment=tableft)
2368  !
2369  ! -- variable
2370  text = 'VARIABLE NAME'
2371  call memtab%initialize_column(text, lenvarname, alignment=tableft)
2372  !
2373  ! -- data type
2374  text = 'DATA TYPE'
2375  call memtab%initialize_column(text, 16, alignment=tableft)
2376  !
2377  ! -- size
2378  text = 'NUMBER OF ITEMS'
2379  call memtab%initialize_column(text, 20, alignment=tabright)
2380  !
2381  ! -- is it a pointer
2382  text = 'ASSOCIATED VARIABLE'
2383  call memtab%initialize_column(text, lenmemaddress, alignment=tableft)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ mem_print_detailed()

subroutine, public memorymanagermodule::mem_print_detailed ( integer(i4b)  iout)

Definition at line 2625 of file MemoryManager.f90.

2626  integer(I4B) :: iout
2627  ! local
2628  class(MemoryType), pointer :: mt
2629  type(MemoryContainerIteratorType), allocatable :: itr
2630 
2631  call mem_detailed_table(iout, memorystore%count())
2632  itr = memorystore%iterator()
2633  do while (itr%has_next())
2634  call itr%next()
2635  mt => itr%value()
2636  call mt%table_entry(memtab)
2637  end do
2638  call mem_cleanup_table()
2639 
Here is the call graph for this function:
Here is the caller graph for this function:

◆ mem_release()

subroutine, public memorymanagermodule::mem_release ( type(memorytype), intent(inout), pointer  mt)

Deallocates the data held by mt, zeroes mtisize, and decrements the appropriate nvalues_* counter for master entries. no-op when data has already been released. Primarily intended to support the release of input context memory prior to simulation runtime.

Definition at line 2669 of file MemoryManager.f90.

2670  type(MemoryType), pointer, intent(inout) :: mt
2671 
2672  if (.not. mt%mt_associated()) return
2673 
2674  if (mt%master) then
2675  if (mt%memtype(1:6) == 'STRING') then
2676  ! nvalues_astr increments differ: scalar adds element_size (ilen),
2677  ! arrays (str1d, charstr1d) add isize only. For IDM release the
2678  ! variables are arrays, so decrement by isize to match.
2679  if (mt%isize == 1) then
2680  nvalues_astr = nvalues_astr - mt%element_size
2681  else
2682  nvalues_astr = nvalues_astr - mt%isize
2683  end if
2684  else if (mt%memtype(1:7) == 'LOGICAL') then
2685  nvalues_alogical = nvalues_alogical - mt%isize
2686  else if (mt%memtype(1:7) == 'INTEGER') then
2687  nvalues_aint = nvalues_aint - mt%isize
2688  else if (mt%memtype(1:6) == 'DOUBLE') then
2689  nvalues_adbl = nvalues_adbl - mt%isize
2690  end if
2691  end if
2692 
2693  call mt%mt_deallocate()
2694  mt%isize = 0
Here is the caller graph for this function:

◆ mem_set_print_option()

subroutine, public memorymanagermodule::mem_set_print_option ( integer(i4b), intent(in)  iout,
character(len=*), intent(in)  keyword,
character(len=*), intent(inout)  error_msg 
)
Parameters
[in]ioutunit number for mfsim.lst
[in]keywordmemory print option
[in,out]error_msgreturned error message if keyword is not valid option

Definition at line 2273 of file MemoryManager.f90.

2274  integer(I4B), intent(in) :: iout !< unit number for mfsim.lst
2275  character(len=*), intent(in) :: keyword !< memory print option
2276  character(len=*), intent(inout) :: error_msg !< returned error message if keyword is not valid option
2277  ! -- local
2278  ! -- format
2279  ! -- code
2280  select case (keyword)
2281  case ('NONE')
2282  iprmem = 0
2283  write (iout, '(4x, a)') &
2284  'LIMITED MEMORY INFORMATION WILL BE WRITTEN.'
2285  case ('SUMMARY')
2286  iprmem = 1
2287  write (iout, '(4x, a)') &
2288  'A SUMMARY OF SIMULATION MEMORY INFORMATION WILL BE WRITTEN.'
2289  case ('ALL')
2290  iprmem = 2
2291  write (iout, '(4x, a)') &
2292  'ALL SIMULATION MEMORY INFORMATION WILL BE WRITTEN.'
2293  case default
2294  error_msg = "Unknown memory print option '"//trim(keyword)//"."
2295  end select
Here is the caller graph for this function:

◆ mem_summary_line()

subroutine memorymanagermodule::mem_summary_line ( character(len=*), intent(in)  component,
real(dp), intent(in)  rchars,
real(dp), intent(in)  rlog,
real(dp), intent(in)  rint,
real(dp), intent(in)  rreal,
real(dp), intent(in)  bytes 
)
private
Parameters
[in]componentcharacter defining the program component (e.g. solution)
[in]rcharsallocated size of characters (in common units)
[in]rlogallocated size of logical (in common units)
[in]rintallocated size of integer variables (in common units)
[in]rrealallocated size of real variables (in common units)
[in]bytestotal allocated memory in memory manager (in common units)

Definition at line 2388 of file MemoryManager.f90.

2389  character(len=*), intent(in) :: component !< character defining the program component (e.g. solution)
2390  real(DP), intent(in) :: rchars !< allocated size of characters (in common units)
2391  real(DP), intent(in) :: rlog !< allocated size of logical (in common units)
2392  real(DP), intent(in) :: rint !< allocated size of integer variables (in common units)
2393  real(DP), intent(in) :: rreal !< allocated size of real variables (in common units)
2394  real(DP), intent(in) :: bytes !< total allocated memory in memory manager (in common units)
2395  ! -- formats
2396  ! -- code
2397  !
2398  ! -- write line
2399  call memtab%add_term(component)
2400  call memtab%add_term(rchars)
2401  call memtab%add_term(rlog)
2402  call memtab%add_term(rint)
2403  call memtab%add_term(rreal)
2404  call memtab%add_term(bytes)
Here is the caller graph for this function:

◆ mem_summary_table()

subroutine memorymanagermodule::mem_summary_table ( integer(i4b), intent(in)  iout,
integer(i4b), intent(in)  nrows,
character(len=*), intent(in)  cunits 
)
private
Parameters
[in]ioutunit number for mfsim.lst
[in]nrowsnumber of table rows
[in]cunitsmemory units (bytes, kilobytes, megabytes, or gigabytes)

Definition at line 2300 of file MemoryManager.f90.

2301  integer(I4B), intent(in) :: iout !< unit number for mfsim.lst
2302  integer(I4B), intent(in) :: nrows !< number of table rows
2303  character(len=*), intent(in) :: cunits !< memory units (bytes, kilobytes, megabytes, or gigabytes)
2304  ! -- local
2305  character(len=LINELENGTH) :: title
2306  character(len=LINELENGTH) :: text
2307  integer(I4B) :: nterms
2308  ! -- formats
2309  ! -- code
2310  nterms = 6
2311  !
2312  ! -- set up table title
2313  title = 'SUMMARY INFORMATION ON VARIABLES STORED IN THE MEMORY MANAGER, '// &
2314  'IN '//trim(cunits)
2315  !
2316  ! -- set up stage tableobj
2317  call table_cr(memtab, 'MEM SUM', title)
2318  call memtab%table_df(nrows, nterms, iout)
2319  !
2320  ! -- data type
2321  text = 'COMPONENT'
2322  call memtab%initialize_column(text, 20, alignment=tableft)
2323  !
2324  ! -- memory allocated for characters
2325  text = 'CHARACTER'
2326  call memtab%initialize_column(text, 15, alignment=tabcenter)
2327  !
2328  ! -- memory allocated for logical
2329  text = 'LOGICAL'
2330  call memtab%initialize_column(text, 15, alignment=tabcenter)
2331  !
2332  ! -- memory allocated for integers
2333  text = 'INTEGER'
2334  call memtab%initialize_column(text, 15, alignment=tabcenter)
2335  !
2336  ! -- memory allocated for reals
2337  text = 'REAL'
2338  call memtab%initialize_column(text, 15, alignment=tabcenter)
2339  !
2340  ! -- total memory allocated
2341  text = 'TOTAL'
2342  call memtab%initialize_column(text, 15, alignment=tabcenter)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ mem_summary_total()

subroutine memorymanagermodule::mem_summary_total ( integer(i4b), intent(in)  iout,
real(dp), intent(in)  bytes 
)
private
Parameters
[in]ioutunit number for mfsim.lst
[in]bytestotal number of bytes allocated in the memory manager

Definition at line 2440 of file MemoryManager.f90.

2441  integer(I4B), intent(in) :: iout !< unit number for mfsim.lst
2442  real(DP), intent(in) :: bytes !< total number of bytes allocated in the memory manager
2443  ! -- local
2444  character(len=LINELENGTH) :: title
2445  character(len=LINELENGTH) :: text
2446  character(LEN=10) :: cunits
2447  integer(I4B) :: nterms
2448  integer(I4B) :: nrows
2449  real(DP) :: fact
2450  real(DP) :: smb
2451  ! -- formats
2452  ! -- code
2453  !
2454  ! -- calculate factor and memory units
2455  call mem_units(bytes, fact, cunits)
2456  !
2457  ! -- set table terms
2458  nterms = 2
2459  nrows = 6
2460  !
2461  ! -- set up table title
2462  title = 'MEMORY MANAGER TOTAL STORAGE BY DATA TYPE, IN '//trim(cunits)
2463  !
2464  ! -- set up stage tableobj
2465  call table_cr(memtab, 'MEM TOT', title)
2466  call memtab%table_df(nrows, nterms, iout)
2467  !
2468  ! -- data type
2469  text = 'DATA TYPE'
2470  call memtab%initialize_column(text, 15, alignment=tableft)
2471  !
2472  ! -- number of values
2473  text = 'ALLOCATED MEMORY'
2474  call memtab%initialize_column(text, 15, alignment=tabcenter)
2475  !
2476  ! -- write data
2477  !
2478  ! -- characters
2479  smb = real(nvalues_astr, dp) * fact
2480  call memtab%add_term('Character')
2481  call memtab%add_term(smb)
2482  !
2483  ! -- logicals
2484  smb = real(nvalues_alogical * lgp, dp) * fact
2485  call memtab%add_term('Logical')
2486  call memtab%add_term(smb)
2487  !
2488  ! -- integers
2489  smb = real(nvalues_aint * i4b, dp) * fact
2490  call memtab%add_term('Integer')
2491  call memtab%add_term(smb)
2492  !
2493  ! -- reals
2494  smb = real(nvalues_adbl * dp, dp) * fact
2495  call memtab%add_term('Real')
2496  call memtab%add_term(smb)
2497  !
2498  ! -- total memory usage
2499  call memtab%print_separator()
2500  smb = bytes * fact
2501  call memtab%add_term('Total')
2502  call memtab%add_term(smb)
2503  !
2504  ! -- Virtual memory
2505  smb = calc_virtual_mem() * fact
2506  call memtab%add_term('Virtual')
2507  call memtab%add_term(smb)
2508  !
2509  ! -- deallocate table
2510  call mem_cleanup_table()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ mem_unique_origins()

subroutine memorymanagermodule::mem_unique_origins ( character(len=lenmemaddress), dimension(:), intent(inout), allocatable  cunique)
Parameters
[in,out]cuniquearray with unique first components

Definition at line 2757 of file MemoryManager.f90.

2758  ! -- modules
2760  ! -- dummy
2761  character(len=LENMEMADDRESS), allocatable, dimension(:), intent(inout) :: &
2762  cunique !< array with unique first components
2763  ! -- local
2764  class(MemoryType), pointer :: mt
2765  character(len=LENMEMPATH) :: context
2766  character(len=LENCOMPONENTNAME) :: component
2767  character(len=LENCOMPONENTNAME) :: subcomponent
2768  character(len=LENMEMADDRESS) :: context_component
2769  type(MemoryContainerIteratorType), allocatable :: itr
2770  integer(I4B) :: ipa
2771  ! -- code
2772  !
2773  ! -- initialize cunique
2774  allocate (cunique(0))
2775  !
2776  ! -- find unique origins
2777  itr = memorystore%iterator()
2778  do while (itr%has_next())
2779  call itr%next()
2780  mt => itr%value()
2781  call split_mem_path(mt%path, component, subcomponent)
2782  context = get_mem_path_context(mt%path)
2783  context_component = trim(context)//component
2784  ipa = ifind(cunique, context_component)
2785  if (ipa < 1) then
2786  call expandarray(cunique, 1)
2787  cunique(size(cunique)) = context_component
2788  end if
2789  end do
Here is the call graph for this function:
Here is the caller graph for this function:

◆ mem_units()

subroutine memorymanagermodule::mem_units ( real(dp), intent(in)  bytes,
real(dp), intent(inout)  fact,
character(len=*), intent(inout)  cunits 
)
private
Parameters
[in]bytestotal nr. of bytes
[in,out]factconversion factor
[in,out]cunitsstring with memory unit

Definition at line 2409 of file MemoryManager.f90.

2410  ! -- dummy
2411  real(DP), intent(in) :: bytes !< total nr. of bytes
2412  real(DP), intent(inout) :: fact !< conversion factor
2413  character(len=*), intent(inout) :: cunits !< string with memory unit
2414  ! -- local
2415  ! -- formats
2416  ! -- code
2417  !
2418  ! -- initialize factor and unit string
2419  cunits = 'UNKNOWN'
2420  fact = done
2421  !
2422  ! -- set factor
2423  if (bytes < dep3) then
2424  fact = done
2425  cunits = 'BYTES'
2426  else if (bytes < dep6) then
2427  fact = dem3
2428  cunits = 'KILOBYTES'
2429  else if (bytes < dep9) then
2430  fact = dem6
2431  cunits = 'MEGABYTES'
2432  else
2433  fact = dem9
2434  cunits = 'GIGABYTES'
2435  end if
Here is the caller graph for this function:

◆ mem_write_usage()

subroutine, public memorymanagermodule::mem_write_usage ( integer(i4b), intent(in)  iout)

The total memory usage by data types (int, real, etc.) is written for every simulation.

Parameters
[in]ioutunit number for mfsim.lst

Definition at line 2530 of file MemoryManager.f90.

2531  integer(I4B), intent(in) :: iout !< unit number for mfsim.lst
2532  ! -- local
2533  class(MemoryType), pointer :: mt
2534  character(len=LENMEMADDRESS), allocatable, dimension(:) :: cunique
2535  ! character(len=LENMEMPATH) :: mem_path
2536  character(len=LENMEMPATH) :: context
2537  character(len=LENCOMPONENTNAME) :: component
2538  character(len=LENCOMPONENTNAME) :: subcomponent
2539  character(len=LENMEMADDRESS) :: context_component
2540  character(LEN=10) :: cunits
2541  type(MemoryContainerIteratorType), allocatable :: itr
2542  integer(I4B) :: icomp
2543  integer(I4B) :: ilen
2544  integer(I8B) :: nchars
2545  integer(I8B) :: nlog
2546  integer(I8B) :: nint
2547  integer(I8B) :: nreal
2548  real(DP) :: simbytes
2549  real(DP) :: fact
2550  real(DP) :: rchars
2551  real(DP) :: rlog
2552  real(DP) :: rint
2553  real(DP) :: rreal
2554  real(DP) :: bytes
2555  ! -- formats
2556  ! -- code
2557  !
2558  ! -- Calculate simulation memory allocation
2559  simbytes = (nvalues_astr + &
2560  nvalues_alogical * lgp + &
2561  nvalues_aint * i4b + &
2562  nvalues_adbl * dp)
2563  simbytes = real(simbytes, dp)
2564  !
2565  ! -- calculate factor and memory units
2566  call mem_units(simbytes, fact, cunits)
2567  !
2568  ! -- Write summary table for simulation components
2569  if (iprmem == 1) then
2570  !
2571  ! -- Find unique names of simulation components
2572  call mem_unique_origins(cunique)
2573  call mem_summary_table(iout, size(cunique), cunits)
2574  do icomp = 1, size(cunique)
2575  nchars = 0
2576  nlog = 0
2577  nint = 0
2578  nreal = 0
2579  bytes = dzero
2580  ilen = len_trim(cunique(icomp))
2581  itr = memorystore%iterator()
2582  do while (itr%has_next())
2583  call itr%next()
2584  mt => itr%value()
2585  call split_mem_path(mt%path, component, subcomponent)
2586  context = get_mem_path_context(mt%path)
2587  context_component = trim(context)//component
2588  if (cunique(icomp) /= context_component(1:ilen)) cycle
2589  if (.not. mt%master) cycle
2590  if (mt%memtype(1:6) == 'STRING') then
2591  nchars = nchars + mt%isize * mt%element_size
2592  else if (mt%memtype(1:7) == 'LOGICAL') then
2593  nlog = nlog + mt%isize
2594  else if (mt%memtype(1:7) == 'INTEGER') then
2595  nint = nint + mt%isize
2596  else if (mt%memtype(1:6) == 'DOUBLE') then
2597  nreal = nreal + mt%isize
2598  end if
2599  end do
2600  !
2601  ! -- calculate size of each data type in bytes
2602  rchars = real(nchars, dp) * fact
2603  rlog = real(nlog * lgp, dp) * fact
2604  rint = real(nint * i4b, dp) * fact
2605  rreal = real(nreal * dp, dp) * fact
2606  !
2607  ! -- calculate total storage in bytes
2608  bytes = rchars + rlog + rint + rreal
2609  !
2610  ! -- write data
2611  call mem_summary_line(cunique(icomp), rchars, rlog, rint, rreal, bytes)
2612  end do
2613  call mem_cleanup_table()
2614  end if
2615  !
2616  ! -- Write table with all variables for iprmem == 2
2617  if (iprmem == 2) then
2618  call mem_print_detailed(iout)
2619  end if
2620  !
2621  ! -- Write total memory allocation
2622  call mem_summary_total(iout, simbytes)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ reallocate_charstr1d()

subroutine memorymanagermodule::reallocate_charstr1d ( type(characterstringtype), dimension(:), intent(inout), pointer, contiguous  acharstr1d,
integer(i4b), intent(in)  ilen,
integer(i4b), intent(in)  nrow,
character(len=*), intent(in)  name,
character(len=*), intent(in)  mem_path 
)
private
Parameters
[in,out]acharstr1dthe reallocated charstring array
[in]ilenstring length
[in]nrownumber of rows
[in]namevariable name
[in]mem_pathpath where variable is stored

Definition at line 1273 of file MemoryManager.f90.

1274  type(CharacterStringType), dimension(:), pointer, contiguous, &
1275  intent(inout) :: acharstr1d !< the reallocated charstring array
1276  integer(I4B), intent(in) :: ilen !< string length
1277  integer(I4B), intent(in) :: nrow !< number of rows
1278  character(len=*), intent(in) :: name !< variable name
1279  character(len=*), intent(in) :: mem_path !< path where variable is stored
1280  ! -- local
1281  type(MemoryType), pointer :: mt
1282  logical(LGP) :: found
1283  type(CharacterStringType), dimension(:), allocatable :: astrtemp
1284  character(len=ilen) :: string
1285  integer(I4B) :: istat
1286  integer(I4B) :: isize
1287  integer(I4B) :: isize_old
1288  integer(I4B) :: nrow_old
1289  integer(I4B) :: n
1290  !
1291  ! -- Initialize string
1292  string = ''
1293  !
1294  ! -- Find and assign mt
1295  call get_from_memorystore(name, mem_path, mt, found)
1296  !
1297  ! -- reallocate astr1d
1298  if (found) then
1299  isize_old = mt%isize
1300  if (isize_old > 0) then
1301  nrow_old = size(acharstr1d)
1302  else
1303  nrow_old = 0
1304  end if
1305  !
1306  ! -- calculate isize
1307  isize = nrow
1308  !
1309  ! -- allocate astrtemp
1310  allocate (astrtemp(nrow), stat=istat, errmsg=errmsg)
1311  if (istat /= 0) then
1312  call allocate_error(name, mem_path, istat, isize)
1313  end if
1314  !
1315  ! -- copy existing values (only up to the new size to handle shrinking)
1316  do n = 1, min(nrow_old, nrow)
1317  astrtemp(n) = acharstr1d(n)
1318  call acharstr1d(n)%destroy()
1319  end do
1320  !
1321  ! -- destroy remaining elements if shrinking
1322  do n = nrow + 1, nrow_old
1323  call acharstr1d(n)%destroy()
1324  end do
1325  !
1326  ! -- fill new values with missing values
1327  do n = nrow_old + 1, nrow
1328  astrtemp(n) = string
1329  end do
1330  !
1331  ! -- deallocate mt pointer, repoint, recalculate isize
1332  deallocate (acharstr1d)
1333  !
1334  ! -- allocate astr1d
1335  allocate (acharstr1d(nrow), stat=istat, errmsg=errmsg)
1336  if (istat /= 0) then
1337  call allocate_error(name, mem_path, istat, isize)
1338  end if
1339  !
1340  ! -- fill the reallocated character array
1341  do n = 1, nrow
1342  acharstr1d(n) = astrtemp(n)
1343  call astrtemp(n)%destroy()
1344  end do
1345  !
1346  ! -- deallocate temporary storage
1347  deallocate (astrtemp)
1348  !
1349  ! -- reset memory manager values
1350  mt%acharstr1d => acharstr1d
1351  mt%element_size = ilen
1352  mt%isize = isize
1353  mt%nrealloc = mt%nrealloc + 1
1354  mt%master = .true.
1355  nvalues_astr = nvalues_astr + isize - isize_old
1356  write (mt%memtype, "(a,' LEN=',i0,' (',i0,')')") 'STRING', ilen, nrow
1357  else
1358  errmsg = "Programming error, variable '"//trim(name)//"' from '"// &
1359  trim(mem_path)//"' is not defined in the memory manager. Use "// &
1360  "mem_allocate instead."
1361  call store_error(errmsg, terminate=.true.)
1362  end if

◆ reallocate_dbl1d()

subroutine memorymanagermodule::reallocate_dbl1d ( real(dp), dimension(:), intent(inout), pointer, contiguous  adbl,
integer(i4b), intent(in)  nrow,
character(len=*), intent(in)  name,
character(len=*), intent(in)  mem_path 
)
private
Parameters
[in,out]adblthe reallocated 1d real array
[in]nrownumber of rows
[in]namevariable name
[in]mem_pathpath where variable is stored

Definition at line 1499 of file MemoryManager.f90.

1500  real(DP), dimension(:), pointer, contiguous, intent(inout) :: adbl !< the reallocated 1d real array
1501  integer(I4B), intent(in) :: nrow !< number of rows
1502  character(len=*), intent(in) :: name !< variable name
1503  character(len=*), intent(in) :: mem_path !< path where variable is stored
1504  ! -- local
1505  type(MemoryType), pointer :: mt
1506  integer(I4B) :: istat
1507  integer(I4B) :: isize
1508  integer(I4B) :: i
1509  integer(I4B) :: isizeold
1510  integer(I4B) :: ifill
1511  logical(LGP) :: found
1512  ! -- code
1513  !
1514  ! -- Find and assign mt
1515  call get_from_memorystore(name, mem_path, mt, found)
1516  !
1517  ! -- Allocate adbl and then refill
1518  isize = nrow
1519  isizeold = size(mt%adbl1d)
1520  ifill = min(isizeold, isize)
1521  allocate (adbl(nrow), stat=istat, errmsg=errmsg)
1522  if (istat /= 0) then
1523  call allocate_error(name, mem_path, istat, isize)
1524  end if
1525  do i = 1, ifill
1526  adbl(i) = mt%adbl1d(i)
1527  end do
1528  !
1529  ! -- deallocate mt pointer, repoint, recalculate isize
1530  deallocate (mt%adbl1d)
1531  mt%adbl1d => adbl
1532  mt%element_size = dp
1533  mt%isize = isize
1534  mt%nrealloc = mt%nrealloc + 1
1535  mt%master = .true.
1536  nvalues_adbl = nvalues_adbl + isize - isizeold
1537  write (mt%memtype, "(a,' (',i0,')')") 'DOUBLE', isize

◆ reallocate_dbl2d()

subroutine memorymanagermodule::reallocate_dbl2d ( real(dp), dimension(:, :), intent(inout), pointer, contiguous  adbl,
integer(i4b), intent(in)  ncol,
integer(i4b), intent(in)  nrow,
character(len=*), intent(in)  name,
character(len=*), intent(in)  mem_path 
)
private
Parameters
[in,out]adblthe reallocated 2d real array
[in]ncolnumber of columns
[in]nrownumber of rows
[in]namevariable name
[in]mem_pathpath where variable is stored

Definition at line 1542 of file MemoryManager.f90.

1543  real(DP), dimension(:, :), pointer, contiguous, intent(inout) :: adbl !< the reallocated 2d real array
1544  integer(I4B), intent(in) :: ncol !< number of columns
1545  integer(I4B), intent(in) :: nrow !< number of rows
1546  character(len=*), intent(in) :: name !< variable name
1547  character(len=*), intent(in) :: mem_path !< path where variable is stored
1548  ! -- local
1549  type(MemoryType), pointer :: mt
1550  logical(LGP) :: found
1551  integer(I4B) :: istat
1552  integer(I4B), dimension(2) :: ishape
1553  integer(I4B) :: i
1554  integer(I4B) :: j
1555  integer(I4B) :: isize
1556  integer(I4B) :: isizeold
1557  ! -- code
1558  !
1559  ! -- Find and assign mt
1560  call get_from_memorystore(name, mem_path, mt, found)
1561  !
1562  ! -- Allocate adbl and then refill
1563  ishape = shape(mt%adbl2d)
1564  isize = nrow * ncol
1565  isizeold = ishape(1) * ishape(2)
1566  allocate (adbl(ncol, nrow), stat=istat, errmsg=errmsg)
1567  if (istat /= 0) then
1568  call allocate_error(name, mem_path, istat, isize)
1569  end if
1570  ! Copy only what fits in the new array to handle shrinking
1571  do i = 1, min(ishape(2), nrow)
1572  do j = 1, min(ishape(1), ncol)
1573  adbl(j, i) = mt%adbl2d(j, i)
1574  end do
1575  end do
1576  !
1577  ! -- deallocate mt pointer, repoint, recalculate isize
1578  deallocate (mt%adbl2d)
1579  mt%adbl2d => adbl
1580  mt%element_size = dp
1581  mt%isize = isize
1582  mt%nrealloc = mt%nrealloc + 1
1583  mt%master = .true.
1584  nvalues_adbl = nvalues_adbl + isize - isizeold
1585  write (mt%memtype, "(a,' (',i0,',',i0,')')") 'DOUBLE', ncol, nrow

◆ reallocate_int1d()

subroutine memorymanagermodule::reallocate_int1d ( integer(i4b), dimension(:), intent(inout), pointer, contiguous  aint,
integer(i4b), intent(in)  nrow,
character(len=*), intent(in)  name,
character(len=*), intent(in)  mem_path 
)
private
Parameters
[in,out]aintthe reallocated integer array
[in]nrownumber of rows
[in]namevariable name
[in]mem_pathpath where variable is stored

Definition at line 1409 of file MemoryManager.f90.

1410  integer(I4B), dimension(:), pointer, contiguous, intent(inout) :: aint !< the reallocated integer array
1411  integer(I4B), intent(in) :: nrow !< number of rows
1412  character(len=*), intent(in) :: name !< variable name
1413  character(len=*), intent(in) :: mem_path !< path where variable is stored
1414  ! -- local
1415  type(MemoryType), pointer :: mt
1416  logical(LGP) :: found
1417  integer(I4B) :: istat
1418  integer(I4B) :: isize
1419  integer(I4B) :: i
1420  integer(I4B) :: isizeold
1421  integer(I4B) :: ifill
1422  ! -- code
1423  !
1424  ! -- Find and assign mt
1425  call get_from_memorystore(name, mem_path, mt, found)
1426  !
1427  ! -- Allocate aint and then refill
1428  isize = nrow
1429  isizeold = size(mt%aint1d)
1430  ifill = min(isizeold, isize)
1431  allocate (aint(nrow), stat=istat, errmsg=errmsg)
1432  if (istat /= 0) then
1433  call allocate_error(name, mem_path, istat, isize)
1434  end if
1435  do i = 1, ifill
1436  aint(i) = mt%aint1d(i)
1437  end do
1438  !
1439  ! -- deallocate mt pointer, repoint, recalculate isize
1440  deallocate (mt%aint1d)
1441  mt%aint1d => aint
1442  mt%element_size = i4b
1443  mt%isize = isize
1444  mt%nrealloc = mt%nrealloc + 1
1445  mt%master = .true.
1446  nvalues_aint = nvalues_aint + isize - isizeold

◆ reallocate_int2d()

subroutine memorymanagermodule::reallocate_int2d ( integer(i4b), dimension(:, :), intent(inout), pointer, contiguous  aint,
integer(i4b), intent(in)  ncol,
integer(i4b), intent(in)  nrow,
character(len=*), intent(in)  name,
character(len=*), intent(in)  mem_path 
)
private
Parameters
[in,out]aintthe reallocated 2d integer array
[in]ncolnumber of columns
[in]nrownumber of rows
[in]namevariable name
[in]mem_pathpath where variable is stored

Definition at line 1451 of file MemoryManager.f90.

1452  integer(I4B), dimension(:, :), pointer, contiguous, intent(inout) :: aint !< the reallocated 2d integer array
1453  integer(I4B), intent(in) :: ncol !< number of columns
1454  integer(I4B), intent(in) :: nrow !< number of rows
1455  character(len=*), intent(in) :: name !< variable name
1456  character(len=*), intent(in) :: mem_path !< path where variable is stored
1457  ! -- local
1458  type(MemoryType), pointer :: mt
1459  logical(LGP) :: found
1460  integer(I4B) :: istat
1461  integer(I4B), dimension(2) :: ishape
1462  integer(I4B) :: i
1463  integer(I4B) :: j
1464  integer(I4B) :: isize
1465  integer(I4B) :: isizeold
1466  ! -- code
1467  !
1468  ! -- Find and assign mt
1469  call get_from_memorystore(name, mem_path, mt, found)
1470  !
1471  ! -- Allocate aint and then refill
1472  ishape = shape(mt%aint2d)
1473  isize = nrow * ncol
1474  isizeold = ishape(1) * ishape(2)
1475  allocate (aint(ncol, nrow), stat=istat, errmsg=errmsg)
1476  if (istat /= 0) then
1477  call allocate_error(name, mem_path, istat, isize)
1478  end if
1479  ! Copy only what fits in the new array to handle shrinking
1480  do i = 1, min(ishape(2), nrow)
1481  do j = 1, min(ishape(1), ncol)
1482  aint(j, i) = mt%aint2d(j, i)
1483  end do
1484  end do
1485  !
1486  ! -- deallocate mt pointer, repoint, recalculate isize
1487  deallocate (mt%aint2d)
1488  mt%aint2d => aint
1489  mt%element_size = i4b
1490  mt%isize = isize
1491  mt%nrealloc = mt%nrealloc + 1
1492  mt%master = .true.
1493  nvalues_aint = nvalues_aint + isize - isizeold
1494  write (mt%memtype, "(a,' (',i0,',',i0,')')") 'INTEGER', ncol, nrow

◆ reallocate_logical1d()

subroutine memorymanagermodule::reallocate_logical1d ( logical(lgp), dimension(:), intent(inout), pointer, contiguous  alog,
integer(i4b), intent(in)  nrow,
character(len=*), intent(in)  name,
character(len=*), intent(in)  mem_path 
)
private
Parameters
[in,out]alogthe reallocated logical array
[in]nrownumber of rows
[in]namevariable name
[in]mem_pathpath where variable is stored

Definition at line 1367 of file MemoryManager.f90.

1368  logical(LGP), dimension(:), pointer, contiguous, intent(inout) :: alog !< the reallocated logical array
1369  integer(I4B), intent(in) :: nrow !< number of rows
1370  character(len=*), intent(in) :: name !< variable name
1371  character(len=*), intent(in) :: mem_path !< path where variable is stored
1372  ! -- local
1373  type(MemoryType), pointer :: mt
1374  logical(LGP) :: found
1375  integer(I4B) :: istat
1376  integer(I4B) :: isize
1377  integer(I4B) :: i
1378  integer(I4B) :: isizeold
1379  integer(I4B) :: ifill
1380  ! -- code
1381  !
1382  ! -- Find and assign mt
1383  call get_from_memorystore(name, mem_path, mt, found)
1384  !
1385  ! -- Allocate aint and then refill
1386  isize = nrow
1387  isizeold = size(mt%alogical1d)
1388  ifill = min(isizeold, isize)
1389  allocate (alog(nrow), stat=istat, errmsg=errmsg)
1390  if (istat /= 0) then
1391  call allocate_error(name, mem_path, istat, isize)
1392  end if
1393  do i = 1, ifill
1394  alog(i) = mt%alogical1d(i)
1395  end do
1396  !
1397  ! -- deallocate mt pointer, repoint, recalculate isize
1398  deallocate (mt%alogical1d)
1399  mt%alogical1d => alog
1400  mt%element_size = lgp
1401  mt%isize = isize
1402  mt%nrealloc = mt%nrealloc + 1
1403  mt%master = .true.
1404  nvalues_alogical = nvalues_alogical + isize - isizeold

◆ reallocate_str1d()

subroutine memorymanagermodule::reallocate_str1d ( character(len=ilen), dimension(:), intent(inout), pointer, contiguous  astr,
integer(i4b), intent(in)  ilen,
integer(i4b), intent(in)  nrow,
character(len=*), intent(in)  name,
character(len=*), intent(in)  mem_path 
)
private
Parameters
[in]ilenstring length
[in]nrownumber of rows
[in,out]astrthe reallocated string array
[in]namevariable name
[in]mem_pathpath where variable is stored

Definition at line 1191 of file MemoryManager.f90.

1192  integer(I4B), intent(in) :: ilen !< string length
1193  integer(I4B), intent(in) :: nrow !< number of rows
1194  character(len=ilen), dimension(:), pointer, contiguous, intent(inout) :: astr !< the reallocated string array
1195  character(len=*), intent(in) :: name !< variable name
1196  character(len=*), intent(in) :: mem_path !< path where variable is stored
1197  ! -- local
1198  type(MemoryType), pointer :: mt
1199  logical(LGP) :: found
1200  character(len=ilen), dimension(:), allocatable :: astrtemp
1201  integer(I4B) :: istat
1202  integer(I4B) :: isize
1203  integer(I4B) :: isize_old
1204  integer(I4B) :: nrow_old
1205  integer(I4B) :: n
1206  !
1207  ! -- Find and assign mt
1208  call get_from_memorystore(name, mem_path, mt, found)
1209  !
1210  ! -- reallocate astr1d
1211  if (found) then
1212  isize_old = mt%isize
1213  if (isize_old > 0) then
1214  nrow_old = size(astr)
1215  else
1216  nrow_old = 0
1217  end if
1218  !
1219  ! -- calculate isize
1220  isize = nrow
1221  !
1222  ! -- allocate astrtemp
1223  allocate (astrtemp(nrow), stat=istat, errmsg=errmsg)
1224  if (istat /= 0) then
1225  call allocate_error(name, mem_path, istat, isize)
1226  end if
1227  !
1228  ! -- copy existing values (only up to the new size to handle shrinking)
1229  do n = 1, min(nrow_old, nrow)
1230  astrtemp(n) = astr(n)
1231  end do
1232  !
1233  ! -- fill new values with missing values
1234  do n = nrow_old + 1, nrow
1235  astrtemp(n) = ''
1236  end do
1237  !
1238  ! -- deallocate mt pointer, repoint, recalculate isize
1239  deallocate (astr)
1240  !
1241  ! -- allocate astr1d
1242  allocate (astr(nrow), stat=istat, errmsg=errmsg)
1243  if (istat /= 0) then
1244  call allocate_error(name, mem_path, istat, isize)
1245  end if
1246  !
1247  ! -- fill the reallocate character array
1248  do n = 1, nrow
1249  astr(n) = astrtemp(n)
1250  end do
1251  !
1252  ! -- deallocate temporary storage
1253  deallocate (astrtemp)
1254  !
1255  ! -- reset memory manager values
1256  mt%astr1d => astr
1257  mt%element_size = ilen
1258  mt%isize = isize
1259  mt%nrealloc = mt%nrealloc + 1
1260  mt%master = .true.
1261  nvalues_astr = nvalues_astr + isize - isize_old
1262  write (mt%memtype, "(a,' LEN=',i0,' (',i0,')')") 'STRING', ilen, nrow
1263  else
1264  errmsg = "Programming error, variable '"//trim(name)//"' from '"// &
1265  trim(mem_path)//"' is not defined in the memory manager. Use "// &
1266  "mem_allocate instead."
1267  call store_error(errmsg, terminate=.true.)
1268  end if

◆ reassignptr_dbl1d()

subroutine memorymanagermodule::reassignptr_dbl1d ( real(dp), dimension(:), intent(inout), pointer, contiguous  adbl,
character(len=*), intent(in)  name,
character(len=*), intent(in)  mem_path,
character(len=*), intent(in)  name_target,
character(len=*), intent(in)  mem_path_target 
)
private
Parameters
[in,out]adblpointer to 1d real array
[in]namevariable name
[in]mem_pathpath where variable is stored
[in]name_targetname of target variable
[in]mem_path_targetpath where target variable is stored

Definition at line 2079 of file MemoryManager.f90.

2080  real(DP), dimension(:), pointer, contiguous, intent(inout) :: adbl !< pointer to 1d real array
2081  character(len=*), intent(in) :: name !< variable name
2082  character(len=*), intent(in) :: mem_path !< path where variable is stored
2083  character(len=*), intent(in) :: name_target !< name of target variable
2084  character(len=*), intent(in) :: mem_path_target !< path where target variable is stored
2085  ! -- local
2086  type(MemoryType), pointer :: mt
2087  type(MemoryType), pointer :: mt2
2088  logical(LGP) :: found
2089  ! -- code
2090  call get_from_memorystore(name, mem_path, mt, found)
2091  call get_from_memorystore(name_target, mem_path_target, mt2, found)
2092  if (size(adbl) > 0) then
2093  nvalues_adbl = nvalues_adbl - size(adbl)
2094  deallocate (adbl)
2095  end if
2096  adbl => mt2%adbl1d
2097  mt%adbl1d => adbl
2098  mt%element_size = dp
2099  mt%isize = size(adbl)
2100  write (mt%memtype, "(a,' (',i0,')')") 'DOUBLE', mt%isize
2101  !
2102  ! -- set master information
2103  mt%master = .false.
2104  mt%mastername = name_target
2105  mt%masterPath = mem_path_target

◆ reassignptr_dbl2d()

subroutine memorymanagermodule::reassignptr_dbl2d ( real(dp), dimension(:, :), intent(inout), pointer, contiguous  adbl,
character(len=*), intent(in)  name,
character(len=*), intent(in)  mem_path,
character(len=*), intent(in)  name_target,
character(len=*), intent(in)  mem_path_target 
)
private
Parameters
[in,out]adblpointer to 2d real array
[in]namevariable name
[in]mem_pathpath where variable is stored
[in]name_targetname of target variable
[in]mem_path_targetpath where target variable is stored

Definition at line 2110 of file MemoryManager.f90.

2111  real(DP), dimension(:, :), pointer, contiguous, intent(inout) :: adbl !< pointer to 2d real array
2112  character(len=*), intent(in) :: name !< variable name
2113  character(len=*), intent(in) :: mem_path !< path where variable is stored
2114  character(len=*), intent(in) :: name_target !< name of target variable
2115  character(len=*), intent(in) :: mem_path_target !< path where target variable is stored
2116  ! -- local
2117  type(MemoryType), pointer :: mt
2118  type(MemoryType), pointer :: mt2
2119  logical(LGP) :: found
2120  integer(I4B) :: ncol
2121  integer(I4b) :: nrow
2122  ! -- code
2123  call get_from_memorystore(name, mem_path, mt, found)
2124  call get_from_memorystore(name_target, mem_path_target, mt2, found)
2125  if (size(adbl) > 0) then
2126  nvalues_adbl = nvalues_adbl - size(adbl)
2127  deallocate (adbl)
2128  end if
2129  adbl => mt2%adbl2d
2130  mt%adbl2d => adbl
2131  mt%element_size = dp
2132  mt%isize = size(adbl)
2133  ncol = size(adbl, dim=1)
2134  nrow = size(adbl, dim=2)
2135  write (mt%memtype, "(a,' (',i0,',',i0,')')") 'DOUBLE', ncol, nrow
2136  !
2137  ! -- set master information
2138  mt%master = .false.
2139  mt%mastername = name_target
2140  mt%masterPath = mem_path_target

◆ reassignptr_int()

subroutine memorymanagermodule::reassignptr_int ( integer(i4b), intent(inout), pointer  sclr,
character(len=*), intent(in)  name,
character(len=*), intent(in)  mem_path,
character(len=*), intent(in)  name_target,
character(len=*), intent(in)  mem_path_target 
)
private
Parameters
[in,out]sclrpointer to integer scalar
[in]namevariable name
[in]mem_pathpath where variable is stored
[in]name_targetname of target variable
[in]mem_path_targetpath where target variable is stored

Definition at line 1950 of file MemoryManager.f90.

1951  integer(I4B), pointer, intent(inout) :: sclr !< pointer to integer scalar
1952  character(len=*), intent(in) :: name !< variable name
1953  character(len=*), intent(in) :: mem_path !< path where variable is stored
1954  character(len=*), intent(in) :: name_target !< name of target variable
1955  character(len=*), intent(in) :: mem_path_target !< path where target variable is stored
1956  ! -- local
1957  type(MemoryType), pointer :: mt
1958  type(MemoryType), pointer :: mt2
1959  logical(LGP) :: found
1960  ! -- code
1961  call get_from_memorystore(name, mem_path, mt, found)
1962  call get_from_memorystore(name_target, mem_path_target, mt2, found)
1963  if (associated(sclr)) then
1964  nvalues_aint = nvalues_aint - 1
1965  deallocate (sclr)
1966  end if
1967  sclr => mt2%intsclr
1968  mt%intsclr => sclr
1969  mt%element_size = i4b
1970  mt%isize = 1
1971  write (mt%memtype, "(a,' (',i0,')')") 'INTEGER', mt%isize
1972  !
1973  ! -- set master information
1974  mt%master = .false.
1975  mt%mastername = name_target
1976  mt%masterPath = mem_path_target

◆ reassignptr_int1d()

subroutine memorymanagermodule::reassignptr_int1d ( integer(i4b), dimension(:), intent(inout), pointer, contiguous  aint,
character(len=*), intent(in)  name,
character(len=*), intent(in)  mem_path,
character(len=*), intent(in)  name_target,
character(len=*), intent(in)  mem_path_target 
)
private
Parameters
[in,out]aintpointer to 1d integer array
[in]namevariable name
[in]mem_pathpath where variable is stored
[in]name_targetname of target variable
[in]mem_path_targetpath where target variable is stored

Definition at line 2013 of file MemoryManager.f90.

2014  integer(I4B), dimension(:), pointer, contiguous, intent(inout) :: aint !< pointer to 1d integer array
2015  character(len=*), intent(in) :: name !< variable name
2016  character(len=*), intent(in) :: mem_path !< path where variable is stored
2017  character(len=*), intent(in) :: name_target !< name of target variable
2018  character(len=*), intent(in) :: mem_path_target !< path where target variable is stored
2019  ! -- local
2020  type(MemoryType), pointer :: mt
2021  type(MemoryType), pointer :: mt2
2022  logical(LGP) :: found
2023  ! -- code
2024  call get_from_memorystore(name, mem_path, mt, found)
2025  call get_from_memorystore(name_target, mem_path_target, mt2, found)
2026  if (size(aint) > 0) then
2027  nvalues_aint = nvalues_aint - size(aint)
2028  deallocate (aint)
2029  end if
2030  aint => mt2%aint1d
2031  mt%aint1d => aint
2032  mt%element_size = i4b
2033  mt%isize = size(aint)
2034  write (mt%memtype, "(a,' (',i0,')')") 'INTEGER', mt%isize
2035  !
2036  ! -- set master information
2037  mt%master = .false.
2038  mt%mastername = name_target
2039  mt%masterPath = mem_path_target

◆ reassignptr_int2d()

subroutine memorymanagermodule::reassignptr_int2d ( integer(i4b), dimension(:, :), intent(inout), pointer, contiguous  aint,
character(len=*), intent(in)  name,
character(len=*), intent(in)  mem_path,
character(len=*), intent(in)  name_target,
character(len=*), intent(in)  mem_path_target 
)
private
Parameters
[in,out]aintpointer to 2d integer array
[in]namevariable name
[in]mem_pathpath where variable is stored
[in]name_targetname of target variable
[in]mem_path_targetpath where target variable is stored

Definition at line 2044 of file MemoryManager.f90.

2045  integer(I4B), dimension(:, :), pointer, contiguous, intent(inout) :: aint !< pointer to 2d integer array
2046  character(len=*), intent(in) :: name !< variable name
2047  character(len=*), intent(in) :: mem_path !< path where variable is stored
2048  character(len=*), intent(in) :: name_target !< name of target variable
2049  character(len=*), intent(in) :: mem_path_target !< path where target variable is stored
2050  ! -- local
2051  type(MemoryType), pointer :: mt
2052  type(MemoryType), pointer :: mt2
2053  logical(LGP) :: found
2054  integer(I4B) :: ncol
2055  integer(I4B) :: nrow
2056  ! -- code
2057  call get_from_memorystore(name, mem_path, mt, found)
2058  call get_from_memorystore(name_target, mem_path_target, mt2, found)
2059  if (size(aint) > 0) then
2060  nvalues_aint = nvalues_aint - size(aint)
2061  deallocate (aint)
2062  end if
2063  aint => mt2%aint2d
2064  mt%aint2d => aint
2065  mt%element_size = i4b
2066  mt%isize = size(aint)
2067  ncol = size(aint, dim=1)
2068  nrow = size(aint, dim=2)
2069  write (mt%memtype, "(a,' (',i0,',',i0,')')") 'INTEGER', ncol, nrow
2070  !
2071  ! -- set master information
2072  mt%master = .false.
2073  mt%mastername = name_target
2074  mt%masterPath = mem_path_target

◆ reassignptr_logical1d()

subroutine memorymanagermodule::reassignptr_logical1d ( logical(lgp), dimension(:), intent(inout), pointer, contiguous  alog,
character(len=*), intent(in)  name,
character(len=*), intent(in)  mem_path,
character(len=*), intent(in)  name_target,
character(len=*), intent(in)  mem_path_target 
)
private
Parameters
[in,out]alogarray pointer
[in]namevariable name
[in]mem_pathpath where variable is stored
[in]name_targetname of target variable
[in]mem_path_targetpath where target variable is stored

Definition at line 1981 of file MemoryManager.f90.

1983  logical(LGP), dimension(:), pointer, contiguous, intent(inout) :: alog !< array pointer
1984  character(len=*), intent(in) :: name !< variable name
1985  character(len=*), intent(in) :: mem_path !< path where variable is stored
1986  character(len=*), intent(in) :: name_target !< name of target variable
1987  character(len=*), intent(in) :: mem_path_target !< path where target variable is stored
1988  ! -- local
1989  type(MemoryType), pointer :: mt
1990  type(MemoryType), pointer :: mt2
1991  logical(LGP) :: found
1992  ! -- code
1993  call get_from_memorystore(name, mem_path, mt, found)
1994  call get_from_memorystore(name_target, mem_path_target, mt2, found)
1995  if (size(alog) > 0) then
1996  nvalues_alogical = nvalues_alogical - size(alog)
1997  deallocate (alog)
1998  end if
1999  alog => mt2%alogical1d
2000  mt%alogical1d => alog
2001  mt%element_size = lgp
2002  mt%isize = size(alog)
2003  write (mt%memtype, "(a,' (',i0,')')") 'LOGICAL', mt%isize
2004  !
2005  ! -- set master information
2006  mt%master = .false.
2007  mt%mastername = name_target
2008  mt%masterPath = mem_path_target

◆ setptr_charstr1d()

subroutine memorymanagermodule::setptr_charstr1d ( type(characterstringtype), dimension(:), intent(inout), pointer, contiguous  acharstr1d,
character(len=*), intent(in)  name,
character(len=*), intent(in)  mem_path 
)
private
Parameters
[in,out]acharstr1dthe reallocated charstring array
[in]namevariable name
[in]mem_pathpath where variable is stored

Definition at line 1764 of file MemoryManager.f90.

1765  type(CharacterStringType), dimension(:), pointer, contiguous, &
1766  intent(inout) :: acharstr1d !< the reallocated charstring array
1767  character(len=*), intent(in) :: name !< variable name
1768  character(len=*), intent(in) :: mem_path !< path where variable is stored
1769  ! -- local
1770  type(MemoryType), pointer :: mt
1771  logical(LGP) :: found
1772  ! -- code
1773  call get_from_memorystore(name, mem_path, mt, found)
1774  acharstr1d => mt%acharstr1d

◆ setptr_dbl()

subroutine memorymanagermodule::setptr_dbl ( real(dp), intent(inout), pointer  sclr,
character(len=*), intent(in)  name,
character(len=*), intent(in)  mem_path 
)
private
Parameters
[in,out]sclrpointer to a real scalar
[in]namevariable name
[in]mem_pathpath where variable is stored

Definition at line 1674 of file MemoryManager.f90.

1675  real(DP), pointer, intent(inout) :: sclr !< pointer to a real scalar
1676  character(len=*), intent(in) :: name !< variable name
1677  character(len=*), intent(in) :: mem_path !< path where variable is stored
1678  ! -- local
1679  type(MemoryType), pointer :: mt
1680  logical(LGP) :: found
1681  ! -- code
1682  call get_from_memorystore(name, mem_path, mt, found)
1683  sclr => mt%dblsclr

◆ setptr_dbl1d()

subroutine memorymanagermodule::setptr_dbl1d ( real(dp), dimension(:), intent(inout), pointer, contiguous  adbl,
character(len=*), intent(in)  name,
character(len=*), intent(in)  mem_path 
)
private
Parameters
[in,out]adblpointer to 1d real array
[in]namevariable name
[in]mem_pathpath where variable is stored

Definition at line 1688 of file MemoryManager.f90.

1689  real(DP), dimension(:), pointer, contiguous, intent(inout) :: adbl !< pointer to 1d real array
1690  character(len=*), intent(in) :: name !< variable name
1691  character(len=*), intent(in) :: mem_path !< path where variable is stored
1692  ! -- local
1693  type(MemoryType), pointer :: mt
1694  logical(LGP) :: found
1695  ! -- code
1696  call get_from_memorystore(name, mem_path, mt, found)
1697  adbl => mt%adbl1d

◆ setptr_dbl2d()

subroutine memorymanagermodule::setptr_dbl2d ( real(dp), dimension(:, :), intent(inout), pointer, contiguous  adbl,
character(len=*), intent(in)  name,
character(len=*), intent(in)  mem_path 
)
private
Parameters
[in,out]adblpointer to 2d real array
[in]namevariable name
[in]mem_pathpath where variable is stored

Definition at line 1702 of file MemoryManager.f90.

1703  real(DP), dimension(:, :), pointer, contiguous, intent(inout) :: adbl !< pointer to 2d real array
1704  character(len=*), intent(in) :: name !< variable name
1705  character(len=*), intent(in) :: mem_path !< path where variable is stored
1706  ! -- local
1707  type(MemoryType), pointer :: mt
1708  logical(LGP) :: found
1709  ! -- code
1710  call get_from_memorystore(name, mem_path, mt, found)
1711  adbl => mt%adbl2d

◆ setptr_dbl3d()

subroutine memorymanagermodule::setptr_dbl3d ( real(dp), dimension(:, :, :), intent(inout), pointer, contiguous  adbl,
character(len=*), intent(in)  name,
character(len=*), intent(in)  mem_path 
)
private
Parameters
[in,out]adblpointer to 3d real array
[in]namevariable name
[in]mem_pathpath where variable is stored

Definition at line 1716 of file MemoryManager.f90.

1717  real(DP), dimension(:, :, :), pointer, contiguous, intent(inout) :: adbl !< pointer to 3d real array
1718  character(len=*), intent(in) :: name !< variable name
1719  character(len=*), intent(in) :: mem_path !< path where variable is stored
1720  ! -- local
1721  type(MemoryType), pointer :: mt
1722  logical(LGP) :: found
1723  ! -- code
1724  call get_from_memorystore(name, mem_path, mt, found)
1725  adbl => mt%adbl3d

◆ setptr_int()

subroutine memorymanagermodule::setptr_int ( integer(i4b), intent(inout), pointer  sclr,
character(len=*), intent(in)  name,
character(len=*), intent(in)  mem_path 
)
private
Parameters
[in,out]sclrpointer to integer scalar
[in]namevariable name
[in]mem_pathpath where variable is stored

Definition at line 1604 of file MemoryManager.f90.

1605  integer(I4B), pointer, intent(inout) :: sclr !< pointer to integer scalar
1606  character(len=*), intent(in) :: name !< variable name
1607  character(len=*), intent(in) :: mem_path !< path where variable is stored
1608  ! -- local
1609  type(MemoryType), pointer :: mt
1610  logical(LGP) :: found
1611  ! -- code
1612  call get_from_memorystore(name, mem_path, mt, found)
1613  sclr => mt%intsclr

◆ setptr_int1d()

subroutine memorymanagermodule::setptr_int1d ( integer(i4b), dimension(:), intent(inout), pointer, contiguous  aint,
character(len=*), intent(in)  name,
character(len=*), intent(in)  mem_path 
)
private
Parameters
[in,out]aintpointer to 1d integer array
[in]namevariable name
[in]mem_pathpath where variable is stored

Definition at line 1632 of file MemoryManager.f90.

1633  integer(I4B), dimension(:), pointer, contiguous, intent(inout) :: aint !< pointer to 1d integer array
1634  character(len=*), intent(in) :: name !< variable name
1635  character(len=*), intent(in) :: mem_path !< path where variable is stored
1636  ! -- local
1637  type(MemoryType), pointer :: mt
1638  logical(LGP) :: found
1639  ! -- code
1640  call get_from_memorystore(name, mem_path, mt, found)
1641  aint => mt%aint1d

◆ setptr_int2d()

subroutine memorymanagermodule::setptr_int2d ( integer(i4b), dimension(:, :), intent(inout), pointer, contiguous  aint,
character(len=*), intent(in)  name,
character(len=*), intent(in)  mem_path 
)
private
Parameters
[in,out]aintpointer to 2d integer array
[in]namevariable name
[in]mem_pathpath where variable is stored

Definition at line 1646 of file MemoryManager.f90.

1647  integer(I4B), dimension(:, :), pointer, contiguous, intent(inout) :: aint !< pointer to 2d integer array
1648  character(len=*), intent(in) :: name !< variable name
1649  character(len=*), intent(in) :: mem_path !< path where variable is stored
1650  ! -- local
1651  type(MemoryType), pointer :: mt
1652  logical(LGP) :: found
1653  ! -- code
1654  call get_from_memorystore(name, mem_path, mt, found)
1655  aint => mt%aint2d

◆ setptr_int3d()

subroutine memorymanagermodule::setptr_int3d ( integer(i4b), dimension(:, :, :), intent(inout), pointer, contiguous  aint,
character(len=*), intent(in)  name,
character(len=*), intent(in)  mem_path 
)
private
Parameters
[in,out]aintpointer to 3d integer array
[in]namevariable name
[in]mem_pathpath where variable is stored

Definition at line 1660 of file MemoryManager.f90.

1661  integer(I4B), dimension(:, :, :), pointer, contiguous, intent(inout) :: aint !< pointer to 3d integer array
1662  character(len=*), intent(in) :: name !< variable name
1663  character(len=*), intent(in) :: mem_path !< path where variable is stored
1664  ! -- local
1665  type(MemoryType), pointer :: mt
1666  logical(LGP) :: found
1667  ! -- code
1668  call get_from_memorystore(name, mem_path, mt, found)
1669  aint => mt%aint3d

◆ setptr_logical()

subroutine memorymanagermodule::setptr_logical ( logical(lgp), intent(inout), pointer  sclr,
character(len=*), intent(in)  name,
character(len=*), intent(in)  mem_path 
)
private
Parameters
[in,out]sclrpointer to logical scalar
[in]namevariable name
[in]mem_pathpath where variable is stored

Definition at line 1590 of file MemoryManager.f90.

1591  logical(LGP), pointer, intent(inout) :: sclr !< pointer to logical scalar
1592  character(len=*), intent(in) :: name !< variable name
1593  character(len=*), intent(in) :: mem_path !< path where variable is stored
1594  ! -- local
1595  type(MemoryType), pointer :: mt
1596  logical(LGP) :: found
1597  ! -- code
1598  call get_from_memorystore(name, mem_path, mt, found)
1599  sclr => mt%logicalsclr

◆ setptr_logical1d()

subroutine memorymanagermodule::setptr_logical1d ( logical(lgp), dimension(:), intent(inout), pointer, contiguous  alog,
character(len=*), intent(in)  name,
character(len=*), intent(in)  mem_path 
)
private
Parameters
[in,out]alogpointer to 1d logical array
[in]namevariable name
[in]mem_pathpath where variable is stored

Definition at line 1618 of file MemoryManager.f90.

1619  logical(LGP), dimension(:), pointer, contiguous, intent(inout) :: alog !< pointer to 1d logical array
1620  character(len=*), intent(in) :: name !< variable name
1621  character(len=*), intent(in) :: mem_path !< path where variable is stored
1622  ! -- local
1623  type(MemoryType), pointer :: mt
1624  logical(LGP) :: found
1625  ! -- code
1626  call get_from_memorystore(name, mem_path, mt, found)
1627  alog => mt%alogical1d

◆ setptr_str()

subroutine memorymanagermodule::setptr_str ( character(len=:), pointer  asrt,
character(len=*), intent(in)  name,
character(len=*), intent(in)  mem_path 
)
private
Parameters
asrtpointer to the character string
[in]namevariable name
[in]mem_pathpath where variable is stored

Definition at line 1730 of file MemoryManager.f90.

1731  character(len=:), pointer :: asrt !< pointer to the character string
1732  character(len=*), intent(in) :: name !< variable name
1733  character(len=*), intent(in) :: mem_path !< path where variable is stored
1734  ! -- local
1735  type(MemoryType), pointer :: mt
1736  logical(LGP) :: found
1737  ! -- code
1738  call get_from_memorystore(name, mem_path, mt, found)
1739  asrt => mt%strsclr

◆ setptr_str1d()

subroutine memorymanagermodule::setptr_str1d ( character(len=:), dimension(:), intent(inout), pointer, contiguous  astr1d,
character(len=*), intent(in)  name,
character(len=*), intent(in)  mem_path 
)
private
Parameters
[in,out]astr1dpointer to the string array
[in]namevariable name
[in]mem_pathpath where variable is stored

Definition at line 1744 of file MemoryManager.f90.

1745  character(len=:), dimension(:), &
1746  pointer, contiguous, intent(inout) :: astr1d !< pointer to the string array
1747  character(len=*), intent(in) :: name !< variable name
1748  character(len=*), intent(in) :: mem_path !< path where variable is stored
1749  ! -- local
1750  type(MemoryType), pointer :: mt
1751  logical(LGP) :: found
1752  ! -- code
1753  call get_from_memorystore(name, mem_path, mt, found)
1754  select type (item => mt%astr1d)
1755  type is (character(*))
1756  astr1d => item
1757  class default
1758  astr1d => null()
1759  end select

Variable Documentation

◆ iprmem

integer(i4b) memorymanagermodule::iprmem = 0
private

Definition at line 53 of file MemoryManager.f90.

53  integer(I4B) :: iprmem = 0

◆ memorystore

type(memorystoretype), public memorymanagermodule::memorystore

Definition at line 47 of file MemoryManager.f90.

47  type(MemoryStoreType) :: memorystore

◆ memtab

type(tabletype), pointer memorymanagermodule::memtab => null()
private

Definition at line 48 of file MemoryManager.f90.

48  type(TableType), pointer :: memtab => null()

◆ nvalues_adbl

integer(i8b) memorymanagermodule::nvalues_adbl = 0
private

Definition at line 52 of file MemoryManager.f90.

52  integer(I8B) :: nvalues_adbl = 0

◆ nvalues_aint

integer(i8b) memorymanagermodule::nvalues_aint = 0
private

Definition at line 51 of file MemoryManager.f90.

51  integer(I8B) :: nvalues_aint = 0

◆ nvalues_alogical

integer(i8b) memorymanagermodule::nvalues_alogical = 0
private

Definition at line 49 of file MemoryManager.f90.

49  integer(I8B) :: nvalues_alogical = 0

◆ nvalues_astr

integer(i8b) memorymanagermodule::nvalues_astr = 0
private

Definition at line 50 of file MemoryManager.f90.

50  integer(I8B) :: nvalues_astr = 0