MODFLOW 6  version 6.8.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 553 of file MemoryManager.f90.

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

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

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

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

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

334  character(len=*), intent(in) :: varname !< variable name
335  character(len=*), intent(in) :: mem_path !< path where the variable is stored
336  integer(I4B), intent(in) :: istat !< status code
337  integer(I4B), intent(in) :: isize !< size of allocation
338  ! -- local
339  character(len=20) :: csize
340  character(len=20) :: cstat
341  ! -- code
342  !
343  ! -- initialize character variables
344  write (csize, '(i0)') isize
345  write (cstat, '(i0)') istat
346  !
347  ! -- create error message
348  errmsg = "Error trying to allocate memory. Path '"//trim(mem_path)// &
349  "' variable name '"//trim(varname)//"' size '"//trim(csize)// &
350  "'. Error message is '"//trim(adjustl(errmsg))// &
351  "'. Status code is "//trim(cstat)//'.'
352  !
353  ! -- store error and stop program execution
354  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 610 of file MemoryManager.f90.

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

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

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

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

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

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

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

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

◆ calc_virtual_mem()

real(dp) function memorymanagermodule::calc_virtual_mem
private

Definition at line 2636 of file MemoryManager.f90.

2637  real(DP) :: vmem_size
2638  ! local
2639  type(MemoryContainerIteratorType), allocatable :: itr
2640  type(MemoryType), pointer :: mt
2641 
2642  vmem_size = dzero
2643  itr = memorystore%iterator()
2644  do while (itr%has_next())
2645  call itr%next()
2646  mt => itr%value()
2647  if (index(mt%path, "__P") == 1) then
2648  vmem_size = mt%element_size * mt%isize + vmem_size
2649  end if
2650  end do
2651 
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 1149 of file MemoryManager.f90.

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

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

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

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

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

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

1926  real(DP), dimension(:), intent(inout) :: adbl !< target array
1927  character(len=*), intent(in) :: name !< variable name
1928  character(len=*), intent(in) :: mem_path !< path where variable is stored
1929  ! -- local
1930  type(MemoryType), pointer :: mt
1931  logical(LGP) :: found
1932  integer(I4B) :: n
1933  ! -- code
1934  call get_from_memorystore(name, mem_path, mt, found)
1935  do n = 1, size(mt%adbl1d)
1936  adbl(n) = mt%adbl1d(n)
1937  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 1862 of file MemoryManager.f90.

1863  real(DP), dimension(:), pointer, contiguous, intent(inout) :: adbl !< returned copy of 1d real array
1864  character(len=*), intent(in) :: name !< variable name
1865  character(len=*), intent(in) :: mem_path !< path where variable is stored
1866  character(len=*), intent(in), optional :: mem_path_copy !< optional path where the copy will be stored,
1867  !! if passed then the copy is added to the
1868  !! memory manager
1869  ! -- local
1870  type(MemoryType), pointer :: mt
1871  logical(LGP) :: found
1872  integer(I4B) :: n
1873  ! -- code
1874  call get_from_memorystore(name, mem_path, mt, found)
1875  adbl => null()
1876  ! -- check the copy into the memory manager
1877  if (present(mem_path_copy)) then
1878  call allocate_dbl1d(adbl, size(mt%adbl1d), mt%name, mem_path_copy)
1879  ! -- create a local copy
1880  else
1881  allocate (adbl(size(mt%adbl1d)))
1882  end if
1883  do n = 1, size(mt%adbl1d)
1884  adbl(n) = mt%adbl1d(n)
1885  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 1890 of file MemoryManager.f90.

1891  real(DP), dimension(:, :), pointer, contiguous, intent(inout) :: adbl !< returned copy of 2d real array
1892  character(len=*), intent(in) :: name !< variable name
1893  character(len=*), intent(in) :: mem_path !< path where variable is stored
1894  character(len=*), intent(in), optional :: mem_path_copy !< optional path where the copy will be stored,
1895  !! if passed then the copy is added to the
1896  !! memory manager
1897  ! -- local
1898  type(MemoryType), pointer :: mt
1899  logical(LGP) :: found
1900  integer(I4B) :: i
1901  integer(I4B) :: j
1902  integer(I4B) :: ncol
1903  integer(I4B) :: nrow
1904  ! -- code
1905  call get_from_memorystore(name, mem_path, mt, found)
1906  adbl => null()
1907  ncol = size(mt%adbl2d, dim=1)
1908  nrow = size(mt%adbl2d, dim=2)
1909  ! -- check the copy into the memory manager
1910  if (present(mem_path_copy)) then
1911  call allocate_dbl2d(adbl, ncol, nrow, mt%name, mem_path_copy)
1912  ! -- create a local copy
1913  else
1914  allocate (adbl(ncol, nrow))
1915  end if
1916  do i = 1, nrow
1917  do j = 1, ncol
1918  adbl(j, i) = mt%adbl2d(j, i)
1919  end do
1920  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 1799 of file MemoryManager.f90.

1800  integer(I4B), dimension(:), pointer, contiguous, intent(inout) :: aint !< returned copy of 1d integer array
1801  character(len=*), intent(in) :: name !< variable name
1802  character(len=*), intent(in) :: mem_path !< path where variable is stored
1803  character(len=*), intent(in), optional :: mem_path_copy !< optional path where the copy will be stored,
1804  !! if passed then the copy is added to the
1805  !! memory manager
1806  ! -- local
1807  type(MemoryType), pointer :: mt
1808  logical(LGP) :: found
1809  integer(I4B) :: n
1810  ! -- code
1811  call get_from_memorystore(name, mem_path, mt, found)
1812  aint => null()
1813  ! -- check the copy into the memory manager
1814  if (present(mem_path_copy)) then
1815  call allocate_int1d(aint, size(mt%aint1d), mt%name, mem_path_copy)
1816  ! -- create a local copy
1817  else
1818  allocate (aint(size(mt%aint1d)))
1819  end if
1820  do n = 1, size(mt%aint1d)
1821  aint(n) = mt%aint1d(n)
1822  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 1827 of file MemoryManager.f90.

1828  integer(I4B), dimension(:, :), pointer, contiguous, intent(inout) :: aint !< returned copy of 2d integer array
1829  character(len=*), intent(in) :: name !< variable name
1830  character(len=*), intent(in) :: mem_path !< path where variable is stored
1831  character(len=*), intent(in), optional :: mem_path_copy !< optional path where the copy will be stored,
1832  !! if passed then the copy is added to the
1833  !! memory manager
1834  ! -- local
1835  type(MemoryType), pointer :: mt
1836  logical(LGP) :: found
1837  integer(I4B) :: i
1838  integer(I4B) :: j
1839  integer(I4B) :: ncol
1840  integer(I4B) :: nrow
1841  ! -- code
1842  call get_from_memorystore(name, mem_path, mt, found)
1843  aint => null()
1844  ncol = size(mt%aint2d, dim=1)
1845  nrow = size(mt%aint2d, dim=2)
1846  ! -- check the copy into the memory manager
1847  if (present(mem_path_copy)) then
1848  call allocate_int2d(aint, ncol, nrow, mt%name, mem_path_copy)
1849  ! -- create a local copy
1850  else
1851  allocate (aint(ncol, nrow))
1852  end if
1853  do i = 1, nrow
1854  do j = 1, ncol
1855  aint(j, i) = mt%aint2d(j, i)
1856  end do
1857  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 1771 of file MemoryManager.f90.

1772  logical(LGP), dimension(:), pointer, contiguous, intent(inout) :: alog !< returned copy of 1d logical array
1773  character(len=*), intent(in) :: name !< variable name
1774  character(len=*), intent(in) :: mem_path !< path where variable is stored
1775  character(len=*), intent(in), optional :: mem_path_copy !< optional path where the copy will be stored,
1776  !! if passed then the copy is added to the
1777  !! memory manager
1778  ! -- local
1779  type(MemoryType), pointer :: mt
1780  logical(LGP) :: found
1781  integer(I4B) :: n
1782  ! -- code
1783  call get_from_memorystore(name, mem_path, mt, found)
1784  alog => null()
1785  ! -- check the copy into the memory manager
1786  if (present(mem_path_copy)) then
1787  call allocate_logical1d(alog, size(mt%alogical1d), mt%name, mem_path_copy)
1788  ! -- create a local copy
1789  else
1790  allocate (alog(size(mt%alogical1d)))
1791  end if
1792  do n = 1, size(mt%alogical1d)
1793  alog(n) = mt%alogical1d(n)
1794  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 2160 of file MemoryManager.f90.

2161  type(CharacterStringType), dimension(:), pointer, contiguous, &
2162  intent(inout) :: astr1d !< array of strings
2163  character(len=*), optional, intent(in) :: name !< variable name
2164  character(len=*), optional, intent(in) :: mem_path !< path where variable is stored
2165  ! -- code
2166  return

◆ deallocate_dbl()

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

Definition at line 2187 of file MemoryManager.f90.

2188  real(DP), pointer, intent(inout) :: sclr !< real variable to deallocate
2189  ! -- code
2190  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 2235 of file MemoryManager.f90.

2236  real(DP), dimension(:), pointer, contiguous, intent(inout) :: adbl !< 1d real array to deallocate
2237  character(len=*), optional :: name !< variable name
2238  character(len=*), optional :: mem_path !< path where variable is stored
2239  ! -- code
2240  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 2245 of file MemoryManager.f90.

2246  real(DP), dimension(:, :), pointer, contiguous, intent(inout) :: adbl !< 2d real array to deallocate
2247  character(len=*), optional :: name !< variable name
2248  character(len=*), optional :: mem_path !< path where variable is stored
2249  ! -- code
2250  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 2255 of file MemoryManager.f90.

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

◆ deallocate_int()

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

Definition at line 2179 of file MemoryManager.f90.

2180  integer(I4B), pointer, intent(inout) :: sclr !< integer variable to deallocate
2181  ! -- code
2182  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 2205 of file MemoryManager.f90.

2206  integer(I4B), dimension(:), pointer, contiguous, intent(inout) :: aint !< 1d integer array to deallocate
2207  character(len=*), optional :: name !< variable name
2208  character(len=*), optional :: mem_path !< path where variable is stored
2209  ! -- code
2210  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 2215 of file MemoryManager.f90.

2216  integer(I4B), dimension(:, :), pointer, contiguous, intent(inout) :: aint !< 2d integer array to deallocate
2217  character(len=*), optional :: name !< variable name
2218  character(len=*), optional :: mem_path !< path where variable is stored
2219  ! -- code
2220  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 2225 of file MemoryManager.f90.

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

◆ deallocate_logical()

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

Definition at line 2171 of file MemoryManager.f90.

2172  logical(LGP), pointer, intent(inout) :: sclr !< logical scalar to deallocate
2173  ! -- code
2174  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 2195 of file MemoryManager.f90.

2196  logical(LGP), dimension(:), pointer, contiguous, intent(inout) :: alog !< 1d logical array to deallocate
2197  character(len=*), optional :: name !< variable name
2198  character(len=*), optional :: mem_path !< path where variable is stored
2199  ! -- code
2200  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 2137 of file MemoryManager.f90.

2138  character(len=*), pointer, intent(inout) :: sclr !< pointer to string
2139  character(len=*), intent(in), optional :: name !< variable name
2140  character(len=*), intent(in), optional :: mem_path !< path where variable is stored
2141  ! -- code
2142  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 2148 of file MemoryManager.f90.

2149  character(len=*), dimension(:), pointer, contiguous, intent(inout) :: astr1d !< array of strings
2150  character(len=*), optional, intent(in) :: name !< variable name
2151  character(len=*), optional, intent(in) :: mem_path !< path where variable is stored
2152  ! -- code
2153  return
2154 

◆ 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 304 of file MemoryManager.f90.

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

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

211  character(len=*), intent(in) :: name !< variable name
212  character(len=*), intent(in) :: mem_path !< path where the variable is stored
213  integer(I4B), intent(out) :: size !< size of the variable in bytes
214  ! -- local
215  type(MemoryType), pointer :: mt => null()
216  logical(LGP) :: found
217  ! -- code
218  !
219  ! -- initialize size to a value to communicate failure
220  size = -1
221  !
222  ! -- get the entry from the memory manager
223  call get_from_memorystore(name, mem_path, mt, found)
224  !
225  ! -- set memory size
226  if (found) then
227  size = mt%element_size
228  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
186  call get_from_memorystore(name, mem_path, mt, found)
187  !
188  ! -- set rank
189  if (found) then
190  if (associated(mt%logicalsclr)) rank = 0
191  if (associated(mt%intsclr)) rank = 0
192  if (associated(mt%dblsclr)) rank = 0
193  if (associated(mt%alogical1d)) rank = 1
194  if (associated(mt%aint1d)) rank = 1
195  if (associated(mt%aint2d)) rank = 2
196  if (associated(mt%aint3d)) rank = 3
197  if (associated(mt%adbl1d)) rank = 1
198  if (associated(mt%adbl2d)) rank = 2
199  if (associated(mt%adbl3d)) rank = 3
200  if (associated(mt%strsclr)) rank = 0
201  if (associated(mt%astr1d)) rank = 1
202  if (associated(mt%acharstr1d)) rank = 1
203  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 236 of file MemoryManager.f90.

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

2508  ! -- local
2509  ! -- formats
2510  ! -- code
2511  call memtab%table_da()
2512  deallocate (memtab)
2513  nullify (memtab)
Here is the caller graph for this function:

◆ mem_da()

subroutine, public memorymanagermodule::mem_da

Definition at line 2691 of file MemoryManager.f90.

2692  ! -- modules
2693  use versionmodule, only: idevelopmode
2694  ! -- local
2695  class(MemoryType), pointer :: mt
2696  type(MemoryContainerIteratorType), allocatable :: itr
2697  ! -- code
2698  itr = memorystore%iterator()
2699  do while (itr%has_next())
2700  call itr%next()
2701  mt => itr%value()
2702  call mt%mt_deallocate()
2703  if (idevelopmode == 1) call mem_da_check(mt)
2704  deallocate (mt)
2705  end do
2706 
2707  call memorystore%clear()
2708  if (count_errors() > 0) then
2709  call store_error('Could not clear memory list.', terminate=.true.)
2710  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 2713 of file MemoryManager.f90.

2714  ! -- modules
2715  use inputoutputmodule, only: upcase
2716  ! -- dummy
2717  class(MemoryType), pointer :: mt
2718  ! -- local
2719  character(len=LINELENGTH) :: error_msg
2720  character(len=LENVARNAME) :: ucname
2721  !
2722  ! -- check if memory has been deallocated
2723  if (mt%mt_associated() .and. mt%element_size == -1) then
2724  error_msg = trim(adjustl(mt%path))//' '// &
2725  trim(adjustl(mt%name))//' has invalid element size'
2726  call store_error(trim(error_msg))
2727  end if
2728  !
2729  ! -- check if memory has been deallocated
2730  if (mt%mt_associated() .and. mt%isize > 0) then
2731  error_msg = trim(adjustl(mt%path))//' '// &
2732  trim(adjustl(mt%name))//' not deallocated'
2733  call store_error(trim(error_msg))
2734  end if
2735  !
2736  ! -- check case of varname
2737  ucname = mt%name
2738  call upcase(ucname)
2739  if (mt%name /= ucname) then
2740  error_msg = trim(adjustl(mt%path))//' '// &
2741  trim(adjustl(mt%name))//' not upper case'
2742  call store_error(trim(error_msg))
2743  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 2339 of file MemoryManager.f90.

2340  integer(I4B), intent(in) :: iout !< unit number for mfsim.lst
2341  integer(I4B), intent(in) :: nrows !< number of table rows
2342  ! -- local
2343  character(len=LINELENGTH) :: title
2344  character(len=LINELENGTH) :: text
2345  integer(I4B) :: nterms
2346  ! -- formats
2347  ! -- code
2348  nterms = 5
2349  !
2350  ! -- set up table title
2351  title = 'DETAILED INFORMATION ON VARIABLES STORED IN THE MEMORY MANAGER'
2352  !
2353  ! -- set up stage tableobj
2354  call table_cr(memtab, 'MEM DET', title)
2355  call memtab%table_df(nrows, nterms, iout)
2356  !
2357  ! -- origin
2358  text = 'ORIGIN'
2359  call memtab%initialize_column(text, lenmempath, alignment=tableft)
2360  !
2361  ! -- variable
2362  text = 'VARIABLE NAME'
2363  call memtab%initialize_column(text, lenvarname, alignment=tableft)
2364  !
2365  ! -- data type
2366  text = 'DATA TYPE'
2367  call memtab%initialize_column(text, 16, alignment=tableft)
2368  !
2369  ! -- size
2370  text = 'NUMBER OF ITEMS'
2371  call memtab%initialize_column(text, 20, alignment=tabright)
2372  !
2373  ! -- is it a pointer
2374  text = 'ASSOCIATED VARIABLE'
2375  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 2617 of file MemoryManager.f90.

2618  integer(I4B) :: iout
2619  ! local
2620  class(MemoryType), pointer :: mt
2621  type(MemoryContainerIteratorType), allocatable :: itr
2622 
2623  call mem_detailed_table(iout, memorystore%count())
2624  itr = memorystore%iterator()
2625  do while (itr%has_next())
2626  call itr%next()
2627  mt => itr%value()
2628  call mt%table_entry(memtab)
2629  end do
2630  call mem_cleanup_table()
2631 
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 2661 of file MemoryManager.f90.

2662  type(MemoryType), pointer, intent(inout) :: mt
2663 
2664  if (.not. mt%mt_associated()) return
2665 
2666  if (mt%master) then
2667  if (mt%memtype(1:6) == 'STRING') then
2668  ! nvalues_astr increments differ: scalar adds element_size (ilen),
2669  ! arrays (str1d, charstr1d) add isize only. For IDM release the
2670  ! variables are arrays, so decrement by isize to match.
2671  if (mt%isize == 1) then
2672  nvalues_astr = nvalues_astr - mt%element_size
2673  else
2674  nvalues_astr = nvalues_astr - mt%isize
2675  end if
2676  else if (mt%memtype(1:7) == 'LOGICAL') then
2677  nvalues_alogical = nvalues_alogical - mt%isize
2678  else if (mt%memtype(1:7) == 'INTEGER') then
2679  nvalues_aint = nvalues_aint - mt%isize
2680  else if (mt%memtype(1:6) == 'DOUBLE') then
2681  nvalues_adbl = nvalues_adbl - mt%isize
2682  end if
2683  end if
2684 
2685  call mt%mt_deallocate()
2686  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 2265 of file MemoryManager.f90.

2266  integer(I4B), intent(in) :: iout !< unit number for mfsim.lst
2267  character(len=*), intent(in) :: keyword !< memory print option
2268  character(len=*), intent(inout) :: error_msg !< returned error message if keyword is not valid option
2269  ! -- local
2270  ! -- format
2271  ! -- code
2272  select case (keyword)
2273  case ('NONE')
2274  iprmem = 0
2275  write (iout, '(4x, a)') &
2276  'LIMITED MEMORY INFORMATION WILL BE WRITTEN.'
2277  case ('SUMMARY')
2278  iprmem = 1
2279  write (iout, '(4x, a)') &
2280  'A SUMMARY OF SIMULATION MEMORY INFORMATION WILL BE WRITTEN.'
2281  case ('ALL')
2282  iprmem = 2
2283  write (iout, '(4x, a)') &
2284  'ALL SIMULATION MEMORY INFORMATION WILL BE WRITTEN.'
2285  case default
2286  error_msg = "Unknown memory print option '"//trim(keyword)//"."
2287  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 2380 of file MemoryManager.f90.

2381  character(len=*), intent(in) :: component !< character defining the program component (e.g. solution)
2382  real(DP), intent(in) :: rchars !< allocated size of characters (in common units)
2383  real(DP), intent(in) :: rlog !< allocated size of logical (in common units)
2384  real(DP), intent(in) :: rint !< allocated size of integer variables (in common units)
2385  real(DP), intent(in) :: rreal !< allocated size of real variables (in common units)
2386  real(DP), intent(in) :: bytes !< total allocated memory in memory manager (in common units)
2387  ! -- formats
2388  ! -- code
2389  !
2390  ! -- write line
2391  call memtab%add_term(component)
2392  call memtab%add_term(rchars)
2393  call memtab%add_term(rlog)
2394  call memtab%add_term(rint)
2395  call memtab%add_term(rreal)
2396  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 2292 of file MemoryManager.f90.

2293  integer(I4B), intent(in) :: iout !< unit number for mfsim.lst
2294  integer(I4B), intent(in) :: nrows !< number of table rows
2295  character(len=*), intent(in) :: cunits !< memory units (bytes, kilobytes, megabytes, or gigabytes)
2296  ! -- local
2297  character(len=LINELENGTH) :: title
2298  character(len=LINELENGTH) :: text
2299  integer(I4B) :: nterms
2300  ! -- formats
2301  ! -- code
2302  nterms = 6
2303  !
2304  ! -- set up table title
2305  title = 'SUMMARY INFORMATION ON VARIABLES STORED IN THE MEMORY MANAGER, '// &
2306  'IN '//trim(cunits)
2307  !
2308  ! -- set up stage tableobj
2309  call table_cr(memtab, 'MEM SUM', title)
2310  call memtab%table_df(nrows, nterms, iout)
2311  !
2312  ! -- data type
2313  text = 'COMPONENT'
2314  call memtab%initialize_column(text, 20, alignment=tableft)
2315  !
2316  ! -- memory allocated for characters
2317  text = 'CHARACTER'
2318  call memtab%initialize_column(text, 15, alignment=tabcenter)
2319  !
2320  ! -- memory allocated for logical
2321  text = 'LOGICAL'
2322  call memtab%initialize_column(text, 15, alignment=tabcenter)
2323  !
2324  ! -- memory allocated for integers
2325  text = 'INTEGER'
2326  call memtab%initialize_column(text, 15, alignment=tabcenter)
2327  !
2328  ! -- memory allocated for reals
2329  text = 'REAL'
2330  call memtab%initialize_column(text, 15, alignment=tabcenter)
2331  !
2332  ! -- total memory allocated
2333  text = 'TOTAL'
2334  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 2432 of file MemoryManager.f90.

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

2750  ! -- modules
2752  ! -- dummy
2753  character(len=LENMEMADDRESS), allocatable, dimension(:), intent(inout) :: &
2754  cunique !< array with unique first components
2755  ! -- local
2756  class(MemoryType), pointer :: mt
2757  character(len=LENMEMPATH) :: context
2758  character(len=LENCOMPONENTNAME) :: component
2759  character(len=LENCOMPONENTNAME) :: subcomponent
2760  character(len=LENMEMADDRESS) :: context_component
2761  type(MemoryContainerIteratorType), allocatable :: itr
2762  integer(I4B) :: ipa
2763  ! -- code
2764  !
2765  ! -- initialize cunique
2766  allocate (cunique(0))
2767  !
2768  ! -- find unique origins
2769  itr = memorystore%iterator()
2770  do while (itr%has_next())
2771  call itr%next()
2772  mt => itr%value()
2773  call split_mem_path(mt%path, component, subcomponent)
2774  context = get_mem_path_context(mt%path)
2775  context_component = trim(context)//component
2776  ipa = ifind(cunique, context_component)
2777  if (ipa < 1) then
2778  call expandarray(cunique, 1)
2779  cunique(size(cunique)) = context_component
2780  end if
2781  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 2401 of file MemoryManager.f90.

2402  ! -- dummy
2403  real(DP), intent(in) :: bytes !< total nr. of bytes
2404  real(DP), intent(inout) :: fact !< conversion factor
2405  character(len=*), intent(inout) :: cunits !< string with memory unit
2406  ! -- local
2407  ! -- formats
2408  ! -- code
2409  !
2410  ! -- initialize factor and unit string
2411  cunits = 'UNKNOWN'
2412  fact = done
2413  !
2414  ! -- set factor
2415  if (bytes < dep3) then
2416  fact = done
2417  cunits = 'BYTES'
2418  else if (bytes < dep6) then
2419  fact = dem3
2420  cunits = 'KILOBYTES'
2421  else if (bytes < dep9) then
2422  fact = dem6
2423  cunits = 'MEGABYTES'
2424  else
2425  fact = dem9
2426  cunits = 'GIGABYTES'
2427  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 2522 of file MemoryManager.f90.

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

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

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

1536  real(DP), dimension(:, :), pointer, contiguous, intent(inout) :: adbl !< the reallocated 2d real array
1537  integer(I4B), intent(in) :: ncol !< number of columns
1538  integer(I4B), intent(in) :: nrow !< number of rows
1539  character(len=*), intent(in) :: name !< variable name
1540  character(len=*), intent(in) :: mem_path !< path where variable is stored
1541  ! -- local
1542  type(MemoryType), pointer :: mt
1543  logical(LGP) :: found
1544  integer(I4B) :: istat
1545  integer(I4B), dimension(2) :: ishape
1546  integer(I4B) :: i
1547  integer(I4B) :: j
1548  integer(I4B) :: isize
1549  integer(I4B) :: isizeold
1550  ! -- code
1551  !
1552  ! -- Find and assign mt
1553  call get_from_memorystore(name, mem_path, mt, found)
1554  !
1555  ! -- Allocate adbl and then refill
1556  ishape = shape(mt%adbl2d)
1557  isize = nrow * ncol
1558  isizeold = ishape(1) * ishape(2)
1559  allocate (adbl(ncol, nrow), stat=istat, errmsg=errmsg)
1560  if (istat /= 0) then
1561  call allocate_error(name, mem_path, istat, isize)
1562  end if
1563  do i = 1, ishape(2)
1564  do j = 1, ishape(1)
1565  adbl(j, i) = mt%adbl2d(j, i)
1566  end do
1567  end do
1568  !
1569  ! -- deallocate mt pointer, repoint, recalculate isize
1570  deallocate (mt%adbl2d)
1571  mt%adbl2d => adbl
1572  mt%element_size = dp
1573  mt%isize = isize
1574  mt%nrealloc = mt%nrealloc + 1
1575  mt%master = .true.
1576  nvalues_adbl = nvalues_adbl + isize - isizeold
1577  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 1403 of file MemoryManager.f90.

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

1446  integer(I4B), dimension(:, :), pointer, contiguous, intent(inout) :: aint !< the reallocated 2d integer array
1447  integer(I4B), intent(in) :: ncol !< number of columns
1448  integer(I4B), intent(in) :: nrow !< number of rows
1449  character(len=*), intent(in) :: name !< variable name
1450  character(len=*), intent(in) :: mem_path !< path where variable is stored
1451  ! -- local
1452  type(MemoryType), pointer :: mt
1453  logical(LGP) :: found
1454  integer(I4B) :: istat
1455  integer(I4B), dimension(2) :: ishape
1456  integer(I4B) :: i
1457  integer(I4B) :: j
1458  integer(I4B) :: isize
1459  integer(I4B) :: isizeold
1460  ! -- code
1461  !
1462  ! -- Find and assign mt
1463  call get_from_memorystore(name, mem_path, mt, found)
1464  !
1465  ! -- Allocate aint and then refill
1466  ishape = shape(mt%aint2d)
1467  isize = nrow * ncol
1468  isizeold = ishape(1) * ishape(2)
1469  allocate (aint(ncol, nrow), stat=istat, errmsg=errmsg)
1470  if (istat /= 0) then
1471  call allocate_error(name, mem_path, istat, isize)
1472  end if
1473  do i = 1, ishape(2)
1474  do j = 1, ishape(1)
1475  aint(j, i) = mt%aint2d(j, i)
1476  end do
1477  end do
1478  !
1479  ! -- deallocate mt pointer, repoint, recalculate isize
1480  deallocate (mt%aint2d)
1481  mt%aint2d => aint
1482  mt%element_size = i4b
1483  mt%isize = isize
1484  mt%nrealloc = mt%nrealloc + 1
1485  mt%master = .true.
1486  nvalues_aint = nvalues_aint + isize - isizeold
1487  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 1361 of file MemoryManager.f90.

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

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

2072  real(DP), dimension(:), pointer, contiguous, intent(inout) :: adbl !< pointer to 1d real array
2073  character(len=*), intent(in) :: name !< variable name
2074  character(len=*), intent(in) :: mem_path !< path where variable is stored
2075  character(len=*), intent(in) :: name_target !< name of target variable
2076  character(len=*), intent(in) :: mem_path_target !< path where target variable is stored
2077  ! -- local
2078  type(MemoryType), pointer :: mt
2079  type(MemoryType), pointer :: mt2
2080  logical(LGP) :: found
2081  ! -- code
2082  call get_from_memorystore(name, mem_path, mt, found)
2083  call get_from_memorystore(name_target, mem_path_target, mt2, found)
2084  if (size(adbl) > 0) then
2085  nvalues_adbl = nvalues_adbl - size(adbl)
2086  deallocate (adbl)
2087  end if
2088  adbl => mt2%adbl1d
2089  mt%adbl1d => adbl
2090  mt%element_size = dp
2091  mt%isize = size(adbl)
2092  write (mt%memtype, "(a,' (',i0,')')") 'DOUBLE', mt%isize
2093  !
2094  ! -- set master information
2095  mt%master = .false.
2096  mt%mastername = name_target
2097  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 2102 of file MemoryManager.f90.

2103  real(DP), dimension(:, :), pointer, contiguous, intent(inout) :: adbl !< pointer to 2d real array
2104  character(len=*), intent(in) :: name !< variable name
2105  character(len=*), intent(in) :: mem_path !< path where variable is stored
2106  character(len=*), intent(in) :: name_target !< name of target variable
2107  character(len=*), intent(in) :: mem_path_target !< path where target variable is stored
2108  ! -- local
2109  type(MemoryType), pointer :: mt
2110  type(MemoryType), pointer :: mt2
2111  logical(LGP) :: found
2112  integer(I4B) :: ncol
2113  integer(I4b) :: nrow
2114  ! -- code
2115  call get_from_memorystore(name, mem_path, mt, found)
2116  call get_from_memorystore(name_target, mem_path_target, mt2, found)
2117  if (size(adbl) > 0) then
2118  nvalues_adbl = nvalues_adbl - size(adbl)
2119  deallocate (adbl)
2120  end if
2121  adbl => mt2%adbl2d
2122  mt%adbl2d => adbl
2123  mt%element_size = dp
2124  mt%isize = size(adbl)
2125  ncol = size(adbl, dim=1)
2126  nrow = size(adbl, dim=2)
2127  write (mt%memtype, "(a,' (',i0,',',i0,')')") 'DOUBLE', ncol, nrow
2128  !
2129  ! -- set master information
2130  mt%master = .false.
2131  mt%mastername = name_target
2132  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 1942 of file MemoryManager.f90.

1943  integer(I4B), pointer, intent(inout) :: sclr !< pointer to integer scalar
1944  character(len=*), intent(in) :: name !< variable name
1945  character(len=*), intent(in) :: mem_path !< path where variable is stored
1946  character(len=*), intent(in) :: name_target !< name of target variable
1947  character(len=*), intent(in) :: mem_path_target !< path where target variable is stored
1948  ! -- local
1949  type(MemoryType), pointer :: mt
1950  type(MemoryType), pointer :: mt2
1951  logical(LGP) :: found
1952  ! -- code
1953  call get_from_memorystore(name, mem_path, mt, found)
1954  call get_from_memorystore(name_target, mem_path_target, mt2, found)
1955  if (associated(sclr)) then
1956  nvalues_aint = nvalues_aint - 1
1957  deallocate (sclr)
1958  end if
1959  sclr => mt2%intsclr
1960  mt%intsclr => sclr
1961  mt%element_size = i4b
1962  mt%isize = 1
1963  write (mt%memtype, "(a,' (',i0,')')") 'INTEGER', mt%isize
1964  !
1965  ! -- set master information
1966  mt%master = .false.
1967  mt%mastername = name_target
1968  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 2005 of file MemoryManager.f90.

2006  integer(I4B), dimension(:), pointer, contiguous, intent(inout) :: aint !< pointer to 1d integer array
2007  character(len=*), intent(in) :: name !< variable name
2008  character(len=*), intent(in) :: mem_path !< path where variable is stored
2009  character(len=*), intent(in) :: name_target !< name of target variable
2010  character(len=*), intent(in) :: mem_path_target !< path where target variable is stored
2011  ! -- local
2012  type(MemoryType), pointer :: mt
2013  type(MemoryType), pointer :: mt2
2014  logical(LGP) :: found
2015  ! -- code
2016  call get_from_memorystore(name, mem_path, mt, found)
2017  call get_from_memorystore(name_target, mem_path_target, mt2, found)
2018  if (size(aint) > 0) then
2019  nvalues_aint = nvalues_aint - size(aint)
2020  deallocate (aint)
2021  end if
2022  aint => mt2%aint1d
2023  mt%aint1d => aint
2024  mt%element_size = i4b
2025  mt%isize = size(aint)
2026  write (mt%memtype, "(a,' (',i0,')')") 'INTEGER', mt%isize
2027  !
2028  ! -- set master information
2029  mt%master = .false.
2030  mt%mastername = name_target
2031  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 2036 of file MemoryManager.f90.

2037  integer(I4B), dimension(:, :), pointer, contiguous, intent(inout) :: aint !< pointer to 2d integer array
2038  character(len=*), intent(in) :: name !< variable name
2039  character(len=*), intent(in) :: mem_path !< path where variable is stored
2040  character(len=*), intent(in) :: name_target !< name of target variable
2041  character(len=*), intent(in) :: mem_path_target !< path where target variable is stored
2042  ! -- local
2043  type(MemoryType), pointer :: mt
2044  type(MemoryType), pointer :: mt2
2045  logical(LGP) :: found
2046  integer(I4B) :: ncol
2047  integer(I4B) :: nrow
2048  ! -- code
2049  call get_from_memorystore(name, mem_path, mt, found)
2050  call get_from_memorystore(name_target, mem_path_target, mt2, found)
2051  if (size(aint) > 0) then
2052  nvalues_aint = nvalues_aint - size(aint)
2053  deallocate (aint)
2054  end if
2055  aint => mt2%aint2d
2056  mt%aint2d => aint
2057  mt%element_size = i4b
2058  mt%isize = size(aint)
2059  ncol = size(aint, dim=1)
2060  nrow = size(aint, dim=2)
2061  write (mt%memtype, "(a,' (',i0,',',i0,')')") 'INTEGER', ncol, nrow
2062  !
2063  ! -- set master information
2064  mt%master = .false.
2065  mt%mastername = name_target
2066  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 1973 of file MemoryManager.f90.

1975  logical(LGP), dimension(:), pointer, contiguous, intent(inout) :: alog !< array pointer
1976  character(len=*), intent(in) :: name !< variable name
1977  character(len=*), intent(in) :: mem_path !< path where variable is stored
1978  character(len=*), intent(in) :: name_target !< name of target variable
1979  character(len=*), intent(in) :: mem_path_target !< path where target variable is stored
1980  ! -- local
1981  type(MemoryType), pointer :: mt
1982  type(MemoryType), pointer :: mt2
1983  logical(LGP) :: found
1984  ! -- code
1985  call get_from_memorystore(name, mem_path, mt, found)
1986  call get_from_memorystore(name_target, mem_path_target, mt2, found)
1987  if (size(alog) > 0) then
1988  nvalues_alogical = nvalues_alogical - size(alog)
1989  deallocate (alog)
1990  end if
1991  alog => mt2%alogical1d
1992  mt%alogical1d => alog
1993  mt%element_size = lgp
1994  mt%isize = size(alog)
1995  write (mt%memtype, "(a,' (',i0,')')") 'LOGICAL', mt%isize
1996  !
1997  ! -- set master information
1998  mt%master = .false.
1999  mt%mastername = name_target
2000  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 1756 of file MemoryManager.f90.

1757  type(CharacterStringType), dimension(:), pointer, contiguous, &
1758  intent(inout) :: acharstr1d !< the reallocated charstring array
1759  character(len=*), intent(in) :: name !< variable name
1760  character(len=*), intent(in) :: mem_path !< path where variable is stored
1761  ! -- local
1762  type(MemoryType), pointer :: mt
1763  logical(LGP) :: found
1764  ! -- code
1765  call get_from_memorystore(name, mem_path, mt, found)
1766  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 1666 of file MemoryManager.f90.

1667  real(DP), pointer, intent(inout) :: sclr !< pointer to a real scalar
1668  character(len=*), intent(in) :: name !< variable name
1669  character(len=*), intent(in) :: mem_path !< path where variable is stored
1670  ! -- local
1671  type(MemoryType), pointer :: mt
1672  logical(LGP) :: found
1673  ! -- code
1674  call get_from_memorystore(name, mem_path, mt, found)
1675  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 1680 of file MemoryManager.f90.

1681  real(DP), dimension(:), pointer, contiguous, intent(inout) :: adbl !< pointer to 1d real array
1682  character(len=*), intent(in) :: name !< variable name
1683  character(len=*), intent(in) :: mem_path !< path where variable is stored
1684  ! -- local
1685  type(MemoryType), pointer :: mt
1686  logical(LGP) :: found
1687  ! -- code
1688  call get_from_memorystore(name, mem_path, mt, found)
1689  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 1694 of file MemoryManager.f90.

1695  real(DP), dimension(:, :), pointer, contiguous, intent(inout) :: adbl !< pointer to 2d real array
1696  character(len=*), intent(in) :: name !< variable name
1697  character(len=*), intent(in) :: mem_path !< path where variable is stored
1698  ! -- local
1699  type(MemoryType), pointer :: mt
1700  logical(LGP) :: found
1701  ! -- code
1702  call get_from_memorystore(name, mem_path, mt, found)
1703  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 1708 of file MemoryManager.f90.

1709  real(DP), dimension(:, :, :), pointer, contiguous, intent(inout) :: adbl !< pointer to 3d real array
1710  character(len=*), intent(in) :: name !< variable name
1711  character(len=*), intent(in) :: mem_path !< path where variable is stored
1712  ! -- local
1713  type(MemoryType), pointer :: mt
1714  logical(LGP) :: found
1715  ! -- code
1716  call get_from_memorystore(name, mem_path, mt, found)
1717  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 1596 of file MemoryManager.f90.

1597  integer(I4B), pointer, intent(inout) :: sclr !< pointer to integer scalar
1598  character(len=*), intent(in) :: name !< variable name
1599  character(len=*), intent(in) :: mem_path !< path where variable is stored
1600  ! -- local
1601  type(MemoryType), pointer :: mt
1602  logical(LGP) :: found
1603  ! -- code
1604  call get_from_memorystore(name, mem_path, mt, found)
1605  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 1624 of file MemoryManager.f90.

1625  integer(I4B), dimension(:), pointer, contiguous, intent(inout) :: aint !< pointer to 1d integer array
1626  character(len=*), intent(in) :: name !< variable name
1627  character(len=*), intent(in) :: mem_path !< path where variable is stored
1628  ! -- local
1629  type(MemoryType), pointer :: mt
1630  logical(LGP) :: found
1631  ! -- code
1632  call get_from_memorystore(name, mem_path, mt, found)
1633  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 1638 of file MemoryManager.f90.

1639  integer(I4B), dimension(:, :), pointer, contiguous, intent(inout) :: aint !< pointer to 2d integer array
1640  character(len=*), intent(in) :: name !< variable name
1641  character(len=*), intent(in) :: mem_path !< path where variable is stored
1642  ! -- local
1643  type(MemoryType), pointer :: mt
1644  logical(LGP) :: found
1645  ! -- code
1646  call get_from_memorystore(name, mem_path, mt, found)
1647  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 1652 of file MemoryManager.f90.

1653  integer(I4B), dimension(:, :, :), pointer, contiguous, intent(inout) :: aint !< pointer to 3d integer array
1654  character(len=*), intent(in) :: name !< variable name
1655  character(len=*), intent(in) :: mem_path !< path where variable is stored
1656  ! -- local
1657  type(MemoryType), pointer :: mt
1658  logical(LGP) :: found
1659  ! -- code
1660  call get_from_memorystore(name, mem_path, mt, found)
1661  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 1582 of file MemoryManager.f90.

1583  logical(LGP), pointer, intent(inout) :: sclr !< pointer to logical scalar
1584  character(len=*), intent(in) :: name !< variable name
1585  character(len=*), intent(in) :: mem_path !< path where variable is stored
1586  ! -- local
1587  type(MemoryType), pointer :: mt
1588  logical(LGP) :: found
1589  ! -- code
1590  call get_from_memorystore(name, mem_path, mt, found)
1591  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 1610 of file MemoryManager.f90.

1611  logical(LGP), dimension(:), pointer, contiguous, intent(inout) :: alog !< pointer to 1d logical array
1612  character(len=*), intent(in) :: name !< variable name
1613  character(len=*), intent(in) :: mem_path !< path where variable is stored
1614  ! -- local
1615  type(MemoryType), pointer :: mt
1616  logical(LGP) :: found
1617  ! -- code
1618  call get_from_memorystore(name, mem_path, mt, found)
1619  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 1722 of file MemoryManager.f90.

1723  character(len=:), pointer :: asrt !< pointer to the character string
1724  character(len=*), intent(in) :: name !< variable name
1725  character(len=*), intent(in) :: mem_path !< path where variable is stored
1726  ! -- local
1727  type(MemoryType), pointer :: mt
1728  logical(LGP) :: found
1729  ! -- code
1730  call get_from_memorystore(name, mem_path, mt, found)
1731  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 1736 of file MemoryManager.f90.

1737  character(len=:), dimension(:), &
1738  pointer, contiguous, intent(inout) :: astr1d !< pointer to the string array
1739  character(len=*), intent(in) :: name !< variable name
1740  character(len=*), intent(in) :: mem_path !< path where variable is stored
1741  ! -- local
1742  type(MemoryType), pointer :: mt
1743  logical(LGP) :: found
1744  ! -- code
1745  call get_from_memorystore(name, mem_path, mt, found)
1746  select type (item => mt%astr1d)
1747  type is (character(*))
1748  astr1d => item
1749  class default
1750  astr1d => null()
1751  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