MODFLOW 6  version 6.7.0.dev3
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 54 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 552 of file MemoryManager.f90.

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

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

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

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

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

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

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

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

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

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

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

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

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

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