30 character(len=LENPACKAGETYPE) :: pkgtype
32 character(len=LENCOMPONENTNAME) :: subcomponent_type
34 character(len=LINELENGTH),
dimension(:),
allocatable :: filenames
35 character(len=LENPACKAGENAME),
dimension(:),
allocatable :: pkgnames
36 character(len=LENMEMPATH),
dimension(:),
allocatable :: mempaths
37 integer(I4B),
dimension(:),
allocatable :: inunits
54 character(len=LENPACKAGETYPE) :: modeltype
55 character(len=LINELENGTH) :: modelfname
56 character(len=LENMODELNAME) :: modelname
58 character(len=LENCOMPONENTNAME) :: component_type
60 character(len=LENMEMPATH) :: input_mempath
61 character(len=LENMEMPATH) :: model_mempath
64 pointer :: pkgtypes => null()
66 pointer :: pkgnames => null()
68 pointer :: mempaths => null()
69 integer(I4B),
dimension(:),
contiguous, &
70 pointer :: inunits => null()
74 integer(I4B) :: niunit
75 character(len=LENPACKAGETYPE),
dimension(:),
allocatable :: cunit
96 character(len=LENCOMPONENTNAME),
intent(in) :: mtype_component
97 character(len=LENCOMPONENTNAME),
intent(in) :: ptype_component
98 character(len=LENFTYPE),
intent(in) :: pkgtype
99 logical(LGP) :: multi_pkg
113 character(len=*),
intent(in) :: modeltype
114 character(len=*),
intent(in) :: modelname
115 character(len=*),
intent(in) :: pkgtype
118 this%pkgtype = pkgtype
123 allocate (this%filenames(0))
124 allocate (this%pkgnames(0))
125 allocate (this%mempaths(0))
126 allocate (this%inunits(0))
131 subroutine pkgtype_add(this, modelname, mtype_component, filetype, &
132 filename, pkgname, iout)
140 character(len=*),
intent(in) :: modelname
141 character(len=*),
intent(in) :: mtype_component
142 character(len=*),
intent(in) :: filetype
143 character(len=*),
intent(in) :: filename
144 character(len=*),
intent(in) :: pkgname
145 integer(I4B),
intent(in) :: iout
146 character(len=LENPACKAGENAME) :: sc_name, pname
147 character(len=LENMEMPATH) :: mempath
148 character(len=LINELENGTH),
pointer :: cstr
157 this%pnum = this%pnum + 1
158 this%filenames(this%pnum) = filename
159 this%pkgnames(this%pnum) = pkgname
160 this%inunits(this%pnum) = 0
163 if (this%pkgnames(this%pnum) ==
'')
then
165 this%subcomponent_type, &
167 write (pname,
'(a,i0)') trim(this%subcomponent_type)//
'-', this%pnum
169 write (pname,
'(a,i0)') trim(this%subcomponent_type)
171 this%pkgnames(this%pnum) = pname
178 this%pkgnames(this%pnum))
180 this%mempaths(this%pnum) = &
188 this%mempaths(this%pnum) =
''
197 deallocate (this%filenames)
198 deallocate (this%pkgnames)
199 deallocate (this%inunits)
200 deallocate (this%mempaths)
212 character(len=*),
intent(in) :: modeltype
213 character(len=*),
intent(in) :: modelfname
214 character(len=*),
intent(in) :: modelname
215 integer(I4B),
intent(in) :: iout
218 this%modeltype = modeltype
219 this%modelfname = modelfname
220 this%modelname = modelname
238 call mem_allocate(this%inunits, 0,
'INUNITS', this%model_mempath)
251 integer(I4B),
dimension(:),
allocatable :: cunit_idxs, indx
252 character(len=LENPACKAGETYPE) :: ftype
254 logical(LGP) :: found
257 allocate (cunit_idxs(0))
260 do n = 1,
size(ftypes)
266 do m = 1, this%niunit
267 if (this%cunit(m) == ftype)
then
272 if (any(cunit_idxs == m))
then
276 cunit_idxs(
size(cunit_idxs)) = m
285 if (.not. found)
then
286 write (errmsg,
'(a,a,a,a,a)')
'Model package type not supported &
287 &[model=', trim(this%modelname),
', type=', &
295 allocate (this%pkglist(
size(cunit_idxs)))
298 allocate (indx(
size(cunit_idxs)))
299 call qsort(indx, cunit_idxs)
302 do n = 1,
size(cunit_idxs)
303 call this%pkglist(n)%create(this%modeltype, this%modelname, &
304 this%cunit(cunit_idxs(n)))
308 deallocate (cunit_idxs)
316 character(len=*),
intent(in) :: pkgtype
317 character(len=*),
intent(in) :: filename
318 character(len=*),
intent(in) :: pkgname
322 do n = 1,
size(this%pkglist)
323 pkg = this%pkglist(n)
324 if (pkg%pkgtype == pkgtype)
then
325 call this%pkglist(n)%add(this%modelname, this%component_type, &
326 pkgtype, filename, pkgname, this%iout)
344 character(len=LINELENGTH) :: ftype, fname, pname
348 call mem_setptr(ftypes,
'FTYPE', this%input_mempath)
349 call mem_setptr(fnames,
'FNAME', this%input_mempath)
350 call mem_setptr(pnames,
'PNAME', this%input_mempath)
353 call this%create(ftypes)
356 do n = 1,
size(ftypes)
363 call this%add(ftype, fname, pname)
383 do n = 1,
size(this%pkglist)
385 this%pkglist(n)%subcomponent_type, &
386 this%pkglist(n)%pkgtype))
then
390 if (this%pkglist(n)%pnum > 1)
then
391 write (errmsg,
'(a,a,a,a,a)') &
392 'Multiple instances specified for model base package type &
393 &[model=', trim(this%modelname),
', type=', &
394 trim(this%pkglist(n)%pkgtype),
'].'
401 pnum = pnum + this%pkglist(n)%pnum
410 integer(I4B) :: n, m, idx
417 pnum = this%pkgcount()
426 call mem_reallocate(this%inunits, pnum,
'INUNITS', this%model_mempath)
429 do n = 1,
size(this%pkglist)
430 do m = 1, this%pkglist(n)%pnum
434 this%pkgtypes(idx) = trim(this%pkglist(n)%pkgtype)
436 this%pkgnames(idx) = trim(this%pkglist(n)%pkgnames(m))
438 this%mempaths(idx) = trim(this%pkglist(n)%mempaths(m))
440 this%inunits(idx) = this%pkglist(n)%inunits(m)
450 do n = 1,
size(this%pkglist)
451 call this%pkglist(n)%destroy()
453 deallocate (this%pkglist)
454 deallocate (this%cunit)
This module contains simulation constants.
integer(i4b), parameter linelength
maximum length of a standard line
integer(i4b), parameter lencomponentname
maximum length of a component name
integer(i4b), parameter lenmodelname
maximum length of the model name
integer(i4b), parameter lenpackagename
maximum length of the package name
integer(i4b), parameter lenpackagetype
maximum length of a package type (DIS6, SFR6, CSUB6, etc.)
integer(i4b), parameter lenftype
maximum length of a package type (DIS, WEL, OC, etc.)
integer(i4b), parameter lenmempath
maximum length of the memory path
logical function, public idm_integrated(component, subcomponent)
logical function, public idm_multi_package(component, subcomponent)
This module defines variable data types.
character(len=lenmempath) function create_mem_path(component, subcomponent, context)
returns the path to the memory object
This module contains simulation methods.
subroutine, public store_error(msg, terminate)
Store an error message.
integer(i4b) function, public count_errors()
Return number of errors.
subroutine, public store_error_filename(filename, terminate)
Store the erroring file name.
This module contains simulation variables.
character(len=maxcharlen) errmsg
error message string
character(len=linelength) idm_context
integer(i4b) iout
file unit number for simulation output
This module contains the SourceCommonModule.
character(len=lencomponentname) function, public idm_subcomponent_type(component, subcomponent)
component from package or model type
subroutine, public inlen_check(input_name, mf6_name, maxlen, name_type)
store an error for input exceeding internal name length
character(len=lencomponentname) function, public idm_component_type(component)
component from package or model type
character(len=lenpackagename) function, public idm_subcomponent_name(component_type, subcomponent_type, sc_name)
model package subcomponent name
This class is used to store a single deferred-length character string. It was designed to work in an ...