MODFLOW 6  version 6.7.0.dev3
USGS Modular Hydrologic Model
loadmf6filemodule Module Reference

This module contains the LoadMf6FileModule. More...

Data Types

type  loadmf6filetype
 Static parser based input loader. More...
 

Functions/Subroutines

subroutine load (this, parser, mf6_input, nc_vars, filename, iout)
 load all static input blocks More...
 
subroutine init (this, parser, mf6_input, filename, iout)
 init More...
 
subroutine load_block (this, iblk)
 load a single block More...
 
subroutine finalize (this)
 finalize More...
 
subroutine block_post_process (this, iblk)
 Post parse block handling. More...
 
recursive subroutine parse_block (this, iblk, recursive_call)
 parse block More...
 
subroutine parse_io_tag (this, iblk, pkgtype, which, tag)
 
recursive subroutine parse_record_tag (this, iblk, inidt, recursive_call)
 
subroutine load_tag (this, iblk, idt)
 load input keyword Load input associated with tag key into the memory manager. More...
 
type(inputparamdefinitiontype) function block_index_dfn (this, iblk)
 
subroutine parse_structarray_block (this, iblk)
 parse a structured array record into memory manager More...
 
subroutine load_keyword_type (parser, idt, memoryPath, iout)
 load type keyword More...
 
subroutine load_string_type (parser, idt, memoryPath, iout)
 load type string More...
 
subroutine load_io_tag (parser, idt, memoryPath, which, iout)
 load io tag More...
 
subroutine load_auxvar_names (parser, idt, memoryPath, iout)
 load aux variable names More...
 
subroutine load_integer_type (parser, idt, memoryPath, iout)
 load type integer More...
 
subroutine load_integer1d_type (parser, idt, mf6_input, mshape, export, nc_vars, input_fname, iout)
 load type 1d integer More...
 
subroutine load_integer2d_type (parser, idt, mf6_input, mshape, export, nc_vars, input_fname, iout)
 load type 2d integer More...
 
subroutine load_integer3d_type (parser, idt, mf6_input, mshape, export, nc_vars, input_fname, iout)
 load type 3d integer More...
 
subroutine load_double_type (parser, idt, memoryPath, iout)
 load type double More...
 
subroutine load_double1d_type (parser, idt, mf6_input, mshape, export, nc_vars, input_fname, iout)
 load type 1d double More...
 
subroutine load_double2d_type (parser, idt, mf6_input, mshape, export, nc_vars, input_fname, iout)
 load type 2d double More...
 
subroutine load_double3d_type (parser, idt, mf6_input, mshape, export, nc_vars, input_fname, iout)
 load type 3d double More...
 
integer(i4b) function, public read_control_record (parser, oc_inunit, iout)
 

Detailed Description

This module contains the input data model routines for loading static data from a MODFLOW 6 input file using the block parser.

Function/Subroutine Documentation

◆ block_index_dfn()

type(inputparamdefinitiontype) function loadmf6filemodule::block_index_dfn ( class(loadmf6filetype this,
integer(i4b), intent(in)  iblk 
)
Returns
input data type object describing this record

Definition at line 515 of file LoadMf6File.f90.

516  class(LoadMf6FileType) :: this
517  integer(I4B), intent(in) :: iblk
518  type(InputParamDefinitionType) :: idt !< input data type object describing this record
519  character(len=LENVARNAME) :: varname
520  integer(I4B) :: ilen
521  character(len=3) :: block_suffix = 'NUM'
522 
523  ! assign first column as the block number
524  ilen = len_trim(this%mf6_input%block_dfns(iblk)%blockname)
525 
526  if (ilen > (lenvarname - len(block_suffix))) then
527  varname = &
528  this%mf6_input%block_dfns(iblk)% &
529  blockname(1:(lenvarname - len(block_suffix)))//block_suffix
530  else
531  varname = trim(this%mf6_input%block_dfns(iblk)%blockname)//block_suffix
532  end if
533 
534  idt%component_type = trim(this%mf6_input%component_type)
535  idt%subcomponent_type = trim(this%mf6_input%subcomponent_type)
536  idt%blockname = trim(this%mf6_input%block_dfns(iblk)%blockname)
537  idt%tagname = varname
538  idt%mf6varname = varname
539  idt%datatype = 'INTEGER'

◆ block_post_process()

subroutine loadmf6filemodule::block_post_process ( class(loadmf6filetype this,
integer(i4b), intent(in)  iblk 
)

Definition at line 196 of file LoadMf6File.f90.

197  use constantsmodule, only: lenboundname
200  class(LoadMf6FileType) :: this
201  integer(I4B), intent(in) :: iblk
202  type(InputParamDefinitionType), pointer :: idt
203  integer(I4B) :: iparam
204  integer(I4B), pointer :: intptr
205 
206  ! update state based on read tags
207  do iparam = 1, size(this%block_tags)
208  select case (this%mf6_input%block_dfns(iblk)%blockname)
209  case ('OPTIONS')
210  if (this%block_tags(iparam) == 'AUXILIARY') then
211  this%iauxiliary = 1
212  else if (this%block_tags(iparam) == 'BOUNDNAMES') then
213  this%inamedbound = 1
214  else if (this%block_tags(iparam) == 'READASARRAYS') then
215  this%readasarrays = .true.
216  else if (this%block_tags(iparam) == 'READARRAYGRID') then
217  this%readarraygrid = .true.
218  else if (this%block_tags(iparam) == 'TS6') then
219  this%ts_active = .true.
220  else if (this%block_tags(iparam) == 'EXPORT_ARRAY_ASCII') then
221  this%export = .true.
222  end if
223  case default
224  end select
225  end do
226 
227  ! update input context allocations based on dfn set and input
228  select case (this%mf6_input%block_dfns(iblk)%blockname)
229  case ('OPTIONS')
230  ! allocate naux and set to 0 if not allocated
231  do iparam = 1, size(this%mf6_input%param_dfns)
232  idt => this%mf6_input%param_dfns(iparam)
233  if (idt%blockname == 'OPTIONS' .and. &
234  idt%tagname == 'AUXILIARY') then
235  if (this%iauxiliary == 0) then
236  call mem_allocate(intptr, 'NAUX', this%mf6_input%mempath)
237  intptr = 0
238  end if
239  exit
240  end if
241  end do
242  case ('DIMENSIONS')
243  ! set model shape if discretization dimensions have been read
244  if (this%mf6_input%pkgtype(1:3) == 'DIS') then
245  call set_model_shape(this%mf6_input%pkgtype, this%filename, &
246  this%mf6_input%component_mempath, &
247  this%mf6_input%mempath, this%mshape)
248  end if
249  case default
250  end select
This module contains simulation constants.
Definition: Constants.f90:9
integer(i4b), parameter lenboundname
maximum length of a bound name
Definition: Constants.f90:36
This module contains the SourceCommonModule.
Definition: SourceCommon.f90:7
subroutine, public set_model_shape(ftype, fname, model_mempath, dis_mempath, model_shape)
routine for setting the model shape
This class is used to store a single deferred-length character string. It was designed to work in an ...
Definition: CharString.f90:23
Here is the call graph for this function:

◆ finalize()

subroutine loadmf6filemodule::finalize ( class(loadmf6filetype this)

init / finalize are only used when load_block() will be called

Definition at line 180 of file LoadMf6File.f90.

182  class(LoadMf6FileType) :: this
183  ! cleanup
184  if (associated(this%structarray)) then
185  ! destroy the structured array reader
186  call destructstructarray(this%structarray)
187  end if
188  ! close logging block
189  call idm_log_close(this%mf6_input%component_name, &
190  this%mf6_input%subcomponent_name, this%iout)
This module contains the StructArrayModule.
Definition: StructArray.f90:8
subroutine, public destructstructarray(struct_array)
destructor for a struct_array
Here is the call graph for this function:

◆ init()

subroutine loadmf6filemodule::init ( class(loadmf6filetype this,
type(blockparsertype), intent(inout), target  parser,
type(modflowinputtype), intent(in)  mf6_input,
character(len=*), intent(in)  filename,
integer(i4b), intent(in)  iout 
)

init / finalize are only used when load_block() will be called

Definition at line 117 of file LoadMf6File.f90.

118  use memorymanagermodule, only: get_isize
119  class(LoadMf6FileType) :: this
120  type(BlockParserType), target, intent(inout) :: parser
121  type(ModflowInputType), intent(in) :: mf6_input
122  character(len=*), intent(in) :: filename
123  integer(I4B), intent(in) :: iout
124  integer(I4B) :: isize
125 
126  this%parser => parser
127  this%mf6_input = mf6_input
128  this%filename = filename
129  this%ts_active = .false.
130  this%export = .false.
131  this%readasarrays = .false.
132  this%readarraygrid = .false.
133  this%inamedbound = 0
134  this%iauxiliary = 0
135  this%iout = iout
136 
137  call get_isize('MODEL_SHAPE', mf6_input%component_mempath, isize)
138  if (isize > 0) then
139  call mem_setptr(this%mshape, 'MODEL_SHAPE', mf6_input%component_mempath)
140  end if
141 
142  ! log lst file header
143  call idm_log_header(this%mf6_input%component_name, &
144  this%mf6_input%subcomponent_name, this%iout)
subroutine, public get_isize(name, mem_path, isize)
@ brief Get the number of elements for this variable
Here is the call graph for this function:

◆ load()

subroutine loadmf6filemodule::load ( class(loadmf6filetype this,
type(blockparsertype), intent(inout), target  parser,
type(modflowinputtype), intent(in)  mf6_input,
type(ncpackagevarstype), intent(in), pointer  nc_vars,
character(len=*), intent(in)  filename,
integer(i4b), intent(in)  iout 
)
private

Invoke this routine to load all static input blocks in single call.

Definition at line 84 of file LoadMf6File.f90.

86  class(LoadMf6FileType) :: this
87  type(BlockParserType), target, intent(inout) :: parser
88  type(ModflowInputType), intent(in) :: mf6_input
89  type(NCPackageVarsType), pointer, intent(in) :: nc_vars
90  character(len=*), intent(in) :: filename
91  integer(I4B), intent(in) :: iout
92  integer(I4B) :: iblk
93 
94  ! initialize static load
95  call this%init(parser, mf6_input, filename, iout)
96 
97  ! set netcdf vars
98  this%nc_vars => nc_vars
99 
100  ! process blocks
101  do iblk = 1, size(this%mf6_input%block_dfns)
102  ! don't load dynamic input data
103  if (this%mf6_input%block_dfns(iblk)%blockname == 'PERIOD') exit
104  ! load the block
105  call this%load_block(iblk)
106  end do
107 
108  ! finalize static load
109  call this%finalize()
Here is the call graph for this function:

◆ load_auxvar_names()

subroutine loadmf6filemodule::load_auxvar_names ( type(blockparsertype), intent(inout)  parser,
type(inputparamdefinitiontype), intent(in)  idt,
character(len=*), intent(in)  memoryPath,
integer(i4b), intent(in)  iout 
)
Parameters
[in,out]parserblock parser
[in]idtinput data type object describing this record
[in]memorypathmemorypath to put loaded information
[in]ioutunit number for output

Definition at line 723 of file LoadMf6File.f90.

725  use inputoutputmodule, only: urdaux
727  type(BlockParserType), intent(inout) :: parser !< block parser
728  type(InputParamDefinitionType), intent(in) :: idt !< input data type object describing this record
729  character(len=*), intent(in) :: memoryPath !< memorypath to put loaded information
730  integer(I4B), intent(in) :: iout !< unit number for output
731  character(len=:), allocatable :: line
732  character(len=LENAUXNAME), dimension(:), allocatable :: caux
733  integer(I4B) :: lloc
734  integer(I4B) :: istart
735  integer(I4B) :: istop
736  integer(I4B) :: i
737  character(len=LENPACKAGENAME) :: text = ''
738  integer(I4B), pointer :: intvar
739  type(CharacterStringType), dimension(:), &
740  pointer, contiguous :: acharstr1d !< variable for allocation
741  call mem_allocate(intvar, idt%shape, memorypath)
742  intvar = 0
743  call parser%GetRemainingLine(line)
744  lloc = 1
745  call urdaux(intvar, parser%iuactive, iout, lloc, &
746  istart, istop, caux, line, text)
747  call mem_allocate(acharstr1d, lenauxname, intvar, idt%mf6varname, memorypath)
748  do i = 1, intvar
749  acharstr1d(i) = caux(i)
750  end do
751  deallocate (line)
752  deallocate (caux)
integer(i4b), parameter linelength
maximum length of a standard line
Definition: Constants.f90:45
integer(i4b), parameter lenpackagename
maximum length of the package name
Definition: Constants.f90:23
integer(i4b), parameter lenauxname
maximum length of a aux variable
Definition: Constants.f90:35
subroutine, public urdaux(naux, inunit, iout, lloc, istart, istop, auxname, line, text)
Read auxiliary variables from an input line.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ load_block()

subroutine loadmf6filemodule::load_block ( class(loadmf6filetype this,
integer(i4b), intent(in)  iblk 
)

Assumed in order load of single (next) block. If a StructArray object is allocated to load this block it persists until this routine (or finalize) is called again.

Definition at line 155 of file LoadMf6File.f90.

157  class(LoadMf6FileType) :: this
158  integer(I4B), intent(in) :: iblk
159 
160  ! reset structarray if it was created for previous block
161  if (associated(this%structarray)) then
162  ! destroy the structured array reader
163  call destructstructarray(this%structarray)
164  end if
165 
166  allocate (this%block_tags(0))
167  ! load the block
168  call this%parse_block(iblk, .false.)
169  ! post process block
170  call this%block_post_process(iblk)
171  ! cleanup
172  deallocate (this%block_tags)
Here is the call graph for this function:

◆ load_double1d_type()

subroutine loadmf6filemodule::load_double1d_type ( type(blockparsertype), intent(inout)  parser,
type(inputparamdefinitiontype), intent(in)  idt,
type(modflowinputtype), intent(in)  mf6_input,
integer(i4b), dimension(:), intent(in), pointer, contiguous  mshape,
logical(lgp), intent(in)  export,
type(ncpackagevarstype), intent(in), pointer  nc_vars,
character(len=*), intent(in)  input_fname,
integer(i4b), intent(in)  iout 
)
private
Parameters
[in,out]parserblock parser
[in]idtinput data type object describing this record
[in]mf6_inputdescription of input
[in]mshapemodel shape
[in]exportexport to ascii layer files
[in]input_fnameascii input file name
[in]ioutunit number for output

Definition at line 959 of file LoadMf6File.f90.

963  type(BlockParserType), intent(inout) :: parser !< block parser
964  type(InputParamDefinitionType), intent(in) :: idt !< input data type object describing this record
965  type(ModflowInputType), intent(in) :: mf6_input !< description of input
966  integer(I4B), dimension(:), contiguous, pointer, intent(in) :: mshape !< model shape
967  logical(LGP), intent(in) :: export !< export to ascii layer files
968  type(NCPackageVarsType), pointer, intent(in) :: nc_vars
969  character(len=*), intent(in) :: input_fname !< ascii input file name
970  integer(I4B), intent(in) :: iout !< unit number for output
971  real(DP), dimension(:), pointer, contiguous :: dbl1d
972  integer(I4B) :: nlay
973  integer(I4B) :: nvals
974  integer(I4B), dimension(:), allocatable :: array_shape
975  integer(I4B), dimension(:), allocatable :: layer_shape
976  character(len=LINELENGTH) :: keyword
977 
978  ! Check if it is a full grid sized array (NODES)
979  if (idt%shape == 'NODES') then
980  nvals = product(mshape)
981  else
982  call get_shape_from_string(idt%shape, array_shape, mf6_input%mempath)
983  nvals = array_shape(1)
984  end if
985 
986  ! allocate memory for the array
987  call mem_allocate(dbl1d, nvals, idt%mf6varname, mf6_input%mempath)
988 
989  ! read keyword
990  keyword = ''
991  call parser%GetStringCaps(keyword)
992 
993  ! check for "NETCDF" and "LAYERED"
994  if (keyword == 'NETCDF') then
995  call netcdf_read_array(dbl1d, mshape, idt, mf6_input, nc_vars, &
996  input_fname, iout)
997  else if (keyword == 'LAYERED' .and. idt%layered) then
998  call get_layered_shape(mshape, nlay, layer_shape)
999  call read_dbl1d_layered(parser, dbl1d, idt%mf6varname, nlay, layer_shape)
1000  else
1001  call read_dbl1d(parser, dbl1d, idt%mf6varname)
1002  end if
1003 
1004  ! log information on the loaded array to the list file
1005  call idm_log_var(dbl1d, idt%tagname, mf6_input%mempath, iout)
1006 
1007  ! create export file for griddata parameters if optioned
1008  if (export) then
1009  if (idt%blockname == 'GRIDDATA') then
1010  call idm_export(dbl1d, idt%tagname, mf6_input%mempath, idt%shape, iout)
1011  end if
1012  end if
This module contains the LoadNCInputModule.
Definition: LoadNCInput.F90:7
subroutine, public get_layered_shape(mshape, nlay, layer_shape)
subroutine, public get_shape_from_string(shape_string, array_shape, memoryPath)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ load_double2d_type()

subroutine loadmf6filemodule::load_double2d_type ( type(blockparsertype), intent(inout)  parser,
type(inputparamdefinitiontype), intent(in)  idt,
type(modflowinputtype), intent(in)  mf6_input,
integer(i4b), dimension(:), intent(in), pointer, contiguous  mshape,
logical(lgp), intent(in)  export,
type(ncpackagevarstype), intent(in), pointer  nc_vars,
character(len=*), intent(in)  input_fname,
integer(i4b), intent(in)  iout 
)
Parameters
[in,out]parserblock parser
[in]idtinput data type object describing this record
[in]mf6_inputdescription of input
[in]mshapemodel shape
[in]exportexport to ascii layer files
[in]input_fnameascii input file name
[in]ioutunit number for output

Definition at line 1017 of file LoadMf6File.f90.

1021  type(BlockParserType), intent(inout) :: parser !< block parser
1022  type(InputParamDefinitionType), intent(in) :: idt !< input data type object describing this record
1023  type(ModflowInputType), intent(in) :: mf6_input !< description of input
1024  integer(I4B), dimension(:), contiguous, pointer, intent(in) :: mshape !< model shape
1025  logical(LGP), intent(in) :: export !< export to ascii layer files
1026  type(NCPackageVarsType), pointer, intent(in) :: nc_vars
1027  character(len=*), intent(in) :: input_fname !< ascii input file name
1028  integer(I4B), intent(in) :: iout !< unit number for output
1029  real(DP), dimension(:, :), pointer, contiguous :: dbl2d
1030  integer(I4B) :: nlay
1031  integer(I4B) :: nsize1, nsize2
1032  integer(I4B), dimension(:), allocatable :: array_shape
1033  integer(I4B), dimension(:), allocatable :: layer_shape
1034  character(len=LINELENGTH) :: keyword
1035 
1036  ! determine the array shape from the input data definition (idt%shape),
1037  ! which looks like "NCOL, NROW, NLAY"
1038  call get_shape_from_string(idt%shape, array_shape, mf6_input%mempath)
1039  nsize1 = array_shape(1)
1040  nsize2 = array_shape(2)
1041 
1042  ! create a new 3d memory managed variable
1043  call mem_allocate(dbl2d, nsize1, nsize2, idt%mf6varname, mf6_input%mempath)
1044 
1045  ! read keyword
1046  keyword = ''
1047  call parser%GetStringCaps(keyword)
1048 
1049  ! check for "NETCDF" and "LAYERED"
1050  if (keyword == 'NETCDF') then
1051  call netcdf_read_array(dbl2d, mshape, idt, mf6_input, nc_vars, &
1052  input_fname, iout)
1053  else if (keyword == 'LAYERED' .and. idt%layered) then
1054  call get_layered_shape(mshape, nlay, layer_shape)
1055  call read_dbl2d_layered(parser, dbl2d, idt%mf6varname, nlay, layer_shape)
1056  else
1057  call read_dbl2d(parser, dbl2d, idt%mf6varname)
1058  end if
1059 
1060  ! log information on the loaded array to the list file
1061  call idm_log_var(dbl2d, idt%tagname, mf6_input%mempath, iout)
1062 
1063  ! create export file for griddata parameters if optioned
1064  if (export) then
1065  if (idt%blockname == 'GRIDDATA') then
1066  call idm_export(dbl2d, idt%tagname, mf6_input%mempath, idt%shape, iout)
1067  end if
1068  end if
Here is the call graph for this function:
Here is the caller graph for this function:

◆ load_double3d_type()

subroutine loadmf6filemodule::load_double3d_type ( type(blockparsertype), intent(inout)  parser,
type(inputparamdefinitiontype), intent(in)  idt,
type(modflowinputtype), intent(in)  mf6_input,
integer(i4b), dimension(:), intent(in), pointer, contiguous  mshape,
logical(lgp), intent(in)  export,
type(ncpackagevarstype), intent(in), pointer  nc_vars,
character(len=*), intent(in)  input_fname,
integer(i4b), intent(in)  iout 
)
Parameters
[in,out]parserblock parser
[in]idtinput data type object describing this record
[in]mf6_inputdescription of input
[in]mshapemodel shape
[in]exportexport to ascii layer files
[in]input_fnameascii input file name
[in]ioutunit number for output

Definition at line 1073 of file LoadMf6File.f90.

1077  type(BlockParserType), intent(inout) :: parser !< block parser
1078  type(InputParamDefinitionType), intent(in) :: idt !< input data type object describing this record
1079  type(ModflowInputType), intent(in) :: mf6_input !< description of input
1080  integer(I4B), dimension(:), contiguous, pointer, intent(in) :: mshape !< model shape
1081  logical(LGP), intent(in) :: export !< export to ascii layer files
1082  type(NCPackageVarsType), pointer, intent(in) :: nc_vars
1083  character(len=*), intent(in) :: input_fname !< ascii input file name
1084  integer(I4B), intent(in) :: iout !< unit number for output
1085  real(DP), dimension(:, :, :), pointer, contiguous :: dbl3d
1086  integer(I4B) :: nlay
1087  integer(I4B) :: nsize1, nsize2, nsize3
1088  integer(I4B), dimension(:), allocatable :: array_shape
1089  integer(I4B), dimension(:), allocatable :: layer_shape
1090  real(DP), dimension(:), pointer, contiguous :: dbl1d_ptr
1091  character(len=LINELENGTH) :: keyword
1092 
1093  ! determine the array shape from the input data definition (idt%shape),
1094  ! which looks like "NCOL, NROW, NLAY"
1095  call get_shape_from_string(idt%shape, array_shape, mf6_input%mempath)
1096  nsize1 = array_shape(1)
1097  nsize2 = array_shape(2)
1098  nsize3 = array_shape(3)
1099 
1100  ! create a new 3d memory managed variable
1101  call mem_allocate(dbl3d, nsize1, nsize2, nsize3, idt%mf6varname, &
1102  mf6_input%mempath)
1103 
1104  ! read keyword
1105  keyword = ''
1106  call parser%GetStringCaps(keyword)
1107 
1108  ! check for "NETCDF" and "LAYERED"
1109  if (keyword == 'NETCDF') then
1110  call netcdf_read_array(dbl3d, mshape, idt, mf6_input, nc_vars, &
1111  input_fname, iout)
1112  else if (keyword == 'LAYERED' .and. idt%layered) then
1113  call get_layered_shape(mshape, nlay, layer_shape)
1114  call read_dbl3d_layered(parser, dbl3d, idt%mf6varname, nlay, &
1115  layer_shape)
1116  else
1117  dbl1d_ptr(1:nsize1 * nsize2 * nsize3) => dbl3d(:, :, :)
1118  call read_dbl1d(parser, dbl1d_ptr, idt%mf6varname)
1119  end if
1120 
1121  ! log information on the loaded array to the list file
1122  call idm_log_var(dbl3d, idt%tagname, mf6_input%mempath, iout)
1123 
1124  ! create export file for griddata parameters if optioned
1125  if (export) then
1126  if (idt%blockname == 'GRIDDATA') then
1127  call idm_export(dbl3d, idt%tagname, mf6_input%mempath, idt%shape, iout)
1128  end if
1129  end if
Here is the call graph for this function:
Here is the caller graph for this function:

◆ load_double_type()

subroutine loadmf6filemodule::load_double_type ( type(blockparsertype), intent(inout)  parser,
type(inputparamdefinitiontype), intent(in)  idt,
character(len=*), intent(in)  memoryPath,
integer(i4b), intent(in)  iout 
)
Parameters
[in,out]parserblock parser
[in]idtinput data type object describing this record
[in]memorypathmemorypath to put loaded information
[in]ioutunit number for output

Definition at line 946 of file LoadMf6File.f90.

947  type(BlockParserType), intent(inout) :: parser !< block parser
948  type(InputParamDefinitionType), intent(in) :: idt !< input data type object describing this record
949  character(len=*), intent(in) :: memoryPath !< memorypath to put loaded information
950  integer(I4B), intent(in) :: iout !< unit number for output
951  real(DP), pointer :: dblvar
952  call mem_allocate(dblvar, idt%mf6varname, memorypath)
953  dblvar = parser%GetDouble()
954  call idm_log_var(dblvar, idt%tagname, memorypath, iout)
Here is the caller graph for this function:

◆ load_integer1d_type()

subroutine loadmf6filemodule::load_integer1d_type ( type(blockparsertype), intent(inout)  parser,
type(inputparamdefinitiontype), intent(in)  idt,
type(modflowinputtype), intent(in)  mf6_input,
integer(i4b), dimension(:), intent(in), pointer, contiguous  mshape,
logical(lgp), intent(in)  export,
type(ncpackagevarstype), intent(in), pointer  nc_vars,
character(len=*), intent(in)  input_fname,
integer(i4b), intent(in)  iout 
)
private
Parameters
[in,out]parserblock parser
[in]idtinput data type object describing this record
[in]mf6_inputdescription of input
[in]mshapemodel shape
[in]exportexport to ascii layer files
[in]input_fnameascii input file name
[in]ioutunit number for output

Definition at line 770 of file LoadMf6File.f90.

774  type(BlockParserType), intent(inout) :: parser !< block parser
775  type(InputParamDefinitionType), intent(in) :: idt !< input data type object describing this record
776  type(ModflowInputType), intent(in) :: mf6_input !< description of input
777  integer(I4B), dimension(:), contiguous, pointer, intent(in) :: mshape !< model shape
778  logical(LGP), intent(in) :: export !< export to ascii layer files
779  type(NCPackageVarsType), pointer, intent(in) :: nc_vars
780  character(len=*), intent(in) :: input_fname !< ascii input file name
781  integer(I4B), intent(in) :: iout !< unit number for output
782  integer(I4B), dimension(:), pointer, contiguous :: int1d
783  integer(I4B) :: nlay
784  integer(I4B) :: nvals
785  integer(I4B), dimension(:), allocatable :: array_shape
786  integer(I4B), dimension(:), allocatable :: layer_shape
787  character(len=LINELENGTH) :: keyword
788 
789  ! Check if it is a full grid sized array (NODES), otherwise use
790  ! idt%shape to construct shape from variables in memoryPath
791  if (idt%shape == 'NODES') then
792  nvals = product(mshape)
793  else
794  call get_shape_from_string(idt%shape, array_shape, mf6_input%mempath)
795  nvals = array_shape(1)
796  end if
797 
798  ! allocate memory for the array
799  call mem_allocate(int1d, nvals, idt%mf6varname, mf6_input%mempath)
800 
801  ! read keyword
802  keyword = ''
803  call parser%GetStringCaps(keyword)
804 
805  ! check for "NETCDF" and "LAYERED"
806  if (keyword == 'NETCDF') then
807  call netcdf_read_array(int1d, mshape, idt, mf6_input, nc_vars, &
808  input_fname, iout)
809  else if (keyword == 'LAYERED' .and. idt%layered) then
810  call get_layered_shape(mshape, nlay, layer_shape)
811  call read_int1d_layered(parser, int1d, idt%mf6varname, nlay, layer_shape)
812  else
813  call read_int1d(parser, int1d, idt%mf6varname)
814  end if
815 
816  ! log information on the loaded array to the list file
817  call idm_log_var(int1d, idt%tagname, mf6_input%mempath, iout)
818 
819  ! create export file for griddata parameters if optioned
820  if (export) then
821  if (idt%blockname == 'GRIDDATA') then
822  call idm_export(int1d, idt%tagname, mf6_input%mempath, idt%shape, iout)
823  end if
824  end if
Here is the call graph for this function:
Here is the caller graph for this function:

◆ load_integer2d_type()

subroutine loadmf6filemodule::load_integer2d_type ( type(blockparsertype), intent(inout)  parser,
type(inputparamdefinitiontype), intent(in)  idt,
type(modflowinputtype), intent(in)  mf6_input,
integer(i4b), dimension(:), intent(in), pointer, contiguous  mshape,
logical(lgp), intent(in)  export,
type(ncpackagevarstype), intent(in), pointer  nc_vars,
character(len=*), intent(in)  input_fname,
integer(i4b), intent(in)  iout 
)
Parameters
[in,out]parserblock parser
[in]idtinput data type object describing this record
[in]mf6_inputdescription of input
[in]mshapemodel shape
[in]exportexport to ascii layer files
[in]input_fnameascii input file name
[in]ioutunit number for output

Definition at line 829 of file LoadMf6File.f90.

833  type(BlockParserType), intent(inout) :: parser !< block parser
834  type(InputParamDefinitionType), intent(in) :: idt !< input data type object describing this record
835  type(ModflowInputType), intent(in) :: mf6_input !< description of input
836  integer(I4B), dimension(:), contiguous, pointer, intent(in) :: mshape !< model shape
837  logical(LGP), intent(in) :: export !< export to ascii layer files
838  type(NCPackageVarsType), pointer, intent(in) :: nc_vars
839  character(len=*), intent(in) :: input_fname !< ascii input file name
840  integer(I4B), intent(in) :: iout !< unit number for output
841  integer(I4B), dimension(:, :), pointer, contiguous :: int2d
842  integer(I4B) :: nlay
843  integer(I4B) :: nsize1, nsize2
844  integer(I4B), dimension(:), allocatable :: array_shape
845  integer(I4B), dimension(:), allocatable :: layer_shape
846  character(len=LINELENGTH) :: keyword
847 
848  ! determine the array shape from the input data definition (idt%shape),
849  ! which looks like "NCOL, NROW, NLAY"
850  call get_shape_from_string(idt%shape, array_shape, mf6_input%mempath)
851  nsize1 = array_shape(1)
852  nsize2 = array_shape(2)
853 
854  ! create a new 3d memory managed variable
855  call mem_allocate(int2d, nsize1, nsize2, idt%mf6varname, mf6_input%mempath)
856 
857  ! read keyword
858  keyword = ''
859  call parser%GetStringCaps(keyword)
860 
861  ! check for "NETCDF" and "LAYERED"
862  if (keyword == 'NETCDF') then
863  call netcdf_read_array(int2d, mshape, idt, mf6_input, nc_vars, &
864  input_fname, iout)
865  else if (keyword == 'LAYERED' .and. idt%layered) then
866  call get_layered_shape(mshape, nlay, layer_shape)
867  call read_int2d_layered(parser, int2d, idt%mf6varname, nlay, layer_shape)
868  else
869  call read_int2d(parser, int2d, idt%mf6varname)
870  end if
871 
872  ! log information on the loaded array to the list file
873  call idm_log_var(int2d, idt%tagname, mf6_input%mempath, iout)
874 
875  ! create export file for griddata parameters if optioned
876  if (export) then
877  if (idt%blockname == 'GRIDDATA') then
878  call idm_export(int2d, idt%tagname, mf6_input%mempath, idt%shape, iout)
879  end if
880  end if
Here is the call graph for this function:
Here is the caller graph for this function:

◆ load_integer3d_type()

subroutine loadmf6filemodule::load_integer3d_type ( type(blockparsertype), intent(inout)  parser,
type(inputparamdefinitiontype), intent(in)  idt,
type(modflowinputtype), intent(in)  mf6_input,
integer(i4b), dimension(:), intent(in), pointer, contiguous  mshape,
logical(lgp), intent(in)  export,
type(ncpackagevarstype), intent(in), pointer  nc_vars,
character(len=*), intent(in)  input_fname,
integer(i4b), intent(in)  iout 
)
Parameters
[in,out]parserblock parser
[in]idtinput data type object describing this record
[in]mf6_inputdescription of input
[in]mshapemodel shape
[in]exportexport to ascii layer files
[in]input_fnameascii input file name
[in]ioutunit number for output

Definition at line 885 of file LoadMf6File.f90.

889  type(BlockParserType), intent(inout) :: parser !< block parser
890  type(InputParamDefinitionType), intent(in) :: idt !< input data type object describing this record
891  type(ModflowInputType), intent(in) :: mf6_input !< description of input
892  integer(I4B), dimension(:), contiguous, pointer, intent(in) :: mshape !< model shape
893  logical(LGP), intent(in) :: export !< export to ascii layer files
894  type(NCPackageVarsType), pointer, intent(in) :: nc_vars
895  character(len=*), intent(in) :: input_fname !< ascii input file name
896  integer(I4B), intent(in) :: iout !< unit number for output
897  integer(I4B), dimension(:, :, :), pointer, contiguous :: int3d
898  integer(I4B) :: nlay
899  integer(I4B) :: nsize1, nsize2, nsize3
900  integer(I4B), dimension(:), allocatable :: array_shape
901  integer(I4B), dimension(:), allocatable :: layer_shape
902  integer(I4B), dimension(:), pointer, contiguous :: int1d_ptr
903  character(len=LINELENGTH) :: keyword
904 
905  ! determine the array shape from the input data definition (idt%shape),
906  ! which looks like "NCOL, NROW, NLAY"
907  call get_shape_from_string(idt%shape, array_shape, mf6_input%mempath)
908  nsize1 = array_shape(1)
909  nsize2 = array_shape(2)
910  nsize3 = array_shape(3)
911 
912  ! create a new 3d memory managed variable
913  call mem_allocate(int3d, nsize1, nsize2, nsize3, idt%mf6varname, &
914  mf6_input%mempath)
915 
916  ! read keyword
917  keyword = ''
918  call parser%GetStringCaps(keyword)
919 
920  ! check for "NETCDF" and "LAYERED"
921  if (keyword == 'NETCDF') then
922  call netcdf_read_array(int3d, mshape, idt, mf6_input, nc_vars, &
923  input_fname, iout)
924  else if (keyword == 'LAYERED' .and. idt%layered) then
925  call get_layered_shape(mshape, nlay, layer_shape)
926  call read_int3d_layered(parser, int3d, idt%mf6varname, nlay, &
927  layer_shape)
928  else
929  int1d_ptr(1:nsize1 * nsize2 * nsize3) => int3d(:, :, :)
930  call read_int1d(parser, int1d_ptr, idt%mf6varname)
931  end if
932 
933  ! log information on the loaded array to the list file
934  call idm_log_var(int3d, idt%tagname, mf6_input%mempath, iout)
935 
936  ! create export file for griddata parameters if optioned
937  if (export) then
938  if (idt%blockname == 'GRIDDATA') then
939  call idm_export(int3d, idt%tagname, mf6_input%mempath, idt%shape, iout)
940  end if
941  end if
Here is the call graph for this function:
Here is the caller graph for this function:

◆ load_integer_type()

subroutine loadmf6filemodule::load_integer_type ( type(blockparsertype), intent(inout)  parser,
type(inputparamdefinitiontype), intent(in)  idt,
character(len=*), intent(in)  memoryPath,
integer(i4b), intent(in)  iout 
)
Parameters
[in,out]parserblock parser
[in]idtinput data type object describing this record
[in]memorypathmemorypath to put loaded information
[in]ioutunit number for output

Definition at line 757 of file LoadMf6File.f90.

758  type(BlockParserType), intent(inout) :: parser !< block parser
759  type(InputParamDefinitionType), intent(in) :: idt !< input data type object describing this record
760  character(len=*), intent(in) :: memoryPath !< memorypath to put loaded information
761  integer(I4B), intent(in) :: iout !< unit number for output
762  integer(I4B), pointer :: intvar
763  call mem_allocate(intvar, idt%mf6varname, memorypath)
764  intvar = parser%GetInteger()
765  call idm_log_var(intvar, idt%tagname, memorypath, idt%datatype, iout)
Here is the caller graph for this function:

◆ load_io_tag()

subroutine loadmf6filemodule::load_io_tag ( type(blockparsertype), intent(inout)  parser,
type(inputparamdefinitiontype), intent(in)  idt,
character(len=*), intent(in)  memoryPath,
character(len=*), intent(in)  which,
integer(i4b), intent(in)  iout 
)
Parameters
[in,out]parserblock parser
[in]idtinput data type object describing this record
[in]memorypathmemorypath to put loaded information
[in]ioutunit number for output

Definition at line 689 of file LoadMf6File.f90.

693  type(BlockParserType), intent(inout) :: parser !< block parser
694  type(InputParamDefinitionType), intent(in) :: idt !< input data type object describing this record
695  character(len=*), intent(in) :: memoryPath !< memorypath to put loaded information
696  character(len=*), intent(in) :: which
697  integer(I4B), intent(in) :: iout !< unit number for output
698  character(len=LINELENGTH) :: cstr
699  type(CharacterStringType), dimension(:), pointer, contiguous :: charstr1d
700  integer(I4B) :: ilen, isize, idx
701  ilen = linelength
702  if (which == 'FILEIN') then
703  call get_isize(idt%mf6varname, memorypath, isize)
704  if (isize < 0) then
705  call mem_allocate(charstr1d, ilen, 1, idt%mf6varname, memorypath)
706  idx = 1
707  else
708  call mem_setptr(charstr1d, idt%mf6varname, memorypath)
709  call mem_reallocate(charstr1d, ilen, isize + 1, idt%mf6varname, &
710  memorypath)
711  idx = isize + 1
712  end if
713  call parser%GetString(cstr, (.not. idt%preserve_case))
714  charstr1d(idx) = cstr
715  else if (which == 'FILEOUT') then
716  call load_string_type(parser, idt, memorypath, iout)
717  end if
Here is the call graph for this function:
Here is the caller graph for this function:

◆ load_keyword_type()

subroutine loadmf6filemodule::load_keyword_type ( type(blockparsertype), intent(inout)  parser,
type(inputparamdefinitiontype), intent(in)  idt,
character(len=*), intent(in)  memoryPath,
integer(i4b), intent(in)  iout 
)
Parameters
[in,out]parserblock parser
[in]idtinput data type object describing this record
[in]memorypathmemorypath to put loaded information
[in]ioutunit number for output

Definition at line 651 of file LoadMf6File.f90.

652  type(BlockParserType), intent(inout) :: parser !< block parser
653  type(InputParamDefinitionType), intent(in) :: idt !< input data type object describing this record
654  character(len=*), intent(in) :: memoryPath !< memorypath to put loaded information
655  integer(I4B), intent(in) :: iout !< unit number for output
656  integer(I4B), pointer :: intvar
657  call mem_allocate(intvar, idt%mf6varname, memorypath)
658  intvar = 1
659  call idm_log_var(intvar, idt%tagname, memorypath, idt%datatype, iout)
Here is the caller graph for this function:

◆ load_string_type()

subroutine loadmf6filemodule::load_string_type ( type(blockparsertype), intent(inout)  parser,
type(inputparamdefinitiontype), intent(in)  idt,
character(len=*), intent(in)  memoryPath,
integer(i4b), intent(in)  iout 
)
private
Parameters
[in,out]parserblock parser
[in]idtinput data type object describing this record
[in]memorypathmemorypath to put loaded information
[in]ioutunit number for output

Definition at line 664 of file LoadMf6File.f90.

665  use constantsmodule, only: lenbigline
666  type(BlockParserType), intent(inout) :: parser !< block parser
667  type(InputParamDefinitionType), intent(in) :: idt !< input data type object describing this record
668  character(len=*), intent(in) :: memoryPath !< memorypath to put loaded information
669  integer(I4B), intent(in) :: iout !< unit number for output
670  character(len=LINELENGTH), pointer :: cstr
671  character(len=LENBIGLINE), pointer :: bigcstr
672  integer(I4B) :: ilen
673  select case (idt%shape)
674  case ('LENBIGLINE')
675  ilen = lenbigline
676  call mem_allocate(bigcstr, ilen, idt%mf6varname, memorypath)
677  call parser%GetString(bigcstr, (.not. idt%preserve_case))
678  call idm_log_var(bigcstr, idt%tagname, memorypath, iout)
679  case default
680  ilen = linelength
681  call mem_allocate(cstr, ilen, idt%mf6varname, memorypath)
682  call parser%GetString(cstr, (.not. idt%preserve_case))
683  call idm_log_var(cstr, idt%tagname, memorypath, iout)
684  end select
integer(i4b), parameter lenbigline
maximum length of a big line
Definition: Constants.f90:15
Here is the caller graph for this function:

◆ load_tag()

subroutine loadmf6filemodule::load_tag ( class(loadmf6filetype this,
integer(i4b), intent(in)  iblk,
type(inputparamdefinitiontype), intent(in), pointer  idt 
)
Parameters
[in]idtinput data type object describing this record

Definition at line 447 of file LoadMf6File.f90.

448  use devfeaturemodule, only: dev_feature
450  class(LoadMf6FileType) :: this
451  integer(I4B), intent(in) :: iblk
452  type(InputParamDefinitionType), pointer, intent(in) :: idt !< input data type object describing this record
453  character(len=LINELENGTH) :: dev_msg
454 
455  ! check if input param is prerelease
456  if (idt%prerelease) then
457  dev_msg = 'Input tag "'//trim(idt%tagname)// &
458  &'" read from file "'//trim(this%filename)// &
459  &'" is still under development. Install the &
460  &nightly build or compile from source with IDEVELOPMODE = 1.'
461  call dev_feature(dev_msg, this%iout)
462  end if
463 
464  ! allocate and load data type
465  select case (idt%datatype)
466  case ('KEYWORD')
467  call load_keyword_type(this%parser, idt, this%mf6_input%mempath, this%iout)
468  ! check/set as dev option
469  if (idt%tagname(1:4) == 'DEV_' .and. &
470  this%mf6_input%block_dfns(iblk)%blockname == 'OPTIONS') then
471  call this%parser%DevOpt()
472  end if
473  case ('STRING')
474  if (idt%shape == 'NAUX') then
475  call load_auxvar_names(this%parser, idt, this%mf6_input%mempath, &
476  this%iout)
477  else
478  call load_string_type(this%parser, idt, this%mf6_input%mempath, this%iout)
479  end if
480  case ('INTEGER')
481  call load_integer_type(this%parser, idt, this%mf6_input%mempath, this%iout)
482  case ('INTEGER1D')
483  call load_integer1d_type(this%parser, idt, this%mf6_input, this%mshape, &
484  this%export, this%nc_vars, this%filename, &
485  this%iout)
486  case ('INTEGER2D')
487  call load_integer2d_type(this%parser, idt, this%mf6_input, this%mshape, &
488  this%export, this%nc_vars, this%filename, &
489  this%iout)
490  case ('INTEGER3D')
491  call load_integer3d_type(this%parser, idt, this%mf6_input, this%mshape, &
492  this%export, this%nc_vars, this%filename, &
493  this%iout)
494  case ('DOUBLE')
495  call load_double_type(this%parser, idt, this%mf6_input%mempath, this%iout)
496  case ('DOUBLE1D')
497  call load_double1d_type(this%parser, idt, this%mf6_input, this%mshape, &
498  this%export, this%nc_vars, this%filename, this%iout)
499  case ('DOUBLE2D')
500  call load_double2d_type(this%parser, idt, this%mf6_input, this%mshape, &
501  this%export, this%nc_vars, this%filename, this%iout)
502  case ('DOUBLE3D')
503  call load_double3d_type(this%parser, idt, this%mf6_input, this%mshape, &
504  this%export, this%nc_vars, this%filename, this%iout)
505  case default
506  write (errmsg, '(a,a)') 'Failure reading data for tag: ', trim(idt%tagname)
507  call store_error(errmsg)
508  call this%parser%StoreErrorUnit()
509  end select
510 
511  call expandarray(this%block_tags)
512  this%block_tags(size(this%block_tags)) = trim(idt%tagname)
Disable development features in release mode.
Definition: DevFeature.f90:2
subroutine, public dev_feature(errmsg, iunit)
Terminate if in release mode (guard development features)
Definition: DevFeature.f90:21
Here is the call graph for this function:

◆ parse_block()

recursive subroutine loadmf6filemodule::parse_block ( class(loadmf6filetype this,
integer(i4b), intent(in)  iblk,
logical(lgp), intent(in)  recursive_call 
)
Parameters
[in]recursive_calltrue if recursive call

Definition at line 256 of file LoadMf6File.f90.

257  use memorytypemodule, only: memorytype
259  class(LoadMf6FileType) :: this
260  integer(I4B), intent(in) :: iblk
261  logical(LGP), intent(in) :: recursive_call !< true if recursive call
262  logical(LGP) :: isblockfound
263  logical(LGP) :: endOfBlock
264  logical(LGP) :: supportOpenClose
265  integer(I4B) :: ierr
266  logical(LGP) :: found, required
267  type(MemoryType), pointer :: mt
268  character(len=LINELENGTH) :: tag
269  type(InputParamDefinitionType), pointer :: idt
270 
271  ! disu vertices/cell2d blocks are contingent on NVERT dimension
272  if (this%mf6_input%pkgtype == 'DISU6' .or. &
273  this%mf6_input%pkgtype == 'DISV1D6' .or. &
274  this%mf6_input%pkgtype == 'DISV2D6') then
275  if (this%mf6_input%block_dfns(iblk)%blockname == 'VERTICES' .or. &
276  this%mf6_input%block_dfns(iblk)%blockname == 'CELL2D') then
277  call get_from_memorystore('NVERT', this%mf6_input%mempath, mt, found, &
278  .false.)
279  if (.not. found) return
280  if (mt%intsclr == 0) return
281  end if
282  end if
283 
284  ! block open/close support
285  supportopenclose = (this%mf6_input%block_dfns(iblk)%blockname /= 'GRIDDATA')
286 
287  ! parser search for block
288  required = this%mf6_input%block_dfns(iblk)%required .and. .not. recursive_call
289  call this%parser%GetBlock(this%mf6_input%block_dfns(iblk)%blockname, &
290  isblockfound, ierr, &
291  supportopenclose=supportopenclose, &
292  blockrequired=required)
293  ! process block
294  if (isblockfound) then
295  if (this%mf6_input%block_dfns(iblk)%aggregate) then
296  ! process block recarray type, set of variable 1d/2d types
297  call this%parse_structarray_block(iblk)
298  else
299  do
300  ! process each line in block
301  call this%parser%GetNextLine(endofblock)
302  if (endofblock) exit
303  ! process line as tag(s)
304  call this%parser%GetStringCaps(tag)
305  idt => get_param_definition_type( &
306  this%mf6_input%param_dfns, &
307  this%mf6_input%component_type, &
308  this%mf6_input%subcomponent_type, &
309  this%mf6_input%block_dfns(iblk)%blockname, &
310  tag, this%filename)
311  if (idt%in_record) then
312  call this%parse_record_tag(iblk, idt, .false.)
313  else
314  call this%load_tag(iblk, idt)
315  end if
316  end do
317  end if
318  end if
319 
320  ! recurse if block is reloadable and was just read
321  if (this%mf6_input%block_dfns(iblk)%block_variable) then
322  if (isblockfound) then
323  call this%parse_block(iblk, .true.)
324  end if
325  end if
subroutine, public get_from_memorystore(name, mem_path, mt, found, check)
@ brief Get a memory type entry from the memory list
Here is the call graph for this function:

◆ parse_io_tag()

subroutine loadmf6filemodule::parse_io_tag ( class(loadmf6filetype this,
integer(i4b), intent(in)  iblk,
character(len=*), intent(in)  pkgtype,
character(len=*), intent(in)  which,
character(len=*), intent(in)  tag 
)

Definition at line 328 of file LoadMf6File.f90.

329  class(LoadMf6FileType) :: this
330  integer(I4B), intent(in) :: iblk
331  character(len=*), intent(in) :: pkgtype
332  character(len=*), intent(in) :: which
333  character(len=*), intent(in) :: tag
334  type(InputParamDefinitionType), pointer :: idt !< input data type object describing this record
335  ! matches, read and load file name
336  idt => &
337  get_param_definition_type(this%mf6_input%param_dfns, &
338  this%mf6_input%component_type, &
339  this%mf6_input%subcomponent_type, &
340  this%mf6_input%block_dfns(iblk)%blockname, &
341  tag, this%filename)
342  ! load io tag
343  call load_io_tag(this%parser, idt, this%mf6_input%mempath, which, this%iout)
Here is the call graph for this function:

◆ parse_record_tag()

recursive subroutine loadmf6filemodule::parse_record_tag ( class(loadmf6filetype this,
integer(i4b), intent(in)  iblk,
type(inputparamdefinitiontype), intent(in), pointer  inidt,
logical(lgp), intent(in)  recursive_call 
)
private
Parameters
[in]recursive_calltrue if recursive call

Definition at line 346 of file LoadMf6File.f90.

350  class(LoadMf6FileType) :: this
351  integer(I4B), intent(in) :: iblk
352  type(InputParamDefinitionType), pointer, intent(in) :: inidt
353  logical(LGP), intent(in) :: recursive_call !< true if recursive call
354  type(InputParamDefinitionType), pointer :: idt
355  character(len=40), dimension(:), allocatable :: words
356  integer(I4B) :: n, istart, nwords
357  character(len=LINELENGTH) :: tag
358 
359  nullify (idt)
360  istart = 1
361 
362  if (recursive_call) then
363  call split_record_dfn_tag1(this%mf6_input%param_dfns, &
364  this%mf6_input%component_type, &
365  this%mf6_input%subcomponent_type, &
366  inidt%tagname, nwords, words)
367  call this%load_tag(iblk, inidt)
368  istart = 3
369  else
370  call this%parser%GetStringCaps(tag)
371  if (tag /= '') then
372  call split_record_dfn_tag2(this%mf6_input%param_dfns, &
373  this%mf6_input%component_type, &
374  this%mf6_input%subcomponent_type, &
375  inidt%tagname, tag, nwords, words)
376  if (nwords == 4 .and. &
377  (tag == 'FILEIN' .or. &
378  tag == 'FILEOUT')) then
379  call this%parse_io_tag(iblk, words(2), words(3), words(4))
380  nwords = 0
381  else
382  idt => get_param_definition_type( &
383  this%mf6_input%param_dfns, &
384  this%mf6_input%component_type, &
385  this%mf6_input%subcomponent_type, &
386  this%mf6_input%block_dfns(iblk)%blockname, &
387  tag, this%filename)
388  ! avoid namespace collisions (CIM)
389  if (tag /= 'PRINT_FORMAT') call this%load_tag(iblk, inidt)
390  call this%load_tag(iblk, idt)
391  istart = 4
392  end if
393  else
394  call this%load_tag(iblk, inidt)
395  nwords = 0
396  end if
397  end if
398 
399  if (istart > 1 .and. nwords == 0) then
400  write (errmsg, '(5a)') &
401  '"', trim(this%mf6_input%block_dfns(iblk)%blockname), &
402  '" block input record that includes keyword "', trim(inidt%tagname), &
403  '" is not properly formed.'
404  call store_error(errmsg)
405  call this%parser%StoreErrorUnit()
406  end if
407 
408  do n = istart, nwords
409  idt => get_param_definition_type( &
410  this%mf6_input%param_dfns, &
411  this%mf6_input%component_type, &
412  this%mf6_input%subcomponent_type, &
413  this%mf6_input%block_dfns(iblk)%blockname, &
414  words(n), this%filename)
415  if (idt_datatype(idt) == 'RECORD') then
416  call this%parser%GetStringCaps(tag)
417  idt => get_param_definition_type( &
418  this%mf6_input%param_dfns, &
419  this%mf6_input%component_type, &
420  this%mf6_input%subcomponent_type, &
421  this%mf6_input%block_dfns(iblk)%blockname, &
422  tag, this%filename)
423  call this%parse_record_tag(iblk, idt, .true.)
424  exit
425  else
426  if (idt%tagname /= 'FORMAT') then
427  call this%parser%GetStringCaps(tag)
428  if (tag == '') then
429  exit
430  else if (idt%tagname /= tag) then
431  write (errmsg, '(5a)') 'Expecting record input tag "', &
432  trim(idt%tagname), '" but instead found "', trim(tag), '".'
433  call store_error(errmsg)
434  call this%parser%StoreErrorUnit()
435  end if
436  end if
437  call this%load_tag(iblk, idt)
438  end if
439  end do
440 
441  if (allocated(words)) deallocate (words)
This module contains the DefinitionSelectModule.
subroutine, public split_record_dfn_tag1(input_definition_types, component_type, subcomponent_type, tagname, nwords, words)
Return aggregate definition.
subroutine, public split_record_dfn_tag2(input_definition_types, component_type, subcomponent_type, tagname, tag2, nwords, words)
Return aggregate definition.
character(len=linelength) function, public idt_datatype(idt)
return input definition type datatype
Here is the call graph for this function:

◆ parse_structarray_block()

subroutine loadmf6filemodule::parse_structarray_block ( class(loadmf6filetype this,
integer(i4b), intent(in)  iblk 
)
private

A structarray is similar to a numpy recarray. It it used to load a list of data in which each column in the list may be a different type. Each column in the list is stored as a 1d vector.

Definition at line 550 of file LoadMf6File.f90.

553  class(LoadMf6FileType) :: this
554  integer(I4B), intent(in) :: iblk
555  type(LoadContextType) :: ctx
556  character(len=LINELENGTH), dimension(:), allocatable :: param_names
557  type(InputParamDefinitionType), pointer :: idt !< input data type object describing this record
558  type(InputParamDefinitionType), target :: blockvar_idt
559  integer(I4B) :: blocknum
560  integer(I4B), pointer :: nrow
561  integer(I4B) :: nrows, nrowsread
562  integer(I4B) :: ibinary, oc_inunit
563  integer(I4B) :: icol, iparam
564  integer(I4B) :: ncol, nparam
565 
566  ! initialize load context
567  call ctx%init(this%mf6_input, blockname= &
568  this%mf6_input%block_dfns(iblk)%blockname)
569  ! set in scope params for load
570  call ctx%tags(param_names, nparam, this%filename)
571  ! set input definition for this block
572  idt => &
573  get_aggregate_definition_type(this%mf6_input%aggregate_dfns, &
574  this%mf6_input%component_type, &
575  this%mf6_input%subcomponent_type, &
576  this%mf6_input%block_dfns(iblk)%blockname)
577  ! if block is reloadable read the block number
578  if (this%mf6_input%block_dfns(iblk)%block_variable) then
579  blocknum = this%parser%GetInteger()
580  else
581  blocknum = 0
582  end if
583 
584  ! set ncol
585  ncol = nparam
586  ! add col if block is reloadable
587  if (blocknum > 0) ncol = ncol + 1
588  ! use shape to set the max num of rows
589  if (idt%shape /= '') then
590  call mem_setptr(nrow, idt%shape, this%mf6_input%mempath)
591  nrows = nrow
592  else
593  nrows = -1
594  end if
595 
596  ! create a structured array
597  this%structarray => constructstructarray(this%mf6_input, ncol, nrows, &
598  blocknum, this%mf6_input%mempath, &
599  this%mf6_input%component_mempath)
600  ! create structarray vectors for each column
601  do icol = 1, ncol
602  ! if block is reloadable, block number is first column
603  if (blocknum > 0) then
604  if (icol == 1) then
605  blockvar_idt = this%block_index_dfn(iblk)
606  idt => blockvar_idt
607  call this%structarray%mem_create_vector(icol, idt)
608  ! continue as this column managed by internally SA object
609  cycle
610  end if
611  ! set indexes (where first column is blocknum)
612  iparam = icol - 1
613  else
614  ! set indexes (no blocknum column)
615  iparam = icol
616  end if
617  ! set pointer to input definition for this 1d vector
618  idt => &
619  get_param_definition_type(this%mf6_input%param_dfns, &
620  this%mf6_input%component_type, &
621  this%mf6_input%subcomponent_type, &
622  this%mf6_input%block_dfns(iblk)%blockname, &
623  param_names(iparam), this%filename)
624  ! allocate variable in memory manager
625  call this%structarray%mem_create_vector(icol, idt)
626  end do
627 
628  ! finish context setup after allocating vectors
629  call ctx%allocate_arrays()
630 
631  ! read the block control record
632  ibinary = read_control_record(this%parser, oc_inunit, this%iout)
633 
634  if (ibinary == 1) then
635  ! read from binary
636  nrowsread = this%structarray%read_from_binary(oc_inunit, this%iout)
637  call this%parser%terminateblock()
638  close (oc_inunit)
639  else
640  ! read from ascii
641  nrowsread = this%structarray%read_from_parser(this%parser, this%ts_active, &
642  this%iout)
643  end if
644 
645  ! clean up
646  call ctx%destroy()
This module contains the LoadContextModule.
Definition: LoadContext.f90:10
type(structarraytype) function, pointer, public constructstructarray(mf6_input, ncol, nrow, blocknum, mempath, component_mempath)
constructor for a struct_array
Definition: StructArray.f90:73
derived type for boundary package input context
Definition: LoadContext.f90:61
type for structured array
Definition: StructArray.f90:36
Here is the call graph for this function:

◆ read_control_record()

integer(i4b) function, public loadmf6filemodule::read_control_record ( type(blockparsertype), intent(inout)  parser,
integer(i4b), intent(inout)  oc_inunit,
integer(i4b), intent(in)  iout 
)

Definition at line 1132 of file LoadMf6File.f90.

1133  use simmodule, only: store_error_unit
1134  use inputoutputmodule, only: urword
1135  use inputoutputmodule, only: openfile
1136  use openspecmodule, only: form, access
1137  use constantsmodule, only: linelength
1139  type(BlockParserType), intent(inout) :: parser
1140  integer(I4B), intent(inout) :: oc_inunit
1141  integer(I4B), intent(in) :: iout
1142  integer(I4B) :: ibinary
1143  integer(I4B) :: lloc, istart, istop, idum, inunit, itmp, ierr
1144  integer(I4B) :: nunopn = 99
1145  character(len=:), allocatable :: line
1146  character(len=LINELENGTH) :: fname
1147  logical(LGP) :: exists
1148  real(DP) :: r
1149  character(len=*), parameter :: fmtocne = &
1150  &"('Specified OPEN/CLOSE file ',(A),' does not exist')"
1151  character(len=*), parameter :: fmtobf = &
1152  &"(1X,/1X,'OPENING BINARY FILE ON UNIT ',I0,':',/1X,A)"
1153 
1154  ! initialize oc_inunit and ibinary
1155  oc_inunit = 0
1156  ibinary = 0
1157  inunit = parser%getunit()
1158 
1159  ! Read to the first non-commented line
1160  lloc = 1
1161  call parser%line_reader%rdcom(inunit, iout, line, ierr)
1162  call urword(line, lloc, istart, istop, 1, idum, r, iout, inunit)
1163 
1164  if (line(istart:istop) == 'OPEN/CLOSE') then
1165  ! get filename
1166  call urword(line, lloc, istart, istop, 0, idum, r, &
1167  iout, inunit)
1168  fname = line(istart:istop)
1169  ! check to see if file OPEN/CLOSE file exists
1170  inquire (file=fname, exist=exists)
1171  if (.not. exists) then
1172  write (errmsg, fmtocne) line(istart:istop)
1173  call store_error(errmsg)
1174  call store_error('Specified OPEN/CLOSE file does not exist')
1175  call store_error_unit(inunit)
1176  end if
1177 
1178  ! Check for (BINARY) keyword
1179  call urword(line, lloc, istart, istop, 1, idum, r, &
1180  iout, inunit)
1181 
1182  if (line(istart:istop) == '(BINARY)') ibinary = 1
1183  ! Open the file depending on ibinary flag
1184  if (ibinary == 1) then
1185  oc_inunit = nunopn
1186  itmp = iout
1187  if (iout > 0) then
1188  itmp = 0
1189  write (iout, fmtobf) oc_inunit, trim(adjustl(fname))
1190  end if
1191  call openfile(oc_inunit, itmp, fname, 'OPEN/CLOSE', &
1192  fmtarg_opt=form, accarg_opt=access)
1193  end if
1194  end if
1195 
1196  if (ibinary == 0) then
1197  call parser%line_reader%bkspc(parser%getunit())
1198  end if
This module contains block parser methods.
Definition: BlockParser.f90:7
subroutine, public openfile(iu, iout, fname, ftype, fmtarg_opt, accarg_opt, filstat_opt, mode_opt)
Open a file.
Definition: InputOutput.f90:30
subroutine, public urword(line, icol, istart, istop, ncode, n, r, iout, in)
Extract a word from a string.
character(len=20) access
Definition: OpenSpec.f90:7
character(len=20) form
Definition: OpenSpec.f90:7
This module contains simulation methods.
Definition: Sim.f90:10
subroutine, public store_error_unit(iunit, terminate)
Store the file unit number.
Definition: Sim.f90:168
Here is the call graph for this function:
Here is the caller graph for this function: