28 integer(I4B) :: nr_solutions
29 integer(I4B),
dimension(:),
allocatable :: solution_ids
57 character(len=*) :: sim_mode
59 integer(I4B) :: nr_sol
61 nr_sol = this%count_nr_solutions()
62 allocate (this%virtual_solutions(nr_sol))
63 allocate (this%solution_ids(nr_sol))
78 call this%router%initialize()
89 integer(I4B) :: i, im, ix, ihm, ihx
94 integer(I4B) :: model_id, exg_id
95 type(
stlvecint) :: model_ids, exchange_ids
99 this%nr_solutions = this%nr_solutions + 1
100 virt_sol => this%virtual_solutions(this%nr_solutions)
102 call model_ids%init()
103 call exchange_ids%init()
106 this%solution_ids(this%nr_solutions) = num_sol%id
107 virt_sol%solution_id = num_sol%id
108 virt_sol%numerical_solution => num_sol
111 do im = 1, num_sol%modellist%Count()
116 if (num_mod%id == vdc%id)
then
122 call model_ids%push_back(num_mod%id)
127 do ix = 1, num_sol%exchangelist%Count()
129 if (.not.
associated(exg)) cycle
133 if (exg%id == vdc%id)
then
138 call exchange_ids%push_back_unique(exg%id)
142 do ix = 1, num_sol%exchangelist%Count()
144 if (.not.
associated(conn)) cycle
148 do ihm = 1, conn%halo_models%size
149 model_id = conn%halo_models%at(ihm)
150 call model_ids%push_back_unique(model_id)
152 do ihx = 1, conn%halo_exchanges%size
153 exg_id = conn%halo_exchanges%at(ihx)
154 call exchange_ids%push_back_unique(exg_id)
158 allocate (virt_sol%models(model_ids%size))
159 allocate (virt_sol%exchanges(exchange_ids%size))
160 allocate (virt_sol%interface_map)
161 call virt_sol%interface_map%init(model_ids%size, exchange_ids%size)
164 do i = 1, model_ids%size
166 virt_sol%models(i)%ptr => vdc
168 do i = 1, exchange_ids%size
170 virt_sol%exchanges(i)%ptr => vdc
174 call model_ids%destroy()
175 call exchange_ids%destroy()
184 integer(I4B) :: im, ic, ix
190 call halo_model_ids%init()
195 do im = 1, conn%halo_models%size
196 call halo_model_ids%push_back_unique(conn%halo_models%at(im))
203 if (.not. vm%is_local)
then
204 if (.not. halo_model_ids%contains(vm%id))
then
205 vm%is_active = .false.
214 if (.not. ve%is_local)
then
215 if (.not. halo_model_ids%contains(ve%v_model1%id) .or. &
216 .not. halo_model_ids%contains(ve%v_model2%id))
then
217 ve%is_active = .false.
222 this%router%halo_activated = .true.
224 call halo_model_ids%destroy()
238 integer(I4B) :: ivm, isol, iexg, m_idx
239 integer(I4B) :: outunit
240 character(len=128) :: monitor_file
248 do isol = 1, this%nr_solutions
249 virt_sol => this%virtual_solutions(isol)
251 do iexg = 1, num_sol%exchangelist%Count()
253 if (.not.
associated(conn)) cycle
256 call virt_sol%interface_map%add(conn%interface_map)
263 write (monitor_file,
'(a,i0,a)')
"iface.p",
proc_id,
".log"
264 open (unit=outunit, file=monitor_file)
265 do isol = 1, this%nr_solutions
266 write (outunit,
'(a,i0,/)')
"interface map for solution ", &
267 this%virtual_solutions(isol)%solution_id
268 virt_sol => this%virtual_solutions(isol)
269 call virt_sol%interface_map%print_interface(outunit)
275 do isol = 1, this%nr_solutions
276 virt_sol => this%virtual_solutions(isol)
277 do ivm = 1,
size(virt_sol%models)
278 vdc => virt_sol%models(ivm)%ptr
279 if (.not. vdc%is_local .and. vdc%is_active)
then
280 m_idx =
ifind(virt_sol%interface_map%model_ids, vdc%id)
281 if (m_idx == -1) cycle
283 nmap => virt_sol%interface_map%get_node_map(vdc%id)
284 cmap => virt_sol%interface_map%get_connection_map(vdc%id)
297 integer(I4B) :: stage
299 call this%prepare_all(stage)
300 call this%link_all(stage)
301 call this%router%route_all(stage)
307 integer(I4B) :: stage
316 if (.not. vdc%is_active) cycle
317 call vdc%prepare_stage(stage)
321 if (.not. vdc%is_active) cycle
322 call vdc%prepare_stage(stage)
329 integer(I4B) :: stage
337 call vdc%link_items(stage)
341 call vdc%link_items(stage)
351 integer(I4B) :: id_sln
352 integer(I4B) :: stage
354 integer(I4B) :: sol_idx
356 sol_idx =
ifind(this%solution_ids, id_sln)
357 call this%prepare_sln(this%virtual_solutions(sol_idx), stage)
358 call this%link_sln(this%virtual_solutions(sol_idx), stage)
359 call this%router%route_sln(this%virtual_solutions(sol_idx), stage)
369 integer(I4B) :: stage
374 do i = 1,
size(virtual_sol%models)
375 vdc => virtual_sol%models(i)%ptr
376 call vdc%prepare_stage(stage)
379 do i = 1,
size(virtual_sol%exchanges)
380 vdc => virtual_sol%exchanges(i)%ptr
381 call vdc%prepare_stage(stage)
391 integer(I4B) :: stage
396 do i = 1,
size(virtual_sol%models)
397 vdc => virtual_sol%models(i)%ptr
398 call vdc%link_items(stage)
401 do i = 1,
size(virtual_sol%exchanges)
402 vdc => virtual_sol%exchanges(i)%ptr
403 call vdc%link_items(stage)
414 integer(I4B) :: count
417 class(*),
pointer :: sol
449 do i = 1, this%nr_solutions
450 deallocate (this%virtual_solutions(i)%models)
451 deallocate (this%virtual_solutions(i)%exchanges)
452 call this%virtual_solutions(i)%interface_map%destroy()
453 deallocate (this%virtual_solutions(i)%interface_map)
455 deallocate (this%virtual_solutions)
457 call this%router%destroy()
458 deallocate (this%router)
class(disconnexchangetype) function, pointer, public getdisconnexchangefromlist(list, idx)
This module defines variable data types.
type(listtype), public baseconnectionlist
type(listtype), public basesolutionlist
class(numericalexchangetype) function, pointer, public getnumericalexchangefromlist(list, idx)
Retrieve a specific numerical exchange from a list.
class(numericalmodeltype) function, pointer, public getnumericalmodelfromlist(list, idx)
class(numericalsolutiontype) function, pointer, public castasnumericalsolutionclass(obj)
Cast a object as a Numerical Solution.
class(routerbasetype) function, pointer, public create_router(sim_mode, nr_sols)
@ Brief Create the proper router, depends on simulation mode (parallel or sequential) and type of bui...
This module contains simulation variables.
class(spatialmodelconnectiontype) function, pointer, public get_smc_from_list(list, idx)
Get the connection from a list.
subroutine init(this, capacity)
integer(i4b), parameter, public map_conn_type
integer(i4b), parameter, public map_node_type
class(virtualdatacontainertype) function, pointer, public get_vdc_from_list(list, idx)
type(listtype), public virtual_model_list
type(listtype), public virtual_exchange_list
subroutine vds_compress_halo(this)
Compress the halo for all solutions. This will activate the mapping tables in the virtual data items ...
subroutine vds_create(this, sim_mode)
Initialize the virtual data store.
subroutine vds_synchronize_sln(this, id_sln, stage)
Synchronize one particular solution for this stage.
subroutine vds_init(this)
Initialize internal components.
subroutine vds_synchronize(this, stage)
Synchronize the full virtual data store for this stage.
subroutine prepare_sln(this, virtual_sol, stage)
Force the virtual data containers (models, exchanges, etc.) to schedule their virtual data.
subroutine link_all(this, stage)
subroutine link_sln(this, virtual_sol, stage)
Connect virtual memory items to their.
subroutine prepare_all(this, stage)
integer(i4b) function count_nr_solutions(this)
Returns the number of Numerical Solutions.
subroutine vds_add_solution(this, num_sol)
Add the models and exchanges from the passed solution to the virtual data structure....
subroutine vds_activate_halo(this)
Activates models and exchanges in the halo, i.e. the ones that have an actual chance of being used.
class(virtualexchangetype) function, pointer, public get_virtual_exchange_from_list(list, idx)
class(virtualexchangetype) function, pointer, public get_virtual_exchange(exg_id)
Returns a virtual exchange with the specified id.
class(virtualmodeltype) function, pointer, public get_virtual_model_from_list(model_list, idx)
Exchange based on connection between discretizations of DisBaseType. The data specifies the connectio...
Class to manage spatial connection of a model to one or more models of the same type....
Container (list) of virtual data items.
The Virtual Exchange is based on two Virtual Models and is therefore not always strictly local or rem...
This bundles all virtual data for a particular solution.