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

This module contains the InputLoadTypeModule. More...

Data Types

type  subpackagelisttype
 type representing package subpackage list More...
type  staticpkgloadtype
 Static loader type. More...
type  staticpkgloadbasetype
 Base abstract type for static input loader. More...
type  dynamicpkgloadtype
 Dynamic loader type. More...
type  dynamicpkgloadbasetype
 Base abstract type for dynamic input loader. More...
interface  load_if
 load interfaces for source static and dynamic types More...
interface  period_load_if
type  modeldynamicpkgstype
 type for storing a dynamic package load list More...

Functions/Subroutines

subroutine subpkg_create (this, component_type, component_name)
 initialize a SubPackageListType object
subroutine subpkg_add (this, pkgtype, component_type, subcomponent_type, filename)
 append one subpackage file instance to the list
subroutine subpkg_names (this, parent_sctype, parent_scname, parent_mempath, modelfname)
 Assign subpackage names and mempaths for IDM-integrated subpackages.
character(len=lenvarname) function build_subpkg_prefix (component_type, component_name, parent_sctype, parent_scname, modelfname)
 Build the subpackage name prefix for the given parent package.
subroutine deduplicate_pkgtypes (pkgtypes, subptypes, nsubptypes)
 Deduplicate pkgtypes into unique entries with counts (run-length encoding).
subroutine subpkg_destroy (this)
 destroy a SubPackageListType object
subroutine static_init (this, mf6_input, component_name, component_input_name, input_name)
 initialize static package loader
subroutine create_subpkg_list (this)
 create the subpackage list
subroutine static_destroy (this)
subroutine dynamic_init (this, mf6_input, component_name, component_input_name, input_name, iperblock, iout)
 initialize dynamic package loader
subroutine dynamic_df (this)
 dynamic package loader define
subroutine dynamic_ad (this)
 dynamic package loader advance
subroutine dynamic_destroy (this)
 dynamic package loader destroy
subroutine dynamicpkgs_init (this, modeltype, modelname, modelfname, nc_fname, ncid, iout)
 model dynamic packages init
subroutine dynamicpkgs_add (this, dynamic_pkg)
 add package to model dynamic packages list
class(dynamicpkgloadbasetype) function, pointer dynamicpkgs_get (this, idx)
 retrieve package from model dynamic packages list
subroutine dynamicpkgs_rp (this)
 read and prepare model dynamic packages
subroutine dynamicpkgs_df (this)
 define model dynamic packages
subroutine dynamicpkgs_ad (this)
 advance model dynamic packages
integer(i4b) function dynamicpkgs_size (this)
 get size of model dynamic packages list
subroutine dynamicpkgs_destroy (this)
 destroy model dynamic packages object
subroutine, public adddynamicmodeltolist (list, model_dynamic)
 add model dynamic packages object to list
class(modeldynamicpkgstype) function, pointer, public getdynamicmodelfromlist (list, idx)
 get model dynamic packages object from list

Variables

type(listtype), public model_inputs

Detailed Description

This module defines types that support generic IDM static and dynamic input loading.

Function/Subroutine Documentation

◆ adddynamicmodeltolist()

subroutine, public inputloadtypemodule::adddynamicmodeltolist ( type(listtype), intent(inout) list,
class(modeldynamicpkgstype), intent(inout), pointer model_dynamic )
Parameters
[in,out]listpackage list

Definition at line 725 of file InputLoadType.f90.

726 type(ListType), intent(inout) :: list !< package list
727 class(ModelDynamicPkgsType), pointer, intent(inout) :: model_dynamic
728 class(*), pointer :: obj
729 obj => model_dynamic
730 call list%Add(obj)
Here is the caller graph for this function:

◆ build_subpkg_prefix()

character(len=lenvarname) function inputloadtypemodule::build_subpkg_prefix ( character(len=*), intent(in) component_type,
character(len=*), intent(in) component_name,
character(len=*), intent(in) parent_sctype,
character(len=*), intent(in) parent_scname,
character(len=*), intent(in) modelfname )
private

For single-instance parents (e.g. NPF), prefix is '<TYPE>-'. For multi-instance parents (e.g. WEL), prefix includes the instance number: '<TYPE><N>-' (e.g. 'WEL1-'). EXG packages return ''.

Definition at line 275 of file InputLoadType.f90.

285 character(len=*), intent(in) :: component_type
286 character(len=*), intent(in) :: component_name
287 character(len=*), intent(in) :: parent_sctype
288 character(len=*), intent(in) :: parent_scname
289 character(len=*), intent(in) :: modelfname
290 character(len=LENVARNAME) :: subpkg_prefix
291 type(CharacterStringType), dimension(:), contiguous, pointer :: pnames, ftypes
292 character(len=LENVARNAME) :: parent_type, parent_ftype, parent_name
293 character(len=LENMEMPATH) :: model_mempath
294 integer(I4B) :: parent_inst, n
295 logical(LGP) :: multi
296
297 subpkg_prefix = ''
298
299 ! EXG (exchange) packages have no model NAM file and don't need a prefix
300 if (component_type == 'EXG') return
301
302 ! resolve definition names to the namefile packages block type name
303 select case (parent_sctype)
304 case ('EVTA', 'RCHA', 'SPCA', 'RIVG', 'CHDG', 'WELG', 'DRNG', 'GHBG')
305 parent_type = parent_sctype(1:3)
306 case default
307 parent_type = parent_sctype
308 end select
309
310 ! build the filetype string used to match FTYPE in the NAM packages block
311 parent_ftype = trim(parent_type)//'6'
312
313 ! determine if multi-package type
314 if (idm_integrated(component_type, parent_type)) then
315 multi = idm_multi_package(component_type, parent_type)
316 else
317 multi = multi_package_type(component_type, parent_type, parent_ftype)
318 end if
319
320 if (multi) then
321 ! identify instance number of this package type in the namefile packages
322 ! block and use to set subpackage prefix
323 model_mempath = create_mem_path(component_name, 'NAM', idm_context)
324 call mem_setptr(pnames, 'PNAME', model_mempath)
325 call mem_setptr(ftypes, 'FTYPE', model_mempath)
326
327 parent_inst = 0
328 do n = 1, size(pnames)
329 if (ftypes(n) == parent_ftype) then
330 parent_inst = parent_inst + 1
331 parent_name = pnames(n)
332 if (parent_name == '') &
333 parent_name = idm_pkg_instance_name(parent_type, parent_inst)
334 if (parent_name == parent_scname) then
335 write (subpkg_prefix, '(a,i0,a)') trim(parent_type), parent_inst, '-'
336 exit
337 end if
338 end if
339 end do
340
341 if (subpkg_prefix == '') then
342 errmsg = &
343 'Internal IDM error: subpackage load cannot identify &
344 &package "'//trim(parent_scname)//'" in model name file &
345 &packages block.'
346 call store_error(errmsg)
347 call store_error_filename(modelfname)
348 end if
349 else
350 ! single-instance parent: prefix is '<TYPE>-', e.g. 'NPF-'
351 write (subpkg_prefix, '(2a)') trim(parent_type), '-'
352 end if
logical function, public idm_integrated(component, subcomponent)
logical function, public idm_multi_package(component, subcomponent)
character(len=lenmempath) function create_mem_path(component, subcomponent, context)
returns the path to the memory object
This module contains the ModelPackageInputModule.
logical(lgp) function, public multi_package_type(mtype_component, ptype_component, pkgtype)
Is the package multi-instance.
This module contains simulation variables.
character(len=maxcharlen) errmsg
error message string
character(len=linelength) idm_context
This module contains the SourceCommonModule.
character(len=lenpackagename) function, public idm_pkg_instance_name(pkg_type, inst)
default name for a multi-package instance
This class is used to store a single deferred-length character string. It was designed to work in an ...
Here is the call graph for this function:
Here is the caller graph for this function:

◆ create_subpkg_list()

subroutine inputloadtypemodule::create_subpkg_list ( class(staticpkgloadtype), intent(inout) this)
private

Definition at line 431 of file InputLoadType.f90.

436 class(StaticPkgLoadType), intent(inout) :: this
437 character(len=16), dimension(:), pointer :: subpkgs
438 type(CharacterStringType), dimension(:), pointer, &
439 contiguous :: fnames
440 character(len=LINELENGTH) :: tag, fname, pkgtype
441 character(len=6) :: c_type, sc_type ! 6 is the max subcomponent length
442 character(len=16) :: subpkg
443 integer(I4B) :: idx, n, m, isize
444
445 ! set pointer to package (idm integrated) subpackage list
446 subpkgs => idm_subpackages(this%mf6_input%component_type, &
447 this%mf6_input%subcomponent_type)
448
449 ! check each subpackage type this package supports
450 do n = 1, size(subpkgs)
451 ! check for input matching this supported subpackage
452 subpkg = subpkgs(n)
453 idx = index(subpkg, '-')
454
455 if (idx > 0) then
456 ! split string in component/subcomponent types
457 c_type = subpkg(1:idx - 1)
458 sc_type = subpkg(idx + 1:len_trim(subpkg))
459
460 if (idm_integrated(c_type, sc_type)) then
461 ! construct FILEIN filename tag
462 pkgtype = trim(sc_type)//'6'
463 tag = trim(pkgtype)//'_FILENAME'
464 call get_isize(tag, this%mf6_input%mempath, isize)
465 if (isize > 0) then
466 ! add all input files of this type to subpackage type list
467 call mem_setptr(fnames, tag, this%mf6_input%mempath)
468 do m = 1, size(fnames)
469 fname = fnames(m)
470 call this%subpkg_list%add(pkgtype, c_type, sc_type, fname)
471 end do
472 end if
473 else
474 errmsg = 'Identified subpackage is not IDM integrated. Remove dfn &
475 &subpackage tagline for package "'//trim(subpkg)//'".'
476 call store_error(errmsg)
477 call store_error_filename(this%input_name)
478 end if
479 end if
480 end do
481
482 ! create subpackage names and use to store mempaths in memory manager
483 call this%subpkg_list%set_names(this%mf6_input%subcomponent_type, &
484 this%mf6_input%subcomponent_name, &
485 this%mf6_input%mempath, &
486 this%component_input_name)
character(len=16) function, dimension(:), pointer, public idm_subpackages(component, subcomponent)
subroutine, public get_isize(name, mem_path, isize)
Get the number of elements for this variable.
Here is the call graph for this function:

◆ deduplicate_pkgtypes()

subroutine inputloadtypemodule::deduplicate_pkgtypes ( character(len=lencomponentname), dimension(:), intent(in) pkgtypes,
character(len=linelength), dimension(:), intent(out), allocatable subptypes,
integer(i4b), dimension(:), intent(out), allocatable nsubptypes )
private

INVARIANT: pkgtypes entries for the same type must be contiguous.

Definition at line 359 of file InputLoadType.f90.

361 character(len=LENCOMPONENTNAME), intent(in) :: pkgtypes(:)
362 character(len=LINELENGTH), allocatable, intent(out) :: subptypes(:)
363 integer(I4B), allocatable, intent(out) :: nsubptypes(:)
364 character(len=LENCOMPONENTNAME) :: prev
365 integer(I4B) :: n, ntype
366
367 allocate (subptypes(0))
368 allocate (nsubptypes(0))
369 prev = ''
370 ntype = 0
371 do n = 1, size(pkgtypes)
372 if (pkgtypes(n) /= prev) then
373 ntype = ntype + 1
374 prev = pkgtypes(n)
375 call expandarray(subptypes)
376 call expandarray(nsubptypes)
377 subptypes(ntype) = prev
378 nsubptypes(ntype) = 1
379 else
380 nsubptypes(ntype) = nsubptypes(ntype) + 1
381 end if
382 end do
Here is the caller graph for this function:

◆ dynamic_ad()

subroutine inputloadtypemodule::dynamic_ad ( class(dynamicpkgloadtype), intent(inout) this)
private

Definition at line 578 of file InputLoadType.f90.

579 class(DynamicPkgLoadType), intent(inout) :: this
580 ! override in derived type

◆ dynamic_destroy()

subroutine inputloadtypemodule::dynamic_destroy ( class(dynamicpkgloadtype), intent(inout) this)
private

Definition at line 586 of file InputLoadType.f90.

590 class(DynamicPkgLoadType), intent(inout) :: this
591
592 ! clean up netcdf variables structure
593 if (associated(this%nc_vars)) then
594 call this%nc_vars%destroy()
595 deallocate (this%nc_vars)
596 nullify (this%nc_vars)
597 end if
598
599 ! deallocate package static and dynamic input context
600 call memorystore_remove(this%mf6_input%component_name, &
601 this%mf6_input%subcomponent_name, &
subroutine, public memorystore_remove(component, subcomponent, context)
Here is the call graph for this function:

◆ dynamic_df()

subroutine inputloadtypemodule::dynamic_df ( class(dynamicpkgloadtype), intent(inout) this)
private

Definition at line 570 of file InputLoadType.f90.

571 class(DynamicPkgLoadType), intent(inout) :: this
572 ! override in derived type

◆ dynamic_init()

subroutine inputloadtypemodule::dynamic_init ( class(dynamicpkgloadtype), intent(inout) this,
type(modflowinputtype), intent(in) mf6_input,
character(len=*), intent(in) component_name,
character(len=*), intent(in) component_input_name,
character(len=*), intent(in) input_name,
integer(i4b), intent(in) iperblock,
integer(i4b), intent(in) iout )
private

Any managed memory pointed to from model/package context must be allocated when dynamic loader is initialized.

Definition at line 505 of file InputLoadType.f90.

507 use simvariablesmodule, only: errmsg
510 class(DynamicPkgLoadType), intent(inout) :: this
511 type(ModflowInputType), intent(in) :: mf6_input
512 character(len=*), intent(in) :: component_name
513 character(len=*), intent(in) :: component_input_name
514 character(len=*), intent(in) :: input_name
515 integer(I4B), intent(in) :: iperblock
516 integer(I4B), intent(in) :: iout
517 type(InputParamDefinitionType), pointer :: idt
518 integer(I4B) :: iparam
519
520 this%mf6_input = mf6_input
521 this%component_name = component_name
522 this%component_input_name = component_input_name
523 this%input_name = input_name
524 this%readasarrays = .false.
525 this%readarraygrid = .false.
526 this%has_keystring = .false.
527 this%iperblock = iperblock
528 this%nparam = 0
529 this%iout = iout
530 nullify (idt)
531
532 ! throw error and exit if not found
533 if (this%iperblock == 0) then
534 write (errmsg, '(a,a)') &
535 'Programming error. (IDM) PERIOD block not found in '&
536 &'dynamic package input block dfns: ', &
537 trim(mf6_input%subcomponent_name)
538 call store_error(errmsg)
539 call store_error_filename(this%input_name)
540 end if
541
542 ! set readasarrays and readarraygrid
543 if (mf6_input%block_dfns(iperblock)%aggregate) then
544 ! no-op
545 else
546 do iparam = 1, size(mf6_input%param_dfns)
547 idt => mf6_input%param_dfns(iparam)
548 if (idt%blockname == 'OPTIONS') then
549 select case (idt%tagname)
550 case ('READASARRAYS')
551 this%readasarrays = .true.
552 case ('READARRAYGRID')
553 this%readarraygrid = .true.
554 case default
555 ! no-op
556 end select
557 end if
558 end do
559 end if
560
561 ! detect keystring packages
562 if (mf6_input%block_dfns(iperblock)%aggregate) then
563 if (is_keystring_period(mf6_input)) this%has_keystring = .true.
564 end if
Input definition module.
Load context for IDM generic dynamic loaders.
logical(lgp) function, public is_keystring_period(mf6_input)
Return .true. if mf6_input's PERIOD block uses keystring dispatch.
integer(i4b) iout
file unit number for simulation output
Input parameter definition. Describes an input parameter.
Here is the call graph for this function:

◆ dynamicpkgs_ad()

subroutine inputloadtypemodule::dynamicpkgs_ad ( class(modeldynamicpkgstype), intent(inout) this)
private

Definition at line 686 of file InputLoadType.f90.

687 class(ModelDynamicPkgsType), intent(inout) :: this
688 class(DynamicPkgLoadBaseType), pointer :: dynamic_pkg
689 integer(I4B) :: n
690 do n = 1, this%pkglist%Count()
691 dynamic_pkg => this%get(n)
692 call dynamic_pkg%ts_advance()
693 end do

◆ dynamicpkgs_add()

subroutine inputloadtypemodule::dynamicpkgs_add ( class(modeldynamicpkgstype), intent(inout) this,
class(dynamicpkgloadbasetype), intent(inout), pointer dynamic_pkg )
private

Definition at line 628 of file InputLoadType.f90.

629 class(ModelDynamicPkgsType), intent(inout) :: this
630 class(DynamicPkgLoadBaseType), pointer, intent(inout) :: dynamic_pkg
631 class(*), pointer :: obj
632 obj => dynamic_pkg
633 call this%pkglist%add(obj)

◆ dynamicpkgs_destroy()

subroutine inputloadtypemodule::dynamicpkgs_destroy ( class(modeldynamicpkgstype), intent(inout) this)
private

Definition at line 708 of file InputLoadType.f90.

709 class(ModelDynamicPkgsType), intent(inout) :: this
710 class(DynamicPkgLoadBaseType), pointer :: dynamic_pkg
711 integer(I4B) :: n
712 ! destroy dynamic loaders
713 do n = 1, this%pkglist%Count()
714 dynamic_pkg => this%get(n)
715 call dynamic_pkg%destroy()
716 deallocate (dynamic_pkg)
717 nullify (dynamic_pkg)
718 end do
719 call this%pkglist%Clear()

◆ dynamicpkgs_df()

subroutine inputloadtypemodule::dynamicpkgs_df ( class(modeldynamicpkgstype), intent(inout) this)
private

Definition at line 673 of file InputLoadType.f90.

674 class(ModelDynamicPkgsType), intent(inout) :: this
675 class(DynamicPkgLoadBaseType), pointer :: dynamic_pkg
676 integer(I4B) :: n
677 do n = 1, this%pkglist%Count()
678 dynamic_pkg => this%get(n)
679 call dynamic_pkg%df()
680 end do

◆ dynamicpkgs_get()

class(dynamicpkgloadbasetype) function, pointer inputloadtypemodule::dynamicpkgs_get ( class(modeldynamicpkgstype), intent(inout) this,
integer(i4b), intent(in) idx )
private

Definition at line 639 of file InputLoadType.f90.

640 class(ModelDynamicPkgsType), intent(inout) :: this
641 integer(I4B), intent(in) :: idx
642 class(DynamicPkgLoadBaseType), pointer :: res
643 class(*), pointer :: obj
644 nullify (res)
645 obj => this%pkglist%GetItem(idx)
646 if (associated(obj)) then
647 select type (obj)
648 class is (dynamicpkgloadbasetype)
649 res => obj
650 end select
651 end if

◆ dynamicpkgs_init()

subroutine inputloadtypemodule::dynamicpkgs_init ( class(modeldynamicpkgstype), intent(inout) this,
character(len=*), intent(in) modeltype,
character(len=*), intent(in) modelname,
character(len=*), intent(in) modelfname,
character(len=*), intent(in) nc_fname,
integer(i4b), intent(in) ncid,
integer(i4b), intent(in) iout )
private

Definition at line 608 of file InputLoadType.f90.

610 class(ModelDynamicPkgsType), intent(inout) :: this
611 character(len=*), intent(in) :: modeltype
612 character(len=*), intent(in) :: modelname
613 character(len=*), intent(in) :: modelfname
614 character(len=*), intent(in) :: nc_fname
615 integer(I4B), intent(in) :: ncid
616 integer(I4B), intent(in) :: iout
617 this%modeltype = modeltype
618 this%modelname = modelname
619 this%modelfname = modelfname
620 this%nc_fname = nc_fname
621 this%ncid = ncid
622 this%iout = iout

◆ dynamicpkgs_rp()

subroutine inputloadtypemodule::dynamicpkgs_rp ( class(modeldynamicpkgstype), intent(inout) this)
private

Definition at line 657 of file InputLoadType.f90.

659 class(ModelDynamicPkgsType), intent(inout) :: this
660 class(DynamicPkgLoadBaseType), pointer :: dynamic_pkg
661 integer(I4B) :: n
662 call idm_log_period_header(this%modelname, this%iout)
663 do n = 1, this%pkglist%Count()
664 dynamic_pkg => this%get(n)
665 call dynamic_pkg%rp()
666 end do
667 call idm_log_period_close(this%iout)
This module contains the Input Data Model Logger Module.
Definition IdmLogger.f90:7
subroutine, public idm_log_period_header(component, iout)
log a dynamic header message
Definition IdmLogger.f90:67
subroutine, public idm_log_period_close(iout)
log the period closing message
Definition IdmLogger.f90:79
Here is the call graph for this function:

◆ dynamicpkgs_size()

integer(i4b) function inputloadtypemodule::dynamicpkgs_size ( class(modeldynamicpkgstype), intent(inout) this)
private

Definition at line 699 of file InputLoadType.f90.

700 class(ModelDynamicPkgsType), intent(inout) :: this
701 integer(I4B) :: size
702 size = this%pkglist%Count()

◆ getdynamicmodelfromlist()

class(modeldynamicpkgstype) function, pointer, public inputloadtypemodule::getdynamicmodelfromlist ( type(listtype), intent(inout) list,
integer(i4b), intent(in) idx )
Parameters
[in,out]listspd list
[in]idxpackage number

Definition at line 736 of file InputLoadType.f90.

737 type(ListType), intent(inout) :: list !< spd list
738 integer(I4B), intent(in) :: idx !< package number
739 class(ModelDynamicPkgsType), pointer :: res
740 class(*), pointer :: obj
741 ! initialize res
742 nullify (res)
743 ! get the object from the list
744 obj => list%GetItem(idx)
745 if (associated(obj)) then
746 select type (obj)
747 class is (modeldynamicpkgstype)
748 res => obj
749 end select
750 end if
Here is the caller graph for this function:

◆ static_destroy()

subroutine inputloadtypemodule::static_destroy ( class(staticpkgloadtype), intent(inout) this)
private

Definition at line 489 of file InputLoadType.f90.

490 class(StaticPkgLoadType), intent(inout) :: this
491 call this%subpkg_list%destroy()
492 if (associated(this%nc_vars)) then
493 call this%nc_vars%destroy()
494 deallocate (this%nc_vars)
495 nullify (this%nc_vars)
496 end if

◆ static_init()

subroutine inputloadtypemodule::static_init ( class(staticpkgloadtype), intent(inout) this,
type(modflowinputtype), intent(in) mf6_input,
character(len=*), intent(in) component_name,
character(len=*), intent(in) component_input_name,
character(len=*), intent(in) input_name )
private

Definition at line 400 of file InputLoadType.f90.

402 class(StaticPkgLoadType), intent(inout) :: this
403 type(ModflowInputType), intent(in) :: mf6_input
404 character(len=*), intent(in) :: component_name
405 character(len=*), intent(in) :: component_input_name
406 character(len=*), intent(in) :: input_name
407 integer(I4B) :: iblock
408
409 this%mf6_input = mf6_input
410 this%component_name = component_name
411 this%component_input_name = component_input_name
412 this%input_name = input_name
413 this%iperblock = 0
414
415 ! create subpackage list
416 call this%subpkg_list%create(this%mf6_input%component_type, &
417 this%mf6_input%component_name)
418
419 ! identify period block definition
420 do iblock = 1, size(mf6_input%block_dfns)
421 if (mf6_input%block_dfns(iblock)%blockname == 'PERIOD') then
422 this%iperblock = iblock
423 exit
424 end if
425 end do

◆ subpkg_add()

subroutine inputloadtypemodule::subpkg_add ( class(subpackagelisttype) this,
character(len=*), intent(in) pkgtype,
character(len=*), intent(in) component_type,
character(len=*), intent(in) subcomponent_type,
character(len=*), intent(in) filename )
private

Definition at line 178 of file InputLoadType.f90.

181 class(SubPackageListType) :: this
182 character(len=*), intent(in) :: pkgtype
183 character(len=*), intent(in) :: component_type
184 character(len=*), intent(in) :: subcomponent_type
185 character(len=*), intent(in) :: filename
186
187 ! reallocate
188 call expandarray(this%pkgtypes)
189 call expandarray(this%component_types)
190 call expandarray(this%subcomponent_types)
191 call expandarray(this%subcomponent_names)
192 call expandarray(this%filenames)
193
194 ! add new package instance
195 this%pnum = this%pnum + 1
196 this%pkgtypes(this%pnum) = pkgtype
197 this%component_types(this%pnum) = component_type
198 this%subcomponent_types(this%pnum) = subcomponent_type
199 this%subcomponent_names(this%pnum) = ''
200 this%filenames(this%pnum) = filename

◆ subpkg_create()

subroutine inputloadtypemodule::subpkg_create ( class(subpackagelisttype) this,
character(len=*), intent(in) component_type,
character(len=*), intent(in) component_name )
private

Definition at line 158 of file InputLoadType.f90.

159 class(SubPackageListType) :: this
160 character(len=*), intent(in) :: component_type
161 character(len=*), intent(in) :: component_name
162
163 ! initialize
164 this%pnum = 0
165 this%component_type = component_type
166 this%component_name = component_name
167
168 ! allocate arrays
169 allocate (this%pkgtypes(0))
170 allocate (this%component_types(0))
171 allocate (this%subcomponent_types(0))
172 allocate (this%subcomponent_names(0))
173 allocate (this%filenames(0))

◆ subpkg_destroy()

subroutine inputloadtypemodule::subpkg_destroy ( class(subpackagelisttype) this)
private

Definition at line 387 of file InputLoadType.f90.

388 class(SubPackageListType) :: this
389 ! deallocate arrays
390 deallocate (this%pkgtypes)
391 deallocate (this%component_types)
392 deallocate (this%subcomponent_types)
393 deallocate (this%subcomponent_names)
394 deallocate (this%filenames)

◆ subpkg_names()

subroutine inputloadtypemodule::subpkg_names ( class(subpackagelisttype) this,
character(len=*), intent(in) parent_sctype,
character(len=*), intent(in) parent_scname,
character(len=*), intent(in) parent_mempath,
character(len=*), intent(in) modelfname )
private

Definition at line 205 of file InputLoadType.f90.

212 class(SubPackageListType) :: this
213 character(len=*), intent(in) :: parent_sctype
214 character(len=*), intent(in) :: parent_scname
215 character(len=*), intent(in) :: parent_mempath
216 character(len=*), intent(in) :: modelfname
217 character(len=LINELENGTH), dimension(:), allocatable :: subptypes
218 integer(I4B), dimension(:), allocatable :: nsubptypes
219 type(CharacterStringType), dimension(:), pointer, contiguous :: mempaths
220 character(len=LINELENGTH), pointer :: input_fname
221 character(len=LENVARNAME) :: mempath_key
222 character(len=LENVARNAME) :: subpkg_prefix
223 character(len=LENMEMPATH) :: mempath
224 integer(I4B) :: subpkg_inst, n, m
225
226 ! nothing to do if no subpackages were added
227 if (size(this%pkgtypes) == 0) return
228
229 ! UTL packages do not themselves have subpackages
230 if (idm_utl_type(this%component_type, parent_sctype)) return
231
232 ! build subpkg_prefix from the parent package identity
233 subpkg_prefix = build_subpkg_prefix(this%component_type, &
234 this%component_name, parent_sctype, &
235 parent_scname, modelfname)
236
237 ! deduplicate pkgtypes into unique list with per-type counts
238 call deduplicate_pkgtypes(this%pkgtypes, subptypes, nsubptypes)
239
240 ! allocate mempath arrays for each subpackage type, create and
241 ! store the memory paths for package side access.
242 do n = 1, size(subptypes)
243 subpkg_inst = 0
244 mempath_key = trim(subptypes(n))//'_MEMPATH'
245 call mem_allocate(mempaths, lenmempath, nsubptypes(n), &
246 mempath_key, parent_mempath)
247 do m = 1, size(this%pkgtypes)
248 if (this%pkgtypes(m) == subptypes(n)) then
249 subpkg_inst = subpkg_inst + 1
250 ! set the subpackage name
251 write (this%subcomponent_names(m), '(a,i0)') &
252 trim(subpkg_prefix)//trim(this%subcomponent_types(m)), subpkg_inst
253 ! create and set mempath
254 mempath = create_mem_path(this%component_name, &
255 this%subcomponent_names(m), &
257 mempaths(subpkg_inst) = mempath
258 ! create and set INPUT_FNAME string in each new memory path.
259 call mem_allocate(input_fname, linelength, 'INPUT_FNAME', mempath)
260 input_fname = trim(this%filenames(m))
261 end if
262 end do
263 end do
264
265 deallocate (subptypes)
266 deallocate (nsubptypes)
logical(lgp) function, public idm_utl_type(component, subcomponent)
is utility type
Here is the call graph for this function:

Variable Documentation

◆ model_inputs

type(listtype), public inputloadtypemodule::model_inputs

Definition at line 152 of file InputLoadType.f90.

152 type(ListType) :: model_inputs