MODFLOW 6  version 6.5.0.dev2
MODFLOW 6 Code Documentation
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 More...
 
character(len=linelength) function, public idt_datatype (idt)
 return input definition type datatype More...
 
type(inputparamdefinitiontype) function, pointer, public get_param_definition_type (input_definition_types, component_type, subcomponent_type, blockname, tagname, filename)
 Return parameter definition. More...
 
type(inputparamdefinitiontype) function, pointer, public get_aggregate_definition_type (input_definition_types, component_type, subcomponent_type, blockname)
 Return aggregate definition. More...
 
subroutine, public split_record_definition (input_definition_types, component_type, subcomponent_type, tagname, nwords, words)
 Return aggregate definition. More...
 

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 141 of file DefinitionSelect.f90.

143  type(InputParamDefinitionType), dimension(:), intent(in), target :: &
144  input_definition_types
145  character(len=*), intent(in) :: component_type !< component type, such as GWF or GWT
146  character(len=*), intent(in) :: subcomponent_type !< subcomponent type, such as DIS or NPF
147  character(len=*), intent(in) :: blockname !< name of the block
148  type(InputParamDefinitionType), pointer :: idt !< corresponding InputParameterDefinitionType for this block
149  type(InputParamDefinitionType), pointer :: tmp_ptr
150  integer(I4B) :: i
151  !
152  nullify (idt)
153  do i = 1, size(input_definition_types)
154  tmp_ptr => input_definition_types(i)
155  if (tmp_ptr%component_type == component_type .and. &
156  tmp_ptr%subcomponent_type == subcomponent_type .and. &
157  tmp_ptr%blockname == blockname) then
158  idt => input_definition_types(i)
159  exit
160  end if
161  end do
162  !
163  if (.not. associated(idt)) then
164  write (errmsg, '(a,a,a,a,a,a,a)') &
165  'Idm aggregate definition not found: ', trim(blockname), &
166  '. Component="', trim(component_type), &
167  '", subcomponent="', trim(subcomponent_type), '".'
168  call store_error(errmsg, .true.)
169  end if
170  !
171  ! -- return
172  return
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 
)
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
Returns
corresponding InputParameterDefinitionType for this tag

Definition at line 99 of file DefinitionSelect.f90.

103  type(InputParamDefinitionType), dimension(:), intent(in), target :: &
104  input_definition_types
105  character(len=*), intent(in) :: component_type !< component type, such as GWF or GWT
106  character(len=*), intent(in) :: subcomponent_type !< subcomponent type, such as DIS or NPF
107  character(len=*), intent(in) :: blockname !< name of the block
108  character(len=*), intent(in) :: tagname !< name of the input tag
109  character(len=*), intent(in) :: filename !< input filename
110  type(InputParamDefinitionType), pointer :: idt !< corresponding InputParameterDefinitionType for this tag
111  type(InputParamDefinitionType), pointer :: tmp_ptr
112  integer(I4B) :: i
113  !
114  nullify (idt)
115  do i = 1, size(input_definition_types)
116  tmp_ptr => input_definition_types(i)
117  if (tmp_ptr%component_type == component_type .and. &
118  tmp_ptr%subcomponent_type == subcomponent_type .and. &
119  tmp_ptr%blockname == blockname .and. &
120  tmp_ptr%tagname == tagname) then
121  idt => input_definition_types(i)
122  exit
123  end if
124  end do
125  !
126  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
134  !
135  ! -- return
136  return
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 75 of file DefinitionSelect.f90.

76  ! -- modules
77  use constantsmodule, only: linelength
78  ! -- dummy
79  type(InputParamDefinitionType), pointer, intent(in) :: idt
80  ! -- result
81  character(len=LINELENGTH) :: datatype
82  !
83  if (idt%datatype(1:9) == 'KEYSTRING') then
84  datatype = 'KEYSTRING'
85  else if (idt%datatype(1:8) == 'RECARRAY') then
86  datatype = 'RECARRAY'
87  else if (idt%datatype(1:6) == 'RECORD') then
88  datatype = 'RECORD'
89  else
90  datatype = idt%datatype
91  end if
92  !
93  ! -- return
94  return
This module contains simulation constants.
Definition: Constants.f90:9
integer(i4b), parameter linelength
maximum length of a standard line
Definition: Constants.f90:44
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 28 of file DefinitionSelect.f90.

29  ! -- modules
30  use constantsmodule, only: linelength
31  use inputoutputmodule, only: parseline
32  ! -- dummy
33  type(InputParamDefinitionType), pointer, intent(in) :: idt
34  character(len=LINELENGTH), dimension(:), allocatable, &
35  intent(inout) :: cols
36  integer(I4B), intent(inout) :: ncol
37  ! -- local
38  character(len=:), allocatable :: parse_str
39  character(len=LINELENGTH), dimension(:), allocatable :: param_cols
40  integer(I4B) :: param_ncol, n
41  !
42  ! -- initialize
43  if (allocated(cols)) deallocate (cols)
44  ncol = 0
45  !
46  ! -- split definition
47  parse_str = trim(idt%datatype)//' '
48  call parseline(parse_str, param_ncol, param_cols)
49  !
50  if (param_ncol > 1) then
51  if (param_cols(1) == 'RECARRAY' .or. &
52  param_cols(1) == 'KEYSTRING' .or. &
53  param_cols(1) == 'RECORD') then
54  ! -- exclude 1st column
55  allocate (cols(param_ncol - 1))
56  do n = 2, param_ncol
57  cols(n - 1) = param_cols(n)
58  end do
59  !
60  ! -- set ncol
61  ncol = param_ncol - 1
62  end if
63  end if
64  !
65  ! -- cleanup
66  if (allocated(param_cols)) deallocate (param_cols)
67  if (allocated(parse_str)) deallocate (parse_str)
68  !
69  ! -- return
70  return
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_definition()

subroutine, public definitionselectmodule::split_record_definition ( 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 180 of file DefinitionSelect.f90.

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