MODFLOW 6  version 6.8.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 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)
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 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)
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 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 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 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 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 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)
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 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)
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 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 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 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 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 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)
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 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)
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 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 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 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)
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 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)
Here is the call graph for this function:

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