31 character(len=LENPACKAGETYPE) :: pkgtype
33 character(len=LENCOMPONENTNAME) :: subcomponent_type
35 character(len=LINELENGTH),
dimension(:),
allocatable :: filenames
36 character(len=LENPACKAGENAME),
dimension(:),
allocatable :: pkgnames
37 character(len=LENMEMPATH),
dimension(:),
allocatable :: mempaths
38 integer(I4B),
dimension(:),
allocatable :: inunits
55 character(len=LENPACKAGETYPE) :: modeltype
56 character(len=LINELENGTH) :: modelfname
57 character(len=LENMODELNAME) :: modelname
59 character(len=LENCOMPONENTNAME) :: component_type
61 character(len=LENMEMPATH) :: input_mempath
62 character(len=LENMEMPATH) :: model_mempath
65 pointer :: pkgtypes => null()
67 pointer :: pkgnames => null()
69 pointer :: mempaths => null()
70 integer(I4B),
dimension(:),
contiguous, &
71 pointer :: inunits => null()
75 integer(I4B) :: niunit
76 character(len=LENPACKAGETYPE),
dimension(:),
allocatable :: cunit
97 character(len=LENCOMPONENTNAME),
intent(in) :: mtype_component
98 character(len=LENCOMPONENTNAME),
intent(in) :: ptype_component
99 character(len=LENFTYPE),
intent(in) :: pkgtype
100 logical(LGP) :: multi_pkg
113 character(len=*),
intent(in) :: ctype
130 character(len=*),
intent(in) :: modeltype
131 character(len=*),
intent(in) :: modelname
132 character(len=*),
intent(in) :: pkgtype
135 this%pkgtype = pkgtype
140 allocate (this%filenames(0))
141 allocate (this%pkgnames(0))
142 allocate (this%mempaths(0))
143 allocate (this%inunits(0))
148 subroutine pkgtype_add(this, modelname, mtype_component, filetype, &
149 filename, pkgname, iout)
156 character(len=*),
intent(in) :: modelname
157 character(len=*),
intent(in) :: mtype_component
158 character(len=*),
intent(in) :: filetype
159 character(len=*),
intent(in) :: filename
160 character(len=*),
intent(in) :: pkgname
161 integer(I4B),
intent(in) :: iout
162 character(len=LENPACKAGENAME) :: sc_name, pname
163 character(len=LENMEMPATH) :: mempath
164 character(len=LINELENGTH),
pointer :: cstr
173 this%pnum = this%pnum + 1
174 this%filenames(this%pnum) = filename
175 this%pkgnames(this%pnum) = pkgname
176 this%inunits(this%pnum) = 0
179 if (this%pkgnames(this%pnum) ==
'')
then
181 this%subcomponent_type, &
186 write (pname,
'(a)') trim(this%subcomponent_type)
188 this%pkgnames(this%pnum) = pname
195 this%pkgnames(this%pnum))
197 this%mempaths(this%pnum) = &
205 this%mempaths(this%pnum) =
''
214 deallocate (this%filenames)
215 deallocate (this%pkgnames)
216 deallocate (this%inunits)
217 deallocate (this%mempaths)
229 character(len=*),
intent(in) :: modeltype
230 character(len=*),
intent(in) :: modelfname
231 character(len=*),
intent(in) :: modelname
232 integer(I4B),
intent(in) :: iout
235 this%modeltype = modeltype
236 this%modelfname = modelfname
237 this%modelname = modelname
244 write (errmsg,
'(3a)')
'Models block model type "', trim(modeltype), &
264 call mem_allocate(this%inunits, 0,
'INUNITS', this%model_mempath)
277 integer(I4B),
dimension(:),
allocatable :: cunit_idxs, indx
278 character(len=LENPACKAGETYPE) :: ftype
280 logical(LGP) :: found
283 allocate (cunit_idxs(0))
286 do n = 1,
size(ftypes)
292 do m = 1, this%niunit
293 if (this%cunit(m) == ftype)
then
298 if (any(cunit_idxs == m))
then
302 cunit_idxs(
size(cunit_idxs)) = m
311 if (.not. found)
then
312 write (errmsg,
'(a,a,a,a,a)')
'Model package type not supported &
313 &[model=', trim(this%modelname),
', type=', &
321 allocate (this%pkglist(
size(cunit_idxs)))
324 allocate (indx(
size(cunit_idxs)))
325 call qsort(indx, cunit_idxs)
328 do n = 1,
size(cunit_idxs)
329 call this%pkglist(n)%create(this%modeltype, this%modelname, &
330 this%cunit(cunit_idxs(n)))
334 deallocate (cunit_idxs)
342 character(len=*),
intent(in) :: pkgtype
343 character(len=*),
intent(in) :: filename
344 character(len=*),
intent(in) :: pkgname
348 do n = 1,
size(this%pkglist)
349 pkg = this%pkglist(n)
350 if (pkg%pkgtype == pkgtype)
then
351 call this%pkglist(n)%add(this%modelname, this%component_type, &
352 pkgtype, filename, pkgname, this%iout)
370 character(len=LINELENGTH) :: ftype, fname, pname
374 call mem_setptr(ftypes,
'FTYPE', this%input_mempath)
375 call mem_setptr(fnames,
'FNAME', this%input_mempath)
376 call mem_setptr(pnames,
'PNAME', this%input_mempath)
379 call this%create(ftypes)
382 do n = 1,
size(ftypes)
389 call this%add(ftype, fname, pname)
409 do n = 1,
size(this%pkglist)
411 this%pkglist(n)%subcomponent_type, &
412 this%pkglist(n)%pkgtype))
then
416 if (this%pkglist(n)%pnum > 1)
then
417 write (errmsg,
'(a,a,a,a,a)') &
418 'Multiple instances specified for model base package type &
419 &[model=', trim(this%modelname),
', type=', &
420 trim(this%pkglist(n)%pkgtype),
'].'
427 pnum = pnum + this%pkglist(n)%pnum
436 integer(I4B) :: n, m, idx
443 pnum = this%pkgcount()
452 call mem_reallocate(this%inunits, pnum,
'INUNITS', this%model_mempath)
455 do n = 1,
size(this%pkglist)
456 do m = 1, this%pkglist(n)%pnum
460 this%pkgtypes(idx) = trim(this%pkglist(n)%pkgtype)
462 this%pkgnames(idx) = trim(this%pkglist(n)%pkgnames(m))
464 this%mempaths(idx) = trim(this%pkglist(n)%mempaths(m))
466 this%inunits(idx) = this%pkglist(n)%inunits(m)
476 do n = 1,
size(this%pkglist)
477 call this%pkglist(n)%destroy()
479 deallocate (this%pkglist)
480 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
character(len=linelength) simfile
simulation name file
This module contains the SourceCommonModule.
character(len=lencomponentname) function, public idm_subcomponent_type(component, subcomponent)
component from package or model type
character(len=lenpackagename) function, public idm_pkg_instance_name(pkg_type, inst)
default name for a multi-package instance
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 ...