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

Data Types

type  interfacemaptype

Functions/Subroutines

subroutine init (this, nr_models, nr_exchanges)
subroutine add (this, map_to_add)
 @ Adds a map, either by extending the existing map for a certain model or exchange, or by assigning the map to an empty slot.
type(indexmaptype) function, pointer get_node_map (this, model_id)
type(indexmaptype) function, pointer get_connection_map (this, model_id)
subroutine print_interface (this, outunit)
 Dumps interface data to the screen.
subroutine destroy (this)

Function/Subroutine Documentation

◆ add()

subroutine interfacemapmodule::add ( class(interfacemaptype) this,
class(interfacemaptype) map_to_add )
private

The map to which is added, should be properly

Definition at line 63 of file InterfaceMap.f90.

64 class(InterfaceMapType) :: this
65 class(InterfaceMapType) :: map_to_add
66 ! local
67 integer(I4B) :: im, ie
68 integer(I4B) :: m_id, m_index
69 integer(I4B) :: e_id, e_index
70
71 ! add models
72 do im = 1, map_to_add%nr_models
73 m_id = map_to_add%model_ids(im)
74 m_index = ifind(this%model_ids, m_id)
75 if (m_index > 0) then
76 ! extend existing index map
77 call this%node_maps(m_index)%add(map_to_add%node_maps(im))
78 call this%conn_maps(m_index)%add(map_to_add%conn_maps(im))
79 else
80 ! place in first empty spot
81 m_index = ifind(this%model_ids, -1)
82 this%model_ids(m_index) = m_id
83 this%model_names(m_index) = map_to_add%model_names(im)
84 call this%node_maps(m_index)%copy(map_to_add%node_maps(im))
85 call this%conn_maps(m_index)%copy(map_to_add%conn_maps(im))
86 end if
87 end do
88
89 ! add exchanges
90 do ie = 1, map_to_add%nr_exchanges
91 e_id = map_to_add%exchange_ids(ie)
92 e_index = ifind(this%exchange_ids, e_id)
93 if (e_index > 0) then
94 ! extend existing index map
95 call this%exchange_maps(e_index)%add(map_to_add%exchange_maps(ie))
96 else
97 ! place in first empty spot
98 e_index = ifind(this%exchange_ids, -1)
99 this%exchange_ids(e_index) = e_id
100 this%exchange_names(e_index) = map_to_add%exchange_names(ie)
101 call this%exchange_maps(e_index)%copy(map_to_add%exchange_maps(ie))
102 end if
103 end do
104

◆ destroy()

subroutine interfacemapmodule::destroy ( class(interfacemaptype) this)
private

Definition at line 180 of file InterfaceMap.f90.

181 class(InterfaceMapType) :: this
182 ! local
183 integer(I4B) :: i
184
185 do i = 1, this%nr_models
186 if (this%model_ids(i) == -1) cycle
187 deallocate (this%node_maps(i)%src_idx)
188 deallocate (this%node_maps(i)%tgt_idx)
189 deallocate (this%conn_maps(i)%src_idx)
190 deallocate (this%conn_maps(i)%tgt_idx)
191 end do
192 deallocate (this%node_maps)
193 deallocate (this%conn_maps)
194
195 do i = 1, this%nr_exchanges
196 if (this%exchange_ids(i) == -1) cycle
197 deallocate (this%exchange_maps(i)%src_idx)
198 deallocate (this%exchange_maps(i)%tgt_idx)
199 deallocate (this%exchange_maps(i)%sign)
200 end do
201 deallocate (this%exchange_maps)
202
203 deallocate (this%model_ids)
204 deallocate (this%model_names)
205 deallocate (this%exchange_ids)
206 deallocate (this%exchange_names)
207
Here is the caller graph for this function:

◆ get_connection_map()

type(indexmaptype) function, pointer interfacemapmodule::get_connection_map ( class(interfacemaptype) this,
integer(i4b) model_id )
private

Definition at line 125 of file InterfaceMap.f90.

126 class(InterfaceMapType) :: this
127 integer(I4B) :: model_id
128 type(IndexMapType), pointer :: connection_map
129 ! local
130 integer(I4B) :: m_idx
131
132 connection_map => null()
133 m_idx = ifind(this%model_ids, model_id)
134 if (m_idx > 0) then
135 connection_map => this%conn_maps(m_idx)
136 end if
137

◆ get_node_map()

type(indexmaptype) function, pointer interfacemapmodule::get_node_map ( class(interfacemaptype) this,
integer(i4b) model_id )
private

Definition at line 107 of file InterfaceMap.f90.

108 use simmodule, only: ustop
109 class(InterfaceMapType) :: this
110 integer(I4B) :: model_id
111 type(IndexMapType), pointer :: node_map
112 ! local
113 integer(I4B) :: m_idx
114
115 node_map => null()
116 m_idx = ifind(this%model_ids, model_id)
117 if (m_idx > 0) then
118 node_map => this%node_maps(m_idx)
119 else
120 call ustop("Internal error. Can't find node map in interface")
121 end if
122
This module contains simulation methods.
Definition Sim.f90:10
subroutine, public ustop(stopmess, ioutlocal)
Stop the simulation.
Definition Sim.f90:317
Here is the call graph for this function:

◆ init()

subroutine interfacemapmodule::init ( class(interfacemaptype) this,
integer(i4b) nr_models,
integer(i4b) nr_exchanges )

Definition at line 34 of file InterfaceMap.f90.

35 class(InterfaceMapType) :: this
36 integer(I4B) :: nr_models
37 integer(I4B) :: nr_exchanges
38
39 this%nr_models = nr_models
40 this%nr_exchanges = nr_exchanges
41
42 allocate (this%model_ids(nr_models))
43 allocate (this%model_names(nr_models))
44 allocate (this%exchange_ids(nr_exchanges))
45 allocate (this%exchange_names(nr_exchanges))
46
47 allocate (this%node_maps(nr_models))
48 allocate (this%conn_maps(nr_models))
49 allocate (this%exchange_maps(nr_exchanges))
50
51 ! model id == -1 when not set
52 this%model_ids = -1
53 this%exchange_ids = -1
54

◆ print_interface()

subroutine interfacemapmodule::print_interface ( class(interfacemaptype) this,
integer(i4b) outunit )
private

Definition at line 142 of file InterfaceMap.f90.

143 class(InterfaceMapType) :: this
144 integer(I4B) :: outunit
145 ! local
146 integer(I4B) :: i, n
147
148 write (outunit, '(a,i0)') "nr. models: ", this%nr_models
149 write (outunit, '(a,i0)') "nr. exchanges: ", this%nr_exchanges
150 do i = 1, this%nr_models
151 if (this%model_ids(i) == -1) cycle
152 write (outunit, '(3a,i0,a)') "model: ", trim(this%model_names(i)), &
153 "[", this%model_ids(i), "]"
154 write (outunit, *) "node map:"
155 do n = 1, size(this%node_maps(i)%src_idx)
156 write (outunit, '(i7,a,i7)') this%node_maps(i)%src_idx(n), &
157 " ", this%node_maps(i)%tgt_idx(n)
158 end do
159 write (outunit, *) "connection map:"
160 do n = 1, size(this%conn_maps(i)%src_idx)
161 write (outunit, '(i7,a,i7)') this%conn_maps(i)%src_idx(n), &
162 " ", this%conn_maps(i)%tgt_idx(n)
163 end do
164 end do
165
166 do i = 1, this%nr_exchanges
167 if (this%exchange_ids(i) == -1) cycle
168 write (outunit, '(3a,i0,a)') "exchange: ", trim(this%exchange_names(i)), &
169 "[", this%exchange_ids(i), "]"
170 write (outunit, *) "exchange map:"
171 do n = 1, size(this%exchange_maps(i)%src_idx)
172 write (outunit, '(i7,a,i7,a,i7)') this%exchange_maps(i)%src_idx(n), &
173 " ", this%exchange_maps(i)%tgt_idx(n), &
174 " ", this%exchange_maps(i)%sign(n)
175 end do
176 end do
177