42 integer,
parameter,
public :: &
61 procedure(interactions_factory_abst_create),
deferred :: create
63 procedure(interactions_factory_abst_default_mode),
deferred :: default_mode
65 procedure(interactions_factory_abst_block_name),
deferred :: block_name
79 class(interactions_factory_abst_t),
intent(in) :: this
80 integer,
intent(in) :: type
81 class(interaction_partner_t),
target,
intent(inout) :: partner
82 class(interaction_t),
pointer :: interaction
93 class(interactions_factory_abst_t),
intent(in) :: this
94 type(namespace_t),
intent(in) :: namespace
95 integer,
intent(in) :: type
105 class(interactions_factory_abst_t),
intent(in) :: this
123 class(interactions_factory_abst_t),
intent(in) :: this
124 class(system_t),
intent(inout) :: system
125 class(partner_list_t),
target,
intent(in) :: available_partners
129 integer :: interaction_type
134 class(
system_t),
pointer :: subsystem
136 integer :: il, ic,
mode
138 character(len=MAX_NAMESPACE_LEN) :: input_name
143 interactions_to_create = system%supported_interactions
150 if (
parse_block(system%namespace, this%block_name(), blk) == 0)
then
160 call messages_input_error(system%namespace, this%block_name(), details=
"Unknown interaction type", row=il, column=0)
164 if (.not. interactions_to_create%has(interaction_type)) cycle
173 partners = partners_flat_list
176 call partners%empty()
179 call partners%empty()
182 partners = partners_flat_list
184 call messages_input_error(system%namespace, this%block_name(),
"Unknown interaction mode", row=il, column=1)
195 call partner_iter%start(partners_flat_list)
196 do while (partner_iter%has_next())
197 partner => partner_iter%get_next()
198 if (partner%namespace%is_contained_in(input_name))
then
201 call partners%add(partner)
203 call partners%delete(partner)
215 call interactions_to_create%delete(interaction_type)
221 call interaction_iter%start(interactions_to_create)
222 do while (interaction_iter%has_next())
223 interaction_type = interaction_iter%get_next()
226 select case (this%default_mode(system%namespace, interaction_type))
228 partners = partners_flat_list
230 call partners%empty()
232 message(1) =
"Default interaction mode can only be all_partners or no_partners."
246 call iter%start(system%list)
247 do while (iter%has_next())
248 subsystem => iter%get_next()
249 call this%create_interactions(subsystem, available_partners)
265 call iterator%start(partners)
266 do while (iterator%has_next())
267 partner => iterator%get_next()
269 call flat_list%add(partner)
271 select type (partner)
291 class(
system_t),
intent(inout) :: system
293 integer,
optional,
intent(in) :: interaction_type
302 call iter%start(partners)
303 do while (iter%has_next())
304 partner => iter%get_next()
307 if (partner%namespace%get() /= system%namespace%get())
then
309 if (
present(interaction_type))
then
311 if (partner%supported_interactions_as_partner%has(interaction_type))
then
312 interaction => this%create(interaction_type, partner)
315 if (
allocated(interaction%system_quantities))
then
316 system%quantities(interaction%system_quantities)%required = .
true.
318 if (
allocated(interaction%couplings_from_partner))
then
319 partner%quantities(interaction%couplings_from_partner)%required = .
true.
323 call system%interactions%add(interaction)
328 call system%interactions%add(interaction)
if write to the Free Software Franklin Fifth USA !If the compiler accepts long Fortran it is better to use that and build all the preprocessor definitions in one line In !this the debuggers will provide the right line numbers !If the compiler accepts line number then CARDINAL and ACARDINAL !will put them just a new line or a ampersand plus a new line !These macros should be used in macros that span several lines They should by !put immedialty before a line where a compilation error might occur and at the !end of the macro !Note that the cardinal and newline words are substituted by the program !preprocess pl by the ampersand and by a real new line just before compilation !The assertions are ignored if the code is compiled in not debug mode(NDEBUG ! is defined). Otherwise it is merely a logical assertion that
recursive subroutine flatten_partner_list(partners, flat_list)
Interface for the function to get the name of the input file block for interactions.
Interface for the function to create a specific interaction.
Interface for the function to get the default mode for a given interaction.
This module defines the abstract interaction_t class, and some auxiliary classes for interactions.
This module defines classes and functions for interaction partners.
This module defines the abstract class for the interaction factory.
recursive subroutine interactions_factory_abst_create_interactions(this, system, available_partners)
create all interactions for a system and the partners.
integer, parameter, public all_except
subroutine create_interactions(this, system, partners, interaction_type)
Create all interacions of a given type for a system to its interaction partners.
integer, parameter, public only_partners
integer, parameter, public all_partners
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)
subroutine, public messages_input_error(namespace, var, details, row, column)
This module implements the abstract multisystem class.
integer function, public parse_block(namespace, name, blk, check_varinfo_)
This module implements the abstract system type.
The ghost ineraction is a dummy interaction, which needs to be setup between otherwise non-interactin...
abstract interaction class
abstract class for general interaction partners
iterator for the list of partners
abstract class for the interaction factory
This class implements a linked list of integer values.
the abstract multisystem class
Abstract class for systems.