31 integer,
parameter,
public :: &
32 COUPLINGS_UNDEFINED = 0, &
44 type(namespace_t),
public :: namespace
46 integer,
allocatable,
public :: supported_interactions_as_partner(:)
49 type(quantity_list_t),
public :: 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
107 class(interaction_partner_t),
intent(in) :: this
108 class(partner_list_t),
intent(inout) :: list
109 integer,
optional,
intent(in) :: interaction_type
111 if (
present(interaction_type))
then
112 if (any(this%supported_interactions_as_partner == interaction_type))
then
130 class(interaction_partner_t),
intent(inout) :: this
131 character(len=*),
intent(in) :: label
135 write(
message(1),
'(a,a,a,a,a)')
'Interation partner "', trim(this%namespace%get()), &
136 '"does not know how to update quantity"', trim(label),
'".'
156 do i = 1,
size(quantity%parents)
157 parent => this%quantities%get(quantity%parents(i))
160 if (parent%iteration >= requested_iteration .or. .not. parent%updated_on_demand) cycle
162 call this%update_on_demand_quantity(parent, requested_iteration)
167 if (all(this%quantities%iteration_equal(quantity%parents, requested_iteration) .or. &
168 this%quantities%always_available(quantity%parents)))
then
170 quantity%iteration = requested_iteration
172 quantity%iteration,
"set"))
173 call this%update_quantity(quantity%label)
188 class(interaction_partner_t),
target,
intent(inout) :: this
189 character(len=*),
intent(in) :: labels(:)
191 logical,
intent(in) :: retardation_allowed
196 do iq = 1,
size(labels)
198 quantity => this%quantities%get(labels(iq))
201 if (quantity%iteration >= requested_iteration .or. .not. quantity%updated_on_demand) cycle
203 if (quantity%always_available)
then
206 call this%update_on_demand_quantity(quantity, requested_iteration)
208 else if (quantity%iteration + 1 <= requested_iteration .or. &
209 (retardation_allowed .and. quantity%iteration + 1 > requested_iteration))
then
212 call this%update_on_demand_quantity(quantity, quantity%iteration + 1)
229 character(len=*),
intent(in) :: couplings(:)
233 integer :: i, ahead, on_time, relevant_couplings
240 relevant_couplings = 0
241 do i = 1,
size(couplings)
242 coupling => this%quantities%get(couplings(i))
245 if (coupling%always_available) cycle
247 relevant_couplings = relevant_couplings + 1
248 if (coupling%iteration == requested_iteration) on_time = on_time + 1
249 if (coupling%iteration > requested_iteration) ahead = ahead + 1
253 if (on_time > 0 .and. ahead > 0)
then
254 status = couplings_undefined
255 else if (on_time + ahead < relevant_couplings)
then
257 else if (on_time == relevant_couplings)
then
259 else if (ahead == relevant_couplings)
then
275 call this%add_ptr(partner)
289 select type (ptr => this%get_next_ptr())
This module defines classes and functions for interaction partners.
integer, parameter, public couplings_on_time
recursive subroutine interaction_partner_add_partners_to_list(this, list, interaction_type)
add interaction partner to a list
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
recursive subroutine interaction_partner_update_on_demand_quantity(this, quantity, requested_iteration)
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, labels, requested_iteration, retardation_allowed)
Given a list of quantities, update the ones that can be update on demand.
subroutine interaction_partner_update_quantity(this, label)
Method to be overriden by interaction partners that have quantities that can be updated 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...
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...