31 integer,
parameter,
public :: &
32 COUPLINGS_UNDEFINED = 0, &
44 type(namespace_t),
public :: namespace
46 type(integer_list_t),
public :: supported_interactions_as_partner
49 type(quantity_t),
public :: quantities(MAX_QUANTITIES)
56 procedure(interaction_partner_init_interaction_as_partner),
deferred :: init_interaction_as_partner
58 procedure(interaction_partner_copy_quantities_to_interaction),
deferred :: copy_quantities_to_interaction
67 class(interaction_partner_t),
intent(in) :: partner
68 class(interaction_surrogate_t),
intent(inout) :: interaction
75 class(interaction_partner_t),
intent(inout) :: partner
76 class(interaction_surrogate_t),
intent(inout) :: interaction
110 class(interaction_partner_t),
intent(inout) :: this
111 integer,
intent(in) :: iq
115 write(
message(1),
'(a,a,a,a,a)')
'Interation partner "', trim(this%namespace%get()), &
116 '"does not know how to update quantity"', trim(
quantity_label(iq)),
'".'
132 integer,
intent(in) :: quantities(:)
134 logical,
intent(in) :: retardation_allowed
139 do iq = 1,
size(quantities)
141 q_id = quantities(iq)
142 quantity => this%quantities(q_id)
145 if (quantity%iteration >= requested_iteration .or. .not. quantity%updated_on_demand) cycle
147 if (quantity%always_available)
then
150 quantity%iteration = requested_iteration
153 quantity%iteration,
"set"))
154 call this%update_quantity(q_id)
156 else if (quantity%iteration + 1 <= requested_iteration .or. &
157 (retardation_allowed .and. quantity%iteration + 1 > requested_iteration))
then
160 quantity%iteration = quantity%iteration + 1
163 quantity%iteration,
"set"))
164 call this%update_quantity(q_id)
179 class(interaction_partner_t),
intent(inout) :: this
180 integer,
intent(in) :: couplings(:)
183 integer,
allocatable :: relevant_couplings(:)
184 integer :: ahead, on_time
189 relevant_couplings = pack(couplings, .not. this%quantities(couplings)%always_available)
192 on_time = count(this%quantities(relevant_couplings)%iteration == requested_iteration)
193 ahead = count(this%quantities(relevant_couplings)%iteration > requested_iteration)
196 if (on_time > 0 .and. ahead > 0)
then
197 status = couplings_undefined
198 else if (on_time + ahead <
size(relevant_couplings))
then
200 else if (on_time ==
size(relevant_couplings))
then
202 else if (ahead ==
size(relevant_couplings))
then
218 call this%add_ptr(partner)
232 select type (ptr => this%get_next_ptr())
This module defines classes and functions for interaction partners.
integer, parameter, public couplings_on_time
subroutine interaction_partner_update_quantity(this, iq)
Method to be overriden by interaction partners that have quantities that can be updated on demand.
integer function interaction_partner_check_couplings_status(this, couplings, requested_iteration)
Check the status of some couplings.
class(interaction_partner_t) function, pointer partner_iterator_get_next(this)
get next partner from the list
subroutine partner_list_add_node(this, partner)
add a partner to the list
integer, parameter, public couplings_behind_in_time
subroutine interaction_partner_update_on_demand_quantities(this, quantities, requested_iteration, retardation_allowed)
Given a list of quantities, update the ones that can be update on demand.
integer, parameter, public couplings_ahead_in_time
This module implements fully polymorphic linked lists, and some specializations thereof.
character(len=256), dimension(max_lines), public message
to be output by fatal, warning
subroutine, public messages_fatal(no_lines, only_root_writes, namespace)
This module implements the multisystem debug functionality.
subroutine, public multisystem_debug_write_marker(system_namespace, event)
This module defines the quantity_t class and the IDs for quantities, which can be exposed by a system...
character(len=17), dimension(max_quantities), parameter, public quantity_label
abstract class for general interaction partners
iterator for the list of partners
surrogate interaction class to avoid circular dependencies between modules.
This class implements the iteration counter used by the multisystem algorithms. As any iteration coun...
This class implements an iterator for the polymorphic linked list.
This class implements a linked list of unlimited polymorphic values.
events marking an iteration update
Systems (system_t) can expose quantities that can be used to calculate interactions with other system...