MODFLOW 6  version 6.9.0.dev0
USGS Modular Hydrologic Model
memorymanagermodule::mem_allocate Interface Reference
Collaboration diagram for memorymanagermodule::mem_allocate:
Collaboration graph

Private Member Functions

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_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 allocate_charstr1d (acharstr1d, ilen, nrow, name, mem_path)
 Allocate a 1-dimensional array of deferred-length CharacterStringType. More...
 

Detailed Description

Definition at line 55 of file MemoryManager.f90.

Member Function/Subroutine Documentation

◆ allocate_charstr1d()

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

Definition at line 554 of file MemoryManager.f90.

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

◆ allocate_dbl()

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

Definition at line 782 of file MemoryManager.f90.

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

◆ allocate_dbl1d()

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

Definition at line 820 of file MemoryManager.f90.

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

◆ allocate_dbl2d()

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

Definition at line 863 of file MemoryManager.f90.

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

◆ allocate_dbl3d()

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

Definition at line 907 of file MemoryManager.f90.

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

◆ allocate_int()

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

Definition at line 611 of file MemoryManager.f90.

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

◆ allocate_int1d()

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

Definition at line 649 of file MemoryManager.f90.

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

◆ allocate_int2d()

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

Definition at line 692 of file MemoryManager.f90.

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

◆ allocate_int3d()

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

Definition at line 736 of file MemoryManager.f90.

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

◆ allocate_logical()

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

Definition at line 360 of file MemoryManager.f90.

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

◆ allocate_logical1d()

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

Definition at line 398 of file MemoryManager.f90.

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

◆ allocate_str()

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

Definition at line 441 of file MemoryManager.f90.

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

◆ allocate_str1d()

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

Definition at line 490 of file MemoryManager.f90.

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

The documentation for this interface was generated from the following file: