MODFLOW 6  version 6.7.0.dev0
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)
 
subroutine parse_keyword_tag (this, iblk, tag, idt)
 
recursive subroutine parse_tag (this, iblk, recursive_call)
 load an individual input record into memory 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 468 of file LoadMf6File.f90.

469  class(LoadMf6FileType) :: this
470  integer(I4B), intent(in) :: iblk
471  type(InputParamDefinitionType) :: idt !< input data type object describing this record
472  character(len=LENVARNAME) :: varname
473  integer(I4B) :: ilen
474  character(len=3) :: block_suffix = 'NUM'
475 
476  ! assign first column as the block number
477  ilen = len_trim(this%mf6_input%block_dfns(iblk)%blockname)
478 
479  if (ilen > (lenvarname - len(block_suffix))) then
480  varname = &
481  this%mf6_input%block_dfns(iblk)% &
482  blockname(1:(lenvarname - len(block_suffix)))//block_suffix
483  else
484  varname = trim(this%mf6_input%block_dfns(iblk)%blockname)//block_suffix
485  end if
486 
487  idt%component_type = trim(this%mf6_input%component_type)
488  idt%subcomponent_type = trim(this%mf6_input%subcomponent_type)
489  idt%blockname = trim(this%mf6_input%block_dfns(iblk)%blockname)
490  idt%tagname = varname
491  idt%mf6varname = varname
492  idt%datatype = 'INTEGER'

◆ block_post_process()

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

Definition at line 195 of file LoadMf6File.f90.

196  use constantsmodule, only: lenboundname
199  class(LoadMf6FileType) :: this
200  integer(I4B), intent(in) :: iblk
201  type(InputParamDefinitionType), pointer :: idt
202  integer(I4B) :: iparam
203  integer(I4B), pointer :: intptr
204 
205  ! update state based on read tags
206  do iparam = 1, size(this%block_tags)
207  select case (this%mf6_input%block_dfns(iblk)%blockname)
208  case ('OPTIONS')
209  if (this%block_tags(iparam) == 'AUXILIARY') then
210  this%iauxiliary = 1
211  else if (this%block_tags(iparam) == 'BOUNDNAMES') then
212  this%inamedbound = 1
213  else if (this%block_tags(iparam) == 'READASARRAYS') then
214  this%readasarrays = .true.
215  else if (this%block_tags(iparam) == 'TS6') then
216  this%ts_active = .true.
217  else if (this%block_tags(iparam) == 'EXPORT_ARRAY_ASCII') then
218  this%export = .true.
219  end if
220  case default
221  end select
222  end do
223 
224  ! update input context allocations based on dfn set and input
225  select case (this%mf6_input%block_dfns(iblk)%blockname)
226  case ('OPTIONS')
227  ! allocate naux and set to 0 if not allocated
228  do iparam = 1, size(this%mf6_input%param_dfns)
229  idt => this%mf6_input%param_dfns(iparam)
230  if (idt%blockname == 'OPTIONS' .and. &
231  idt%tagname == 'AUXILIARY') then
232  if (this%iauxiliary == 0) then
233  call mem_allocate(intptr, 'NAUX', this%mf6_input%mempath)
234  intptr = 0
235  end if
236  exit
237  end if
238  end do
239  case ('DIMENSIONS')
240  ! set model shape if discretization dimensions have been read
241  if (this%mf6_input%pkgtype(1:3) == 'DIS') then
242  call set_model_shape(this%mf6_input%pkgtype, this%filename, &
243  this%mf6_input%component_mempath, &
244  this%mf6_input%mempath, this%mshape)
245  end if
246  case default
247  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 179 of file LoadMf6File.f90.

181  class(LoadMf6FileType) :: this
182  ! cleanup
183  if (associated(this%structarray)) then
184  ! destroy the structured array reader
185  call destructstructarray(this%structarray)
186  end if
187  ! close logging block
188  call idm_log_close(this%mf6_input%component_name, &
189  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%inamedbound = 0
133  this%iauxiliary = 0
134  this%iout = iout
135 
136  call get_isize('MODEL_SHAPE', mf6_input%component_mempath, isize)
137  if (isize > 0) then
138  call mem_setptr(this%mshape, 'MODEL_SHAPE', mf6_input%component_mempath)
139  end if
140 
141  ! log lst file header
142  call idm_log_header(this%mf6_input%component_name, &
143  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 671 of file LoadMf6File.f90.

673  use inputoutputmodule, only: urdaux
675  type(BlockParserType), intent(inout) :: parser !< block parser
676  type(InputParamDefinitionType), intent(in) :: idt !< input data type object describing this record
677  character(len=*), intent(in) :: memoryPath !< memorypath to put loaded information
678  integer(I4B), intent(in) :: iout !< unit number for output
679  character(len=:), allocatable :: line
680  character(len=LENAUXNAME), dimension(:), allocatable :: caux
681  integer(I4B) :: lloc
682  integer(I4B) :: istart
683  integer(I4B) :: istop
684  integer(I4B) :: i
685  character(len=LENPACKAGENAME) :: text = ''
686  integer(I4B), pointer :: intvar
687  type(CharacterStringType), dimension(:), &
688  pointer, contiguous :: acharstr1d !< variable for allocation
689  call mem_allocate(intvar, idt%shape, memorypath)
690  intvar = 0
691  call parser%GetRemainingLine(line)
692  lloc = 1
693  call urdaux(intvar, parser%iuactive, iout, lloc, &
694  istart, istop, caux, line, text)
695  call mem_allocate(acharstr1d, lenauxname, intvar, idt%mf6varname, memorypath)
696  do i = 1, intvar
697  acharstr1d(i) = caux(i)
698  end do
699  deallocate (line)
700  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 154 of file LoadMf6File.f90.

156  class(LoadMf6FileType) :: this
157  integer(I4B), intent(in) :: iblk
158 
159  ! reset structarray if it was created for previous block
160  if (associated(this%structarray)) then
161  ! destroy the structured array reader
162  call destructstructarray(this%structarray)
163  end if
164 
165  allocate (this%block_tags(0))
166  ! load the block
167  call this%parse_block(iblk, .false.)
168  ! post process block
169  call this%block_post_process(iblk)
170  ! cleanup
171  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 907 of file LoadMf6File.f90.

911  type(BlockParserType), intent(inout) :: parser !< block parser
912  type(InputParamDefinitionType), intent(in) :: idt !< input data type object describing this record
913  type(ModflowInputType), intent(in) :: mf6_input !< description of input
914  integer(I4B), dimension(:), contiguous, pointer, intent(in) :: mshape !< model shape
915  logical(LGP), intent(in) :: export !< export to ascii layer files
916  type(NCPackageVarsType), pointer, intent(in) :: nc_vars
917  character(len=*), intent(in) :: input_fname !< ascii input file name
918  integer(I4B), intent(in) :: iout !< unit number for output
919  real(DP), dimension(:), pointer, contiguous :: dbl1d
920  integer(I4B) :: nlay
921  integer(I4B) :: nvals
922  integer(I4B), dimension(:), allocatable :: array_shape
923  integer(I4B), dimension(:), allocatable :: layer_shape
924  character(len=LINELENGTH) :: keyword
925 
926  ! Check if it is a full grid sized array (NODES)
927  if (idt%shape == 'NODES') then
928  nvals = product(mshape)
929  else
930  call get_shape_from_string(idt%shape, array_shape, mf6_input%mempath)
931  nvals = array_shape(1)
932  end if
933 
934  ! allocate memory for the array
935  call mem_allocate(dbl1d, nvals, idt%mf6varname, mf6_input%mempath)
936 
937  ! read keyword
938  keyword = ''
939  call parser%GetStringCaps(keyword)
940 
941  ! check for "NETCDF" and "LAYERED"
942  if (keyword == 'NETCDF') then
943  call netcdf_read_array(dbl1d, mshape, idt, mf6_input, nc_vars, &
944  input_fname, iout)
945  else if (keyword == 'LAYERED' .and. idt%layered) then
946  call get_layered_shape(mshape, nlay, layer_shape)
947  call read_dbl1d_layered(parser, dbl1d, idt%mf6varname, nlay, layer_shape)
948  else
949  call read_dbl1d(parser, dbl1d, idt%mf6varname)
950  end if
951 
952  ! log information on the loaded array to the list file
953  call idm_log_var(dbl1d, idt%tagname, mf6_input%mempath, iout)
954 
955  ! create export file for griddata parameters if optioned
956  if (export) then
957  if (idt%blockname == 'GRIDDATA') then
958  call idm_export(dbl1d, idt%tagname, mf6_input%mempath, idt%shape, iout)
959  end if
960  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 965 of file LoadMf6File.f90.

969  type(BlockParserType), intent(inout) :: parser !< block parser
970  type(InputParamDefinitionType), intent(in) :: idt !< input data type object describing this record
971  type(ModflowInputType), intent(in) :: mf6_input !< description of input
972  integer(I4B), dimension(:), contiguous, pointer, intent(in) :: mshape !< model shape
973  logical(LGP), intent(in) :: export !< export to ascii layer files
974  type(NCPackageVarsType), pointer, intent(in) :: nc_vars
975  character(len=*), intent(in) :: input_fname !< ascii input file name
976  integer(I4B), intent(in) :: iout !< unit number for output
977  real(DP), dimension(:, :), pointer, contiguous :: dbl2d
978  integer(I4B) :: nlay
979  integer(I4B) :: nsize1, nsize2
980  integer(I4B), dimension(:), allocatable :: array_shape
981  integer(I4B), dimension(:), allocatable :: layer_shape
982  character(len=LINELENGTH) :: keyword
983 
984  ! determine the array shape from the input data definition (idt%shape),
985  ! which looks like "NCOL, NROW, NLAY"
986  call get_shape_from_string(idt%shape, array_shape, mf6_input%mempath)
987  nsize1 = array_shape(1)
988  nsize2 = array_shape(2)
989 
990  ! create a new 3d memory managed variable
991  call mem_allocate(dbl2d, nsize1, nsize2, idt%mf6varname, mf6_input%mempath)
992 
993  ! read keyword
994  keyword = ''
995  call parser%GetStringCaps(keyword)
996 
997  ! check for "NETCDF" and "LAYERED"
998  if (keyword == 'NETCDF') then
999  call netcdf_read_array(dbl2d, mshape, idt, mf6_input, nc_vars, &
1000  input_fname, iout)
1001  else if (keyword == 'LAYERED' .and. idt%layered) then
1002  call get_layered_shape(mshape, nlay, layer_shape)
1003  call read_dbl2d_layered(parser, dbl2d, idt%mf6varname, nlay, layer_shape)
1004  else
1005  call read_dbl2d(parser, dbl2d, idt%mf6varname)
1006  end if
1007 
1008  ! log information on the loaded array to the list file
1009  call idm_log_var(dbl2d, idt%tagname, mf6_input%mempath, iout)
1010 
1011  ! create export file for griddata parameters if optioned
1012  if (export) then
1013  if (idt%blockname == 'GRIDDATA') then
1014  call idm_export(dbl2d, idt%tagname, mf6_input%mempath, idt%shape, iout)
1015  end if
1016  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 1021 of file LoadMf6File.f90.

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

895  type(BlockParserType), intent(inout) :: parser !< block parser
896  type(InputParamDefinitionType), intent(in) :: idt !< input data type object describing this record
897  character(len=*), intent(in) :: memoryPath !< memorypath to put loaded information
898  integer(I4B), intent(in) :: iout !< unit number for output
899  real(DP), pointer :: dblvar
900  call mem_allocate(dblvar, idt%mf6varname, memorypath)
901  dblvar = parser%GetDouble()
902  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 718 of file LoadMf6File.f90.

722  type(BlockParserType), intent(inout) :: parser !< block parser
723  type(InputParamDefinitionType), intent(in) :: idt !< input data type object describing this record
724  type(ModflowInputType), intent(in) :: mf6_input !< description of input
725  integer(I4B), dimension(:), contiguous, pointer, intent(in) :: mshape !< model shape
726  logical(LGP), intent(in) :: export !< export to ascii layer files
727  type(NCPackageVarsType), pointer, intent(in) :: nc_vars
728  character(len=*), intent(in) :: input_fname !< ascii input file name
729  integer(I4B), intent(in) :: iout !< unit number for output
730  integer(I4B), dimension(:), pointer, contiguous :: int1d
731  integer(I4B) :: nlay
732  integer(I4B) :: nvals
733  integer(I4B), dimension(:), allocatable :: array_shape
734  integer(I4B), dimension(:), allocatable :: layer_shape
735  character(len=LINELENGTH) :: keyword
736 
737  ! Check if it is a full grid sized array (NODES), otherwise use
738  ! idt%shape to construct shape from variables in memoryPath
739  if (idt%shape == 'NODES') then
740  nvals = product(mshape)
741  else
742  call get_shape_from_string(idt%shape, array_shape, mf6_input%mempath)
743  nvals = array_shape(1)
744  end if
745 
746  ! allocate memory for the array
747  call mem_allocate(int1d, nvals, idt%mf6varname, mf6_input%mempath)
748 
749  ! read keyword
750  keyword = ''
751  call parser%GetStringCaps(keyword)
752 
753  ! check for "NETCDF" and "LAYERED"
754  if (keyword == 'NETCDF') then
755  call netcdf_read_array(int1d, mshape, idt, mf6_input, nc_vars, &
756  input_fname, iout)
757  else if (keyword == 'LAYERED' .and. idt%layered) then
758  call get_layered_shape(mshape, nlay, layer_shape)
759  call read_int1d_layered(parser, int1d, idt%mf6varname, nlay, layer_shape)
760  else
761  call read_int1d(parser, int1d, idt%mf6varname)
762  end if
763 
764  ! log information on the loaded array to the list file
765  call idm_log_var(int1d, idt%tagname, mf6_input%mempath, iout)
766 
767  ! create export file for griddata parameters if optioned
768  if (export) then
769  if (idt%blockname == 'GRIDDATA') then
770  call idm_export(int1d, idt%tagname, mf6_input%mempath, idt%shape, iout)
771  end if
772  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 777 of file LoadMf6File.f90.

781  type(BlockParserType), intent(inout) :: parser !< block parser
782  type(InputParamDefinitionType), intent(in) :: idt !< input data type object describing this record
783  type(ModflowInputType), intent(in) :: mf6_input !< description of input
784  integer(I4B), dimension(:), contiguous, pointer, intent(in) :: mshape !< model shape
785  logical(LGP), intent(in) :: export !< export to ascii layer files
786  type(NCPackageVarsType), pointer, intent(in) :: nc_vars
787  character(len=*), intent(in) :: input_fname !< ascii input file name
788  integer(I4B), intent(in) :: iout !< unit number for output
789  integer(I4B), dimension(:, :), pointer, contiguous :: int2d
790  integer(I4B) :: nlay
791  integer(I4B) :: nsize1, nsize2
792  integer(I4B), dimension(:), allocatable :: array_shape
793  integer(I4B), dimension(:), allocatable :: layer_shape
794  character(len=LINELENGTH) :: keyword
795 
796  ! determine the array shape from the input data definition (idt%shape),
797  ! which looks like "NCOL, NROW, NLAY"
798  call get_shape_from_string(idt%shape, array_shape, mf6_input%mempath)
799  nsize1 = array_shape(1)
800  nsize2 = array_shape(2)
801 
802  ! create a new 3d memory managed variable
803  call mem_allocate(int2d, nsize1, nsize2, idt%mf6varname, mf6_input%mempath)
804 
805  ! read keyword
806  keyword = ''
807  call parser%GetStringCaps(keyword)
808 
809  ! check for "NETCDF" and "LAYERED"
810  if (keyword == 'NETCDF') then
811  call netcdf_read_array(int2d, mshape, idt, mf6_input, nc_vars, &
812  input_fname, iout)
813  else if (keyword == 'LAYERED' .and. idt%layered) then
814  call get_layered_shape(mshape, nlay, layer_shape)
815  call read_int2d_layered(parser, int2d, idt%mf6varname, nlay, layer_shape)
816  else
817  call read_int2d(parser, int2d, idt%mf6varname)
818  end if
819 
820  ! log information on the loaded array to the list file
821  call idm_log_var(int2d, idt%tagname, mf6_input%mempath, iout)
822 
823  ! create export file for griddata parameters if optioned
824  if (export) then
825  if (idt%blockname == 'GRIDDATA') then
826  call idm_export(int2d, idt%tagname, mf6_input%mempath, idt%shape, iout)
827  end if
828  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 833 of file LoadMf6File.f90.

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

706  type(BlockParserType), intent(inout) :: parser !< block parser
707  type(InputParamDefinitionType), intent(in) :: idt !< input data type object describing this record
708  character(len=*), intent(in) :: memoryPath !< memorypath to put loaded information
709  integer(I4B), intent(in) :: iout !< unit number for output
710  integer(I4B), pointer :: intvar
711  call mem_allocate(intvar, idt%mf6varname, memorypath)
712  intvar = parser%GetInteger()
713  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 637 of file LoadMf6File.f90.

641  type(BlockParserType), intent(inout) :: parser !< block parser
642  type(InputParamDefinitionType), intent(in) :: idt !< input data type object describing this record
643  character(len=*), intent(in) :: memoryPath !< memorypath to put loaded information
644  character(len=*), intent(in) :: which
645  integer(I4B), intent(in) :: iout !< unit number for output
646  character(len=LINELENGTH) :: cstr
647  type(CharacterStringType), dimension(:), pointer, contiguous :: charstr1d
648  integer(I4B) :: ilen, isize, idx
649  ilen = linelength
650  if (which == 'FILEIN') then
651  call get_isize(idt%mf6varname, memorypath, isize)
652  if (isize < 0) then
653  call mem_allocate(charstr1d, ilen, 1, idt%mf6varname, memorypath)
654  idx = 1
655  else
656  call mem_setptr(charstr1d, idt%mf6varname, memorypath)
657  call mem_reallocate(charstr1d, ilen, isize + 1, idt%mf6varname, &
658  memorypath)
659  idx = isize + 1
660  end if
661  call parser%GetString(cstr, (.not. idt%preserve_case))
662  charstr1d(idx) = cstr
663  else if (which == 'FILEOUT') then
664  call load_string_type(parser, idt, memorypath, iout)
665  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 599 of file LoadMf6File.f90.

600  type(BlockParserType), intent(inout) :: parser !< block parser
601  type(InputParamDefinitionType), intent(in) :: idt !< input data type object describing this record
602  character(len=*), intent(in) :: memoryPath !< memorypath to put loaded information
603  integer(I4B), intent(in) :: iout !< unit number for output
604  integer(I4B), pointer :: intvar
605  call mem_allocate(intvar, idt%mf6varname, memorypath)
606  intvar = 1
607  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 612 of file LoadMf6File.f90.

613  use constantsmodule, only: lenbigline
614  type(BlockParserType), intent(inout) :: parser !< block parser
615  type(InputParamDefinitionType), intent(in) :: idt !< input data type object describing this record
616  character(len=*), intent(in) :: memoryPath !< memorypath to put loaded information
617  integer(I4B), intent(in) :: iout !< unit number for output
618  character(len=LINELENGTH), pointer :: cstr
619  character(len=LENBIGLINE), pointer :: bigcstr
620  integer(I4B) :: ilen
621  select case (idt%shape)
622  case ('LENBIGLINE')
623  ilen = lenbigline
624  call mem_allocate(bigcstr, ilen, idt%mf6varname, memorypath)
625  call parser%GetString(bigcstr, (.not. idt%preserve_case))
626  call idm_log_var(bigcstr, idt%tagname, memorypath, iout)
627  case default
628  ilen = linelength
629  call mem_allocate(cstr, ilen, idt%mf6varname, memorypath)
630  call parser%GetString(cstr, (.not. idt%preserve_case))
631  call idm_log_var(cstr, idt%tagname, memorypath, iout)
632  end select
integer(i4b), parameter lenbigline
maximum length of a big line
Definition: Constants.f90:15
Here is the caller 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 253 of file LoadMf6File.f90.

254  use memorytypemodule, only: memorytype
256  class(LoadMf6FileType) :: this
257  integer(I4B), intent(in) :: iblk
258  logical(LGP), intent(in) :: recursive_call !< true if recursive call
259  logical(LGP) :: isblockfound
260  logical(LGP) :: endOfBlock
261  logical(LGP) :: supportOpenClose
262  integer(I4B) :: ierr
263  logical(LGP) :: found, required
264  type(MemoryType), pointer :: mt
265 
266  ! disu vertices/cell2d blocks are contingent on NVERT dimension
267  if (this%mf6_input%pkgtype == 'DISU6' .or. &
268  this%mf6_input%pkgtype == 'DISV1D6' .or. &
269  this%mf6_input%pkgtype == 'DISV2D6') then
270  if (this%mf6_input%block_dfns(iblk)%blockname == 'VERTICES' .or. &
271  this%mf6_input%block_dfns(iblk)%blockname == 'CELL2D') then
272  call get_from_memorystore('NVERT', this%mf6_input%mempath, mt, found, &
273  .false.)
274  if (.not. found) return
275  if (mt%intsclr == 0) return
276  end if
277  end if
278 
279  ! block open/close support
280  supportopenclose = (this%mf6_input%block_dfns(iblk)%blockname /= 'GRIDDATA')
281 
282  ! parser search for block
283  required = this%mf6_input%block_dfns(iblk)%required .and. .not. recursive_call
284  call this%parser%GetBlock(this%mf6_input%block_dfns(iblk)%blockname, &
285  isblockfound, ierr, &
286  supportopenclose=supportopenclose, &
287  blockrequired=required)
288  ! process block
289  if (isblockfound) then
290  if (this%mf6_input%block_dfns(iblk)%aggregate) then
291  ! process block recarray type, set of variable 1d/2d types
292  call this%parse_structarray_block(iblk)
293  else
294  do
295  ! process each line in block
296  call this%parser%GetNextLine(endofblock)
297  if (endofblock) exit
298  ! process line as tag(s)
299  call this%parse_tag(iblk, .false.)
300  end do
301  end if
302  end if
303 
304  ! recurse if block is reloadable and was just read
305  if (this%mf6_input%block_dfns(iblk)%block_variable) then
306  if (isblockfound) then
307  call this%parse_block(iblk, .true.)
308  end if
309  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 312 of file LoadMf6File.f90.

313  class(LoadMf6FileType) :: this
314  integer(I4B), intent(in) :: iblk
315  character(len=*), intent(in) :: pkgtype
316  character(len=*), intent(in) :: which
317  character(len=*), intent(in) :: tag
318  type(InputParamDefinitionType), pointer :: idt !< input data type object describing this record
319  ! matches, read and load file name
320  idt => &
321  get_param_definition_type(this%mf6_input%param_dfns, &
322  this%mf6_input%component_type, &
323  this%mf6_input%subcomponent_type, &
324  this%mf6_input%block_dfns(iblk)%blockname, &
325  tag, this%filename)
326  ! load io tag
327  call load_io_tag(this%parser, idt, this%mf6_input%mempath, which, this%iout)
Here is the call graph for this function:

◆ parse_keyword_tag()

subroutine loadmf6filemodule::parse_keyword_tag ( class(loadmf6filetype this,
integer(i4b), intent(in)  iblk,
character(len=linelength), intent(in)  tag,
type(inputparamdefinitiontype), intent(in), pointer  idt 
)
private

Definition at line 330 of file LoadMf6File.f90.

332  class(LoadMf6FileType) :: this
333  integer(I4B), intent(in) :: iblk
334  character(len=LINELENGTH), intent(in) :: tag
335  type(InputParamDefinitionType), pointer, intent(in) :: idt
336  character(len=40), dimension(:), allocatable :: words
337  integer(I4B) :: nwords
338  character(len=LINELENGTH) :: io_tag
339  logical(LGP) :: found
340 
341  ! initialization
342  found = .false.
343 
344  ! if in record tag check and load if input/output file
345  if (idt%in_record) then
346  ! get tokens in matching definition
347  call split_record_definition(this%mf6_input%param_dfns, &
348  this%mf6_input%component_type, &
349  this%mf6_input%subcomponent_type, &
350  tag, nwords, words)
351  ! a filein/fileout record tag definition has 4 tokens
352  if (nwords == 4) then
353  ! verify third definition token is FILEIN/FILEOUT
354  if (words(3) == 'FILEIN' .or. words(3) == 'FILEOUT') then
355  ! read 3rd token
356  call this%parser%GetStringCaps(io_tag)
357  ! check if 3rd token matches definition
358  if (io_tag == words(3)) then
359  call this%parse_io_tag(iblk, words(2), words(3), words(4))
360  found = .true.
361  else
362  errmsg = 'Expected "'//trim(words(3))//'" following keyword "'// &
363  trim(tag)//'" but instead found "'//trim(io_tag)//'"'
364  call store_error(errmsg)
365  call this%parser%StoreErrorUnit()
366  end if
367  end if
368  end if
369 
370  ! deallocate words
371  if (allocated(words)) deallocate (words)
372  end if
373 
374  if (.not. found) then
375  ! load standard keyword tag
376  call load_keyword_type(this%parser, idt, this%mf6_input%mempath, this%iout)
377  ! check/set as dev option
378  if (idt%tagname(1:4) == 'DEV_' .and. &
379  this%mf6_input%block_dfns(iblk)%blockname == 'OPTIONS') then
380  call this%parser%DevOpt()
381  end if
382  end if
This module contains the DefinitionSelectModule.
subroutine, public split_record_definition(input_definition_types, component_type, subcomponent_type, tagname, nwords, words)
Return aggregate definition.
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 503 of file LoadMf6File.f90.

506  class(LoadMf6FileType) :: this
507  integer(I4B), intent(in) :: iblk
508  type(DynamicPackageParamsType) :: block_params
509  type(InputParamDefinitionType), pointer :: idt !< input data type object describing this record
510  type(InputParamDefinitionType), target :: blockvar_idt
511  integer(I4B) :: blocknum
512  integer(I4B), pointer :: nrow
513  integer(I4B) :: nrows, nrowsread
514  integer(I4B) :: ibinary, oc_inunit
515  integer(I4B) :: icol, iparam
516  integer(I4B) :: ncol
517 
518  ! initialize package params object
519  call block_params%init(this%mf6_input, &
520  this%mf6_input%block_dfns(iblk)%blockname, &
521  this%readasarrays, this%iauxiliary, this%inamedbound)
522  ! set input definition for this block
523  idt => &
524  get_aggregate_definition_type(this%mf6_input%aggregate_dfns, &
525  this%mf6_input%component_type, &
526  this%mf6_input%subcomponent_type, &
527  this%mf6_input%block_dfns(iblk)%blockname)
528  ! if block is reloadable read the block number
529  if (this%mf6_input%block_dfns(iblk)%block_variable) then
530  blocknum = this%parser%GetInteger()
531  else
532  blocknum = 0
533  end if
534 
535  ! set ncol
536  ncol = block_params%nparam
537  ! add col if block is reloadable
538  if (blocknum > 0) ncol = ncol + 1
539  ! use shape to set the max num of rows
540  if (idt%shape /= '') then
541  call mem_setptr(nrow, idt%shape, this%mf6_input%mempath)
542  nrows = nrow
543  else
544  nrows = -1
545  end if
546 
547  ! create a structured array
548  this%structarray => constructstructarray(this%mf6_input, ncol, nrows, &
549  blocknum, this%mf6_input%mempath, &
550  this%mf6_input%component_mempath)
551  ! create structarray vectors for each column
552  do icol = 1, ncol
553  ! if block is reloadable, block number is first column
554  if (blocknum > 0) then
555  if (icol == 1) then
556  blockvar_idt = this%block_index_dfn(iblk)
557  idt => blockvar_idt
558  call this%structarray%mem_create_vector(icol, idt)
559  ! continue as this column managed by internally SA object
560  cycle
561  end if
562  ! set indexes (where first column is blocknum)
563  iparam = icol - 1
564  else
565  ! set indexes (no blocknum column)
566  iparam = icol
567  end if
568  ! set pointer to input definition for this 1d vector
569  idt => &
570  get_param_definition_type(this%mf6_input%param_dfns, &
571  this%mf6_input%component_type, &
572  this%mf6_input%subcomponent_type, &
573  this%mf6_input%block_dfns(iblk)%blockname, &
574  block_params%params(iparam), this%filename)
575  ! allocate variable in memory manager
576  call this%structarray%mem_create_vector(icol, idt)
577  end do
578 
579  ! read the block control record
580  ibinary = read_control_record(this%parser, oc_inunit, this%iout)
581 
582  if (ibinary == 1) then
583  ! read from binary
584  nrowsread = this%structarray%read_from_binary(oc_inunit, this%iout)
585  call this%parser%terminateblock()
586  close (oc_inunit)
587  else
588  ! read from ascii
589  nrowsread = this%structarray%read_from_parser(this%parser, this%ts_active, &
590  this%iout)
591  end if
592 
593  ! clean up
594  call block_params%destroy()
This module contains the DynamicPackageParamsModule.
type(structarraytype) function, pointer, public constructstructarray(mf6_input, ncol, nrow, blocknum, mempath, component_mempath)
constructor for a struct_array
Definition: StructArray.f90:73
type for structured array
Definition: StructArray.f90:36
Here is the call graph for this function:

◆ parse_tag()

recursive subroutine loadmf6filemodule::parse_tag ( class(loadmf6filetype this,
integer(i4b), intent(in)  iblk,
logical(lgp), intent(in)  recursive_call 
)

Load an individual input record into the memory manager. Allow for recursive calls in the case that multiple tags are on a single line.

Parameters
[in]recursive_calltrue if recursive call

Definition at line 392 of file LoadMf6File.f90.

394  class(LoadMf6FileType) :: this
395  integer(I4B), intent(in) :: iblk
396  logical(LGP), intent(in) :: recursive_call !< true if recursive call
397  character(len=LINELENGTH) :: tag
398  type(InputParamDefinitionType), pointer :: idt !< input data type object describing this record
399 
400  ! read tag name
401  call this%parser%GetStringCaps(tag)
402  if (recursive_call) then
403  if (tag == '') then
404  ! no data on line so return
405  return
406  end if
407  end if
408 
409  ! find keyword in input definition
410  idt => get_param_definition_type(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  tag, this%filename)
415 
416  ! allocate and load data type
417  select case (idt%datatype)
418  case ('KEYWORD')
419  call this%parse_keyword_tag(iblk, tag, idt)
420  case ('STRING')
421  if (idt%shape == 'NAUX') then
422  call load_auxvar_names(this%parser, idt, this%mf6_input%mempath, &
423  this%iout)
424  else
425  call load_string_type(this%parser, idt, this%mf6_input%mempath, this%iout)
426  end if
427  case ('INTEGER')
428  call load_integer_type(this%parser, idt, this%mf6_input%mempath, this%iout)
429  case ('INTEGER1D')
430  call load_integer1d_type(this%parser, idt, this%mf6_input, this%mshape, &
431  this%export, this%nc_vars, this%filename, &
432  this%iout)
433  case ('INTEGER2D')
434  call load_integer2d_type(this%parser, idt, this%mf6_input, this%mshape, &
435  this%export, this%nc_vars, this%filename, &
436  this%iout)
437  case ('INTEGER3D')
438  call load_integer3d_type(this%parser, idt, this%mf6_input, this%mshape, &
439  this%export, this%nc_vars, this%filename, &
440  this%iout)
441  case ('DOUBLE')
442  call load_double_type(this%parser, idt, this%mf6_input%mempath, this%iout)
443  case ('DOUBLE1D')
444  call load_double1d_type(this%parser, idt, this%mf6_input, this%mshape, &
445  this%export, this%nc_vars, this%filename, this%iout)
446  case ('DOUBLE2D')
447  call load_double2d_type(this%parser, idt, this%mf6_input, this%mshape, &
448  this%export, this%nc_vars, this%filename, this%iout)
449  case ('DOUBLE3D')
450  call load_double3d_type(this%parser, idt, this%mf6_input, this%mshape, &
451  this%export, this%nc_vars, this%filename, this%iout)
452  case default
453  write (errmsg, '(a,a)') 'Failure reading data for tag: ', trim(tag)
454  call store_error(errmsg)
455  call this%parser%StoreErrorUnit()
456  end select
457 
458  ! continue line if in same record
459  if (idt%in_record) then
460  ! recursively call parse tag again to read rest of line
461  call this%parse_tag(iblk, .true.)
462  end if
463 
464  call expandarray(this%block_tags)
465  this%block_tags(size(this%block_tags)) = trim(idt%tagname)
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 1080 of file LoadMf6File.f90.

1081  use simmodule, only: store_error_unit
1082  use inputoutputmodule, only: urword
1083  use inputoutputmodule, only: openfile
1084  use openspecmodule, only: form, access
1085  use constantsmodule, only: linelength
1087  type(BlockParserType), intent(inout) :: parser
1088  integer(I4B), intent(inout) :: oc_inunit
1089  integer(I4B), intent(in) :: iout
1090  integer(I4B) :: ibinary
1091  integer(I4B) :: lloc, istart, istop, idum, inunit, itmp, ierr
1092  integer(I4B) :: nunopn = 99
1093  character(len=:), allocatable :: line
1094  character(len=LINELENGTH) :: fname
1095  logical(LGP) :: exists
1096  real(DP) :: r
1097  character(len=*), parameter :: fmtocne = &
1098  &"('Specified OPEN/CLOSE file ',(A),' does not exist')"
1099  character(len=*), parameter :: fmtobf = &
1100  &"(1X,/1X,'OPENING BINARY FILE ON UNIT ',I0,':',/1X,A)"
1101 
1102  ! initialize oc_inunit and ibinary
1103  oc_inunit = 0
1104  ibinary = 0
1105  inunit = parser%getunit()
1106 
1107  ! Read to the first non-commented line
1108  lloc = 1
1109  call parser%line_reader%rdcom(inunit, iout, line, ierr)
1110  call urword(line, lloc, istart, istop, 1, idum, r, iout, inunit)
1111 
1112  if (line(istart:istop) == 'OPEN/CLOSE') then
1113  ! get filename
1114  call urword(line, lloc, istart, istop, 0, idum, r, &
1115  iout, inunit)
1116  fname = line(istart:istop)
1117  ! check to see if file OPEN/CLOSE file exists
1118  inquire (file=fname, exist=exists)
1119  if (.not. exists) then
1120  write (errmsg, fmtocne) line(istart:istop)
1121  call store_error(errmsg)
1122  call store_error('Specified OPEN/CLOSE file does not exist')
1123  call store_error_unit(inunit)
1124  end if
1125 
1126  ! Check for (BINARY) keyword
1127  call urword(line, lloc, istart, istop, 1, idum, r, &
1128  iout, inunit)
1129 
1130  if (line(istart:istop) == '(BINARY)') ibinary = 1
1131  ! Open the file depending on ibinary flag
1132  if (ibinary == 1) then
1133  oc_inunit = nunopn
1134  itmp = iout
1135  if (iout > 0) then
1136  itmp = 0
1137  write (iout, fmtobf) oc_inunit, trim(adjustl(fname))
1138  end if
1139  call openfile(oc_inunit, itmp, fname, 'OPEN/CLOSE', &
1140  fmtarg_opt=form, accarg_opt=access)
1141  end if
1142  end if
1143 
1144  if (ibinary == 0) then
1145  call parser%line_reader%bkspc(parser%getunit())
1146  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: