fpmas 1.6
Public Member Functions | List of all members
fpmas::model::DynamicEndCondition< CellType > Class Template Reference

#include <dist_move_algo.h>

Inheritance diagram for fpmas::model::DynamicEndCondition< CellType >:
Inheritance graph
[legend]
Collaboration diagram for fpmas::model::DynamicEndCondition< CellType >:
Collaboration graph
[legend]

Public Member Functions

void init (api::communication::MpiCommunicator &comm, std::vector< api::model::SpatialAgent< CellType > * > agents, std::vector< CellType * >) override
 
void step () override
 
bool end () override
 
- Public Member Functions inherited from fpmas::api::model::EndCondition< CellType >
virtual void init (api::communication::MpiCommunicator &comm, std::vector< api::model::SpatialAgent< CellType > * > agents, std::vector< CellType * > cells)=0
 
virtual void step ()=0
 
virtual bool end ()=0
 

Detailed Description

template<typename CellType>
class fpmas::model::DynamicEndCondition< CellType >

Implements a dynamic api::model::EndCondition for the DistributedMoveAlgorithm.

The required number of steps that must be performed by the DistributedMoveAlgorithm is determined at runtime, at each initialization of the end condition. To do so, an algorithm determines the current maximum radius of mobility and perception ranges of all SpatialAgents in the simulation (more particularly, those provided to the init() method). In consequence, inter-processes communications occur to globally determine the maximum.

This EndCondition might be less efficient than the StaticEndCondition. However, it allows mobility and perception ranges of each SpatialAgent to evolve dynamically at runtime, without any restriction. Moreover, the computed number of steps is always optimized, and exactly corresponds to the minimal number of steps required by the DistributedMoveAlgorithm to properly update SpatialAgent locations.

Member Function Documentation

◆ init()

template<typename CellType >
void fpmas::model::DynamicEndCondition< CellType >::init ( api::communication::MpiCommunicator comm,
std::vector< api::model::SpatialAgent< CellType > * >  agents,
std::vector< CellType * >   
)
inlineoverride

Initializes the end condition, computing the requied number of steps from the current perception and mobility ranges of all agents on all processes.

Parameters
commMPI communicator
agentsmoving agents

◆ step()

template<typename CellType >
void fpmas::model::DynamicEndCondition< CellType >::step ( )
inlineoverridevirtual

Advances the end condition.

Implements fpmas::api::model::EndCondition< CellType >.

◆ end()

template<typename CellType >
bool fpmas::model::DynamicEndCondition< CellType >::end ( )
inlineoverridevirtual

Returns true if and only if the end condition has been reached.

Returns
true iff the end condition has been reached

Implements fpmas::api::model::EndCondition< CellType >.


The documentation for this class was generated from the following file: