MODFLOW 6  version 6.7.0.dev2
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 503 of file LoadMf6File.f90.

504  class(LoadMf6FileType) :: this
505  integer(I4B), intent(in) :: iblk
506  type(InputParamDefinitionType) :: idt !< input data type object describing this record
507  character(len=LENVARNAME) :: varname
508  integer(I4B) :: ilen
509  character(len=3) :: block_suffix = 'NUM'
510 
511  ! assign first column as the block number
512  ilen = len_trim(this%mf6_input%block_dfns(iblk)%blockname)
513 
514  if (ilen > (lenvarname - len(block_suffix))) then
515  varname = &
516  this%mf6_input%block_dfns(iblk)% &
517  blockname(1:(lenvarname - len(block_suffix)))//block_suffix
518  else
519  varname = trim(this%mf6_input%block_dfns(iblk)%blockname)//block_suffix
520  end if
521 
522  idt%component_type = trim(this%mf6_input%component_type)
523  idt%subcomponent_type = trim(this%mf6_input%subcomponent_type)
524  idt%blockname = trim(this%mf6_input%block_dfns(iblk)%blockname)
525  idt%tagname = varname
526  idt%mf6varname = varname
527  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 711 of file LoadMf6File.f90.

713  use inputoutputmodule, only: urdaux
715  type(BlockParserType), intent(inout) :: parser !< block parser
716  type(InputParamDefinitionType), intent(in) :: idt !< input data type object describing this record
717  character(len=*), intent(in) :: memoryPath !< memorypath to put loaded information
718  integer(I4B), intent(in) :: iout !< unit number for output
719  character(len=:), allocatable :: line
720  character(len=LENAUXNAME), dimension(:), allocatable :: caux
721  integer(I4B) :: lloc
722  integer(I4B) :: istart
723  integer(I4B) :: istop
724  integer(I4B) :: i
725  character(len=LENPACKAGENAME) :: text = ''
726  integer(I4B), pointer :: intvar
727  type(CharacterStringType), dimension(:), &
728  pointer, contiguous :: acharstr1d !< variable for allocation
729  call mem_allocate(intvar, idt%shape, memorypath)
730  intvar = 0
731  call parser%GetRemainingLine(line)
732  lloc = 1
733  call urdaux(intvar, parser%iuactive, iout, lloc, &
734  istart, istop, caux, line, text)
735  call mem_allocate(acharstr1d, lenauxname, intvar, idt%mf6varname, memorypath)
736  do i = 1, intvar
737  acharstr1d(i) = caux(i)
738  end do
739  deallocate (line)
740  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 947 of file LoadMf6File.f90.

951  type(BlockParserType), intent(inout) :: parser !< block parser
952  type(InputParamDefinitionType), intent(in) :: idt !< input data type object describing this record
953  type(ModflowInputType), intent(in) :: mf6_input !< description of input
954  integer(I4B), dimension(:), contiguous, pointer, intent(in) :: mshape !< model shape
955  logical(LGP), intent(in) :: export !< export to ascii layer files
956  type(NCPackageVarsType), pointer, intent(in) :: nc_vars
957  character(len=*), intent(in) :: input_fname !< ascii input file name
958  integer(I4B), intent(in) :: iout !< unit number for output
959  real(DP), dimension(:), pointer, contiguous :: dbl1d
960  integer(I4B) :: nlay
961  integer(I4B) :: nvals
962  integer(I4B), dimension(:), allocatable :: array_shape
963  integer(I4B), dimension(:), allocatable :: layer_shape
964  character(len=LINELENGTH) :: keyword
965 
966  ! Check if it is a full grid sized array (NODES)
967  if (idt%shape == 'NODES') then
968  nvals = product(mshape)
969  else
970  call get_shape_from_string(idt%shape, array_shape, mf6_input%mempath)
971  nvals = array_shape(1)
972  end if
973 
974  ! allocate memory for the array
975  call mem_allocate(dbl1d, nvals, idt%mf6varname, mf6_input%mempath)
976 
977  ! read keyword
978  keyword = ''
979  call parser%GetStringCaps(keyword)
980 
981  ! check for "NETCDF" and "LAYERED"
982  if (keyword == 'NETCDF') then
983  call netcdf_read_array(dbl1d, mshape, idt, mf6_input, nc_vars, &
984  input_fname, iout)
985  else if (keyword == 'LAYERED' .and. idt%layered) then
986  call get_layered_shape(mshape, nlay, layer_shape)
987  call read_dbl1d_layered(parser, dbl1d, idt%mf6varname, nlay, layer_shape)
988  else
989  call read_dbl1d(parser, dbl1d, idt%mf6varname)
990  end if
991 
992  ! log information on the loaded array to the list file
993  call idm_log_var(dbl1d, idt%tagname, mf6_input%mempath, iout)
994 
995  ! create export file for griddata parameters if optioned
996  if (export) then
997  if (idt%blockname == 'GRIDDATA') then
998  call idm_export(dbl1d, idt%tagname, mf6_input%mempath, idt%shape, iout)
999  end if
1000  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 1005 of file LoadMf6File.f90.

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

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

935  type(BlockParserType), intent(inout) :: parser !< block parser
936  type(InputParamDefinitionType), intent(in) :: idt !< input data type object describing this record
937  character(len=*), intent(in) :: memoryPath !< memorypath to put loaded information
938  integer(I4B), intent(in) :: iout !< unit number for output
939  real(DP), pointer :: dblvar
940  call mem_allocate(dblvar, idt%mf6varname, memorypath)
941  dblvar = parser%GetDouble()
942  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 758 of file LoadMf6File.f90.

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

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

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

746  type(BlockParserType), intent(inout) :: parser !< block parser
747  type(InputParamDefinitionType), intent(in) :: idt !< input data type object describing this record
748  character(len=*), intent(in) :: memoryPath !< memorypath to put loaded information
749  integer(I4B), intent(in) :: iout !< unit number for output
750  integer(I4B), pointer :: intvar
751  call mem_allocate(intvar, idt%mf6varname, memorypath)
752  intvar = parser%GetInteger()
753  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 677 of file LoadMf6File.f90.

681  type(BlockParserType), intent(inout) :: parser !< block parser
682  type(InputParamDefinitionType), intent(in) :: idt !< input data type object describing this record
683  character(len=*), intent(in) :: memoryPath !< memorypath to put loaded information
684  character(len=*), intent(in) :: which
685  integer(I4B), intent(in) :: iout !< unit number for output
686  character(len=LINELENGTH) :: cstr
687  type(CharacterStringType), dimension(:), pointer, contiguous :: charstr1d
688  integer(I4B) :: ilen, isize, idx
689  ilen = linelength
690  if (which == 'FILEIN') then
691  call get_isize(idt%mf6varname, memorypath, isize)
692  if (isize < 0) then
693  call mem_allocate(charstr1d, ilen, 1, idt%mf6varname, memorypath)
694  idx = 1
695  else
696  call mem_setptr(charstr1d, idt%mf6varname, memorypath)
697  call mem_reallocate(charstr1d, ilen, isize + 1, idt%mf6varname, &
698  memorypath)
699  idx = isize + 1
700  end if
701  call parser%GetString(cstr, (.not. idt%preserve_case))
702  charstr1d(idx) = cstr
703  else if (which == 'FILEOUT') then
704  call load_string_type(parser, idt, memorypath, iout)
705  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 639 of file LoadMf6File.f90.

640  type(BlockParserType), intent(inout) :: parser !< block parser
641  type(InputParamDefinitionType), intent(in) :: idt !< input data type object describing this record
642  character(len=*), intent(in) :: memoryPath !< memorypath to put loaded information
643  integer(I4B), intent(in) :: iout !< unit number for output
644  integer(I4B), pointer :: intvar
645  call mem_allocate(intvar, idt%mf6varname, memorypath)
646  intvar = 1
647  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 652 of file LoadMf6File.f90.

653  use constantsmodule, only: lenbigline
654  type(BlockParserType), intent(inout) :: parser !< block parser
655  type(InputParamDefinitionType), intent(in) :: idt !< input data type object describing this record
656  character(len=*), intent(in) :: memoryPath !< memorypath to put loaded information
657  integer(I4B), intent(in) :: iout !< unit number for output
658  character(len=LINELENGTH), pointer :: cstr
659  character(len=LENBIGLINE), pointer :: bigcstr
660  integer(I4B) :: ilen
661  select case (idt%shape)
662  case ('LENBIGLINE')
663  ilen = lenbigline
664  call mem_allocate(bigcstr, ilen, idt%mf6varname, memorypath)
665  call parser%GetString(bigcstr, (.not. idt%preserve_case))
666  call idm_log_var(bigcstr, idt%tagname, memorypath, iout)
667  case default
668  ilen = linelength
669  call mem_allocate(cstr, ilen, idt%mf6varname, memorypath)
670  call parser%GetString(cstr, (.not. idt%preserve_case))
671  call idm_log_var(cstr, idt%tagname, memorypath, iout)
672  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.

449  class(LoadMf6FileType) :: this
450  integer(I4B), intent(in) :: iblk
451  type(InputParamDefinitionType), pointer, intent(in) :: idt !< input data type object describing this record
452  ! allocate and load data type
453  select case (idt%datatype)
454  case ('KEYWORD')
455  call load_keyword_type(this%parser, idt, this%mf6_input%mempath, this%iout)
456  ! check/set as dev option
457  if (idt%tagname(1:4) == 'DEV_' .and. &
458  this%mf6_input%block_dfns(iblk)%blockname == 'OPTIONS') then
459  call this%parser%DevOpt()
460  end if
461  case ('STRING')
462  if (idt%shape == 'NAUX') then
463  call load_auxvar_names(this%parser, idt, this%mf6_input%mempath, &
464  this%iout)
465  else
466  call load_string_type(this%parser, idt, this%mf6_input%mempath, this%iout)
467  end if
468  case ('INTEGER')
469  call load_integer_type(this%parser, idt, this%mf6_input%mempath, this%iout)
470  case ('INTEGER1D')
471  call load_integer1d_type(this%parser, idt, this%mf6_input, this%mshape, &
472  this%export, this%nc_vars, this%filename, &
473  this%iout)
474  case ('INTEGER2D')
475  call load_integer2d_type(this%parser, idt, this%mf6_input, this%mshape, &
476  this%export, this%nc_vars, this%filename, &
477  this%iout)
478  case ('INTEGER3D')
479  call load_integer3d_type(this%parser, idt, this%mf6_input, this%mshape, &
480  this%export, this%nc_vars, this%filename, &
481  this%iout)
482  case ('DOUBLE')
483  call load_double_type(this%parser, idt, this%mf6_input%mempath, this%iout)
484  case ('DOUBLE1D')
485  call load_double1d_type(this%parser, idt, this%mf6_input, this%mshape, &
486  this%export, this%nc_vars, this%filename, this%iout)
487  case ('DOUBLE2D')
488  call load_double2d_type(this%parser, idt, this%mf6_input, this%mshape, &
489  this%export, this%nc_vars, this%filename, this%iout)
490  case ('DOUBLE3D')
491  call load_double3d_type(this%parser, idt, this%mf6_input, this%mshape, &
492  this%export, this%nc_vars, this%filename, this%iout)
493  case default
494  write (errmsg, '(a,a)') 'Failure reading data for tag: ', trim(idt%tagname)
495  call store_error(errmsg)
496  call this%parser%StoreErrorUnit()
497  end select
498 
499  call expandarray(this%block_tags)
500  this%block_tags(size(this%block_tags)) = trim(idt%tagname)
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 538 of file LoadMf6File.f90.

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

1121  use simmodule, only: store_error_unit
1122  use inputoutputmodule, only: urword
1123  use inputoutputmodule, only: openfile
1124  use openspecmodule, only: form, access
1125  use constantsmodule, only: linelength
1127  type(BlockParserType), intent(inout) :: parser
1128  integer(I4B), intent(inout) :: oc_inunit
1129  integer(I4B), intent(in) :: iout
1130  integer(I4B) :: ibinary
1131  integer(I4B) :: lloc, istart, istop, idum, inunit, itmp, ierr
1132  integer(I4B) :: nunopn = 99
1133  character(len=:), allocatable :: line
1134  character(len=LINELENGTH) :: fname
1135  logical(LGP) :: exists
1136  real(DP) :: r
1137  character(len=*), parameter :: fmtocne = &
1138  &"('Specified OPEN/CLOSE file ',(A),' does not exist')"
1139  character(len=*), parameter :: fmtobf = &
1140  &"(1X,/1X,'OPENING BINARY FILE ON UNIT ',I0,':',/1X,A)"
1141 
1142  ! initialize oc_inunit and ibinary
1143  oc_inunit = 0
1144  ibinary = 0
1145  inunit = parser%getunit()
1146 
1147  ! Read to the first non-commented line
1148  lloc = 1
1149  call parser%line_reader%rdcom(inunit, iout, line, ierr)
1150  call urword(line, lloc, istart, istop, 1, idum, r, iout, inunit)
1151 
1152  if (line(istart:istop) == 'OPEN/CLOSE') then
1153  ! get filename
1154  call urword(line, lloc, istart, istop, 0, idum, r, &
1155  iout, inunit)
1156  fname = line(istart:istop)
1157  ! check to see if file OPEN/CLOSE file exists
1158  inquire (file=fname, exist=exists)
1159  if (.not. exists) then
1160  write (errmsg, fmtocne) line(istart:istop)
1161  call store_error(errmsg)
1162  call store_error('Specified OPEN/CLOSE file does not exist')
1163  call store_error_unit(inunit)
1164  end if
1165 
1166  ! Check for (BINARY) keyword
1167  call urword(line, lloc, istart, istop, 1, idum, r, &
1168  iout, inunit)
1169 
1170  if (line(istart:istop) == '(BINARY)') ibinary = 1
1171  ! Open the file depending on ibinary flag
1172  if (ibinary == 1) then
1173  oc_inunit = nunopn
1174  itmp = iout
1175  if (iout > 0) then
1176  itmp = 0
1177  write (iout, fmtobf) oc_inunit, trim(adjustl(fname))
1178  end if
1179  call openfile(oc_inunit, itmp, fname, 'OPEN/CLOSE', &
1180  fmtarg_opt=form, accarg_opt=access)
1181  end if
1182  end if
1183 
1184  if (ibinary == 0) then
1185  call parser%line_reader%bkspc(parser%getunit())
1186  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: