MODFLOW 6 version 6.9.0.dev0
USGS Modular Hydrologic Model
Loading...
Searching...
No Matches
definitionselectmodule Module Reference

This module contains the DefinitionSelectModule. More...

Functions/Subroutines

subroutine, public idt_parse_rectype (idt, cols, ncol)
 allocate and set RECARRAY, KEYSTRING or RECORD param list
character(len=linelength) function, public idt_datatype (idt)
 return input definition type datatype
type(inputparamdefinitiontype) function, pointer, public get_param_definition_type (input_definition_types, component_type, subcomponent_type, blockname, tagname, filename, found)
 Return parameter definition.
type(inputparamdefinitiontype) function, pointer, public get_aggregate_definition_type (input_definition_types, component_type, subcomponent_type, blockname)
 Return aggregate definition.
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.
type(inputparamdefinitiontype) function, pointer, public idt_default (component_type, subcomponent_type, blockname, tagname, mf6varname, datatype)
 return allocated input definition type

Detailed Description

This module contains the routines for getting parameter definitions, aggregate definitions, and block definitions for the different package types.

Function/Subroutine Documentation

◆ get_aggregate_definition_type()

type(inputparamdefinitiontype) function, pointer, public definitionselectmodule::get_aggregate_definition_type ( type(inputparamdefinitiontype), dimension(:), intent(in), target input_definition_types,
character(len=*), intent(in) component_type,
character(len=*), intent(in) subcomponent_type,
character(len=*), intent(in) blockname )
Parameters
[in]component_typecomponent type, such as GWF or GWT
[in]subcomponent_typesubcomponent type, such as DIS or NPF
[in]blocknamename of the block
Returns
corresponding InputParameterDefinitionType for this block

Definition at line 138 of file DefinitionSelect.f90.

140 use constantsmodule, only: linelength
142 type(InputParamDefinitionType), dimension(:), intent(in), target :: &
143 input_definition_types
144 character(len=*), intent(in) :: component_type !< component type, such as GWF or GWT
145 character(len=*), intent(in) :: subcomponent_type !< subcomponent type, such as DIS or NPF
146 character(len=*), intent(in) :: blockname !< name of the block
147 type(InputParamDefinitionType), pointer :: idt !< corresponding InputParameterDefinitionType for this block
148 type(InputParamDefinitionType), pointer :: tmp_ptr
149 character(len=LINELENGTH) :: component
150 integer(I4B) :: i
151
152 if (idm_utl_type(component_type, subcomponent_type)) then
153 component = 'UTL'
154 else
155 component = component_type
156 end if
157
158 nullify (idt)
159 do i = 1, size(input_definition_types)
160 tmp_ptr => input_definition_types(i)
161 if (tmp_ptr%component_type == component .and. &
162 tmp_ptr%subcomponent_type == subcomponent_type .and. &
163 tmp_ptr%blockname == blockname) then
164 idt => input_definition_types(i)
165 exit
166 end if
167 end do
168
169 if (.not. associated(idt)) then
170 write (errmsg, '(a,a,a,a,a,a,a)') &
171 'Idm aggregate definition not found: ', trim(blockname), &
172 '. Component="', trim(component_type), &
173 '", subcomponent="', trim(subcomponent_type), '".'
174 call store_error(errmsg, .true.)
175 end if
This module contains simulation constants.
Definition Constants.f90:9
integer(i4b), parameter linelength
maximum length of a standard line
Definition Constants.f90:45
This module contains the SourceCommonModule.
logical(lgp) function, public idm_utl_type(component, subcomponent)
is utility type
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_param_definition_type()

type(inputparamdefinitiontype) function, pointer, public definitionselectmodule::get_param_definition_type ( type(inputparamdefinitiontype), dimension(:), intent(in), target input_definition_types,
character(len=*), intent(in) component_type,
character(len=*), intent(in) subcomponent_type,
character(len=*), intent(in) blockname,
character(len=*), intent(in) tagname,
character(len=*), intent(in) filename,
logical(lgp), intent(out), optional found )
Parameters
[in]component_typecomponent type, such as GWF or GWT
[in]subcomponent_typesubcomponent type, such as DIS or NPF
[in]blocknamename of the block
[in]tagnamename of the input tag
[in]filenameinput filename
[out]foundis tagname found in search mempath
Returns
corresponding InputParameterDefinitionType for this tag

Definition at line 86 of file DefinitionSelect.f90.

93 type(InputParamDefinitionType), dimension(:), intent(in), target :: &
94 input_definition_types
95 character(len=*), intent(in) :: component_type !< component type, such as GWF or GWT
96 character(len=*), intent(in) :: subcomponent_type !< subcomponent type, such as DIS or NPF
97 character(len=*), intent(in) :: blockname !< name of the block
98 character(len=*), intent(in) :: tagname !< name of the input tag
99 character(len=*), intent(in) :: filename !< input filename
100 logical(LGP), optional, intent(out) :: found !< is tagname found in search mempath
101 type(InputParamDefinitionType), pointer :: idt !< corresponding InputParameterDefinitionType for this tag
102 type(InputParamDefinitionType), pointer :: tmp_ptr
103 character(len=LINELENGTH) :: component
104 integer(I4B) :: i
105
106 if (idm_utl_type(component_type, subcomponent_type)) then
107 component = 'UTL'
108 else
109 component = component_type
110 end if
111
112 nullify (idt)
113 do i = 1, size(input_definition_types)
114 tmp_ptr => input_definition_types(i)
115 if (tmp_ptr%component_type == component .and. &
116 tmp_ptr%subcomponent_type == subcomponent_type .and. &
117 tmp_ptr%blockname == blockname .and. &
118 tmp_ptr%tagname == tagname) then
119 idt => input_definition_types(i)
120 exit
121 end if
122 end do
123
124 if (present(found)) then
125 found = associated(idt)
126 else if (.not. associated(idt)) then
127 write (errmsg, '(a,a,a,a,a)') &
128 'Input file tag not found: "', trim(tagname), &
129 '" in block "', trim(blockname), &
130 '".'
131 call store_error(errmsg)
132 call store_error_filename(filename)
133 end if
Here is the call graph for this function:
Here is the caller graph for this function:

◆ idt_datatype()

character(len=linelength) function, public definitionselectmodule::idt_datatype ( type(inputparamdefinitiontype), intent(in), pointer idt)

Definition at line 69 of file DefinitionSelect.f90.

71 type(InputParamDefinitionType), pointer, intent(in) :: idt
72 character(len=LINELENGTH) :: datatype
73 if (idt%datatype(1:9) == 'KEYSTRING') then
74 datatype = 'KEYSTRING'
75 else if (idt%datatype(1:8) == 'RECARRAY') then
76 datatype = 'RECARRAY'
77 else if (idt%datatype(1:6) == 'RECORD') then
78 datatype = 'RECORD'
79 else
80 datatype = idt%datatype
81 end if
Here is the caller graph for this function:

◆ idt_default()

type(inputparamdefinitiontype) function, pointer, public definitionselectmodule::idt_default ( character(len=*), intent(in) component_type,
character(len=*), intent(in) subcomponent_type,
character(len=*), intent(in) blockname,
character(len=*), intent(in) tagname,
character(len=*), intent(in) mf6varname,
character(len=*), intent(in) datatype )

Definition at line 298 of file DefinitionSelect.f90.

300 ! -- modules
301 ! -- dummy
302 character(len=*), intent(in) :: component_type
303 character(len=*), intent(in) :: subcomponent_type
304 character(len=*), intent(in) :: blockname
305 character(len=*), intent(in) :: tagname
306 character(len=*), intent(in) :: mf6varname
307 character(len=*), intent(in) :: datatype
308 ! -- result
309 type(InputParamDefinitionType), pointer :: idt
310
311 allocate (idt)
312
313 idt%component_type = trim(component_type)
314 idt%subcomponent_type = trim(subcomponent_type)
315 idt%blockname = trim(blockname)
316 idt%tagname = trim(tagname)
317 idt%mf6varname = trim(mf6varname)
318 idt%datatype = trim(datatype)
319 idt%shape = ''
320 idt%required = .true.
321 idt%developmode = .false.
322 idt%in_record = .false.
323 idt%preserve_case = .false.
324 idt%layered = .false.
325 idt%timeseries = .false.
Here is the caller graph for this function:

◆ idt_parse_rectype()

subroutine, public definitionselectmodule::idt_parse_rectype ( type(inputparamdefinitiontype), intent(in), pointer idt,
character(len=linelength), dimension(:), intent(inout), allocatable cols,
integer(i4b), intent(inout) ncol )

Definition at line 29 of file DefinitionSelect.f90.

32 type(InputParamDefinitionType), pointer, intent(in) :: idt
33 character(len=LINELENGTH), dimension(:), allocatable, &
34 intent(inout) :: cols
35 integer(I4B), intent(inout) :: ncol
36 character(len=:), allocatable :: parse_str
37 character(len=LINELENGTH), dimension(:), allocatable :: param_cols
38 integer(I4B) :: param_ncol, n
39
40 ! initialize
41 if (allocated(cols)) deallocate (cols)
42 ncol = 0
43
44 ! split definition
45 parse_str = trim(idt%datatype)//' '
46 call parseline(parse_str, param_ncol, param_cols)
47
48 if (param_ncol > 1) then
49 if (param_cols(1) == 'RECARRAY' .or. &
50 param_cols(1) == 'KEYSTRING' .or. &
51 param_cols(1) == 'RECORD') then
52 ! exclude 1st column
53 allocate (cols(param_ncol - 1))
54 do n = 2, param_ncol
55 cols(n - 1) = param_cols(n)
56 end do
57 ! set ncol
58 ncol = param_ncol - 1
59 end if
60 end if
61
62 ! cleanup
63 if (allocated(param_cols)) deallocate (param_cols)
64 if (allocated(parse_str)) deallocate (parse_str)
subroutine, public parseline(line, nwords, words, inunit, filename)
Parse a line into words.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ split_record_dfn_tag1()

subroutine, public definitionselectmodule::split_record_dfn_tag1 ( type(inputparamdefinitiontype), dimension(:), intent(in), target input_definition_types,
character(len=*), intent(in) component_type,
character(len=*), intent(in) subcomponent_type,
character(len=*), intent(in) tagname,
integer(i4b), intent(inout) nwords,
character(len=40), dimension(:), intent(inout), allocatable words )

Split a component RECORD datatype definition whose second element matches tagname into an array of character tokens

Parameters
[in]component_typecomponent type, such as GWF or GWT
[in]subcomponent_typesubcomponent type, such as DIS or NPF
[in]tagnamename of the input tag

Definition at line 183 of file DefinitionSelect.f90.

186 type(InputParamDefinitionType), dimension(:), intent(in), target :: &
187 input_definition_types
188 character(len=*), intent(in) :: component_type !< component type, such as GWF or GWT
189 character(len=*), intent(in) :: subcomponent_type !< subcomponent type, such as DIS or NPF
190 character(len=*), intent(in) :: tagname !< name of the input tag
191 integer(I4B), intent(inout) :: nwords
192 character(len=40), dimension(:), allocatable, intent(inout) :: words
193 type(InputParamDefinitionType), pointer :: tmp_ptr
194 integer(I4B) :: i
195 character(len=:), allocatable :: parse_str
196
197 ! initialize to deallocated
198 if (allocated(words)) deallocate (words)
199
200 ! return all tokens of multi-record type that matches the first
201 ! tag following the expected first token "RECORD"
202 do i = 1, size(input_definition_types)
203
204 ! initialize
205 nwords = 0
206
207 ! set ptr to current definition
208 tmp_ptr => input_definition_types(i)
209
210 ! match for definition to split
211 if (tmp_ptr%component_type == component_type .and. &
212 tmp_ptr%subcomponent_type == subcomponent_type .and. &
213 idt_datatype(tmp_ptr) == 'RECORD') then
214
215 ! set split string
216 parse_str = trim(input_definition_types(i)%datatype)//' '
217
218 ! split
219 call parseline(parse_str, nwords, words)
220
221 ! check for match and manage memory
222 if (nwords >= 2) then
223 if (words(1) == 'RECORD' .and. words(2) == tagname) then
224 exit
225 end if
226 end if
227
228 ! deallocate
229 if (allocated(parse_str)) deallocate (parse_str)
230 if (allocated(words)) deallocate (words)
231 end if
232 end do
Here is the call graph for this function:
Here is the caller graph for this function:

◆ split_record_dfn_tag2()

subroutine, public definitionselectmodule::split_record_dfn_tag2 ( type(inputparamdefinitiontype), dimension(:), intent(in), target input_definition_types,
character(len=*), intent(in) component_type,
character(len=*), intent(in) subcomponent_type,
character(len=*), intent(in) tagname,
character(len=*), intent(in) tag2,
integer(i4b), intent(inout) nwords,
character(len=40), dimension(:), intent(inout), allocatable words )

Split a component RECORD datatype definition whose second and third elements match tagnames into an array of character tokens

Parameters
[in]component_typecomponent type, such as GWF or GWT
[in]subcomponent_typesubcomponent type, such as DIS or NPF
[in]tagnamename of the input tag

Definition at line 240 of file DefinitionSelect.f90.

244 type(InputParamDefinitionType), dimension(:), intent(in), target :: &
245 input_definition_types
246 character(len=*), intent(in) :: component_type !< component type, such as GWF or GWT
247 character(len=*), intent(in) :: subcomponent_type !< subcomponent type, such as DIS or NPF
248 character(len=*), intent(in) :: tagname !< name of the input tag
249 character(len=*), intent(in) :: tag2
250 integer(I4B), intent(inout) :: nwords
251 character(len=40), dimension(:), allocatable, intent(inout) :: words
252 type(InputParamDefinitionType), pointer :: tmp_ptr
253 integer(I4B) :: i
254 character(len=:), allocatable :: parse_str
255
256 ! initialize to deallocated
257 if (allocated(words)) deallocate (words)
258
259 ! return all tokens of multi-record type that matches the first
260 ! tag following the expected first token "RECORD"
261 do i = 1, size(input_definition_types)
262
263 ! initialize
264 nwords = 0
265
266 ! set ptr to current definition
267 tmp_ptr => input_definition_types(i)
268
269 ! match for definition to split
270 if (tmp_ptr%component_type == component_type .and. &
271 tmp_ptr%subcomponent_type == subcomponent_type .and. &
272 idt_datatype(tmp_ptr) == 'RECORD') then
273
274 ! set split string
275 parse_str = trim(input_definition_types(i)%datatype)//' '
276
277 ! split
278 call parseline(parse_str, nwords, words)
279
280 ! check for match and manage memory
281 if (nwords >= 2) then
282 if (words(1) == 'RECORD' .and. &
283 words(2) == tagname .and. &
284 words(3) == tag2) then
285 exit
286 end if
287 end if
288
289 ! deallocate
290 if (allocated(parse_str)) deallocate (parse_str)
291 if (allocated(words)) deallocate (words)
292 end if
293 end do
Here is the call graph for this function:
Here is the caller graph for this function: