MODFLOW 6 version 6.9.0.dev0
USGS Modular Hydrologic Model
Loading...
Searching...
No Matches
BaseExchange.f90
Go to the documentation of this file.
2
3 use kindmodule, only: dp, i4b, lgp
5 use listmodule, only: listtype
7
8 implicit none
9
10 private
13
14 type, abstract :: baseexchangetype
15 character(len=7) :: typename !< name of the type (e.g., 'GWF-GWF')
16 character(len=LENEXCHANGENAME) :: name !< the name of this exchange
17 character(len=LENMEMPATH) :: memorypath !< the location in the memory manager where the variables are stored
18 character(len=LENMEMPATH) :: input_mempath
19 integer(I4B) :: id
20
21 contains
22
23 procedure(exg_df), deferred :: exg_df
24 procedure(exg_ar), deferred :: exg_ar
25 procedure :: exg_rp
26 procedure :: exg_dt
27 procedure :: exg_ot
28 procedure :: exg_fp
29 procedure :: exg_da
30 procedure :: exg_ad
31 procedure :: connects_model
32 end type baseexchangetype
33
34 abstract interface
35
36 subroutine exg_df(this)
37 import baseexchangetype
38 class(baseexchangetype) :: this
39 end subroutine
40
41 subroutine exg_ar(this)
42 import baseexchangetype
43 class(baseexchangetype) :: this
44 end subroutine
45
46 end interface
47
48contains
49
50 !> @brief Read and prepare
51 subroutine exg_rp(this)
52 class(baseexchangetype) :: this
53 end subroutine exg_rp
54
55 !> @brief Calculate time step length
56 subroutine exg_dt(this)
57 class(baseexchangetype) :: this
58 end subroutine exg_dt
59
60 !> @brief Run output routines
61 subroutine exg_ot(this)
62 class(baseexchangetype) :: this
63 end subroutine exg_ot
64
65 !> @brief Final processing
66 subroutine exg_fp(this)
67 class(baseexchangetype) :: this
68 end subroutine exg_fp
69
70 !> @brief Deallocate memory
71 subroutine exg_da(this)
72 class(baseexchangetype) :: this
73 end subroutine exg_da
74
75 !> @brief Advance
76 subroutine exg_ad(this)
77 class(baseexchangetype) :: this
78 end subroutine exg_ad
79
80 !> @brief Should return true when the exchange should be added to the
81 !! solution where the model resides
82 !<
83 function connects_model(this, model) result(is_connected)
84 ! dummy
85 class(baseexchangetype) :: this !< the instance of the exchange
86 class(basemodeltype), pointer, intent(in) :: model !< the model to which the exchange might hold a connection
87 ! return
88 logical(LGP) :: is_connected !< true, when connected
89 is_connected = .false.
90 end function
91
92 !> @brief Cast the object passed in as BaseExchangeType and return it
93 function castasbaseexchangeclass(obj) result(res)
94 ! dummy
95 class(*), pointer, intent(inout) :: obj
96 ! return
97 class(baseexchangetype), pointer :: res
98
99 res => null()
100 if (.not. associated(obj)) return
101
102 select type (obj)
103 class is (baseexchangetype)
104 res => obj
105 end select
106 end function castasbaseexchangeclass
107
108 !> @brief Add the exchange object (BaseExchangeType) to a list
109 subroutine addbaseexchangetolist(list, exchange)
110 ! dummy
111 type(listtype), intent(inout) :: list
112 class(baseexchangetype), pointer, intent(inout) :: exchange
113 ! local
114 class(*), pointer :: obj
115
116 obj => exchange
117 call list%Add(obj)
118 end subroutine addbaseexchangetolist
119
120 !> @brief Retrieve a specific BaseExchangeType object from a list
121 function getbaseexchangefromlist(list, idx) result(res)
122 ! dummy
123 type(listtype), intent(inout) :: list
124 integer(I4B), intent(in) :: idx
125 class(baseexchangetype), pointer :: res
126 ! local
127 class(*), pointer :: obj
128
129 obj => list%GetItem(idx)
130 res => castasbaseexchangeclass(obj)
131 end function getbaseexchangefromlist
132
133end module baseexchangemodule
subroutine exg_fp(this)
Final processing.
subroutine exg_da(this)
Deallocate memory.
subroutine exg_rp(this)
Read and prepare.
class(baseexchangetype) function, pointer, private castasbaseexchangeclass(obj)
Cast the object passed in as BaseExchangeType and return it.
logical(lgp) function connects_model(this, model)
Should return true when the exchange should be added to the solution where the model resides.
subroutine, public addbaseexchangetolist(list, exchange)
Add the exchange object (BaseExchangeType) to a list.
subroutine exg_ot(this)
Run output routines.
subroutine exg_dt(this)
Calculate time step length.
class(baseexchangetype) function, pointer, public getbaseexchangefromlist(list, idx)
Retrieve a specific BaseExchangeType object from a list.
subroutine exg_ad(this)
Advance.
This module contains simulation constants.
Definition Constants.f90:9
integer(i4b), parameter lenexchangename
maximum length of the exchange name
Definition Constants.f90:24
integer(i4b), parameter lenmempath
maximum length of the memory path
Definition Constants.f90:27
This module defines variable data types.
Definition kind.f90:8
Highest level model type. All models extend this parent type.
Definition BaseModel.f90:16
A generic heterogeneous doubly-linked list.
Definition List.f90:14