fpmas 1.6
Public Member Functions | List of all members
fpmas::model::RandomGridAgentMapping Class Reference

#include <grid_agent_mapping.h>

Inheritance diagram for fpmas::model::RandomGridAgentMapping:
Inheritance graph
[legend]
Collaboration diagram for fpmas::model::RandomGridAgentMapping:
Collaboration graph
[legend]

Public Member Functions

template<typename DistributionX , typename DistributionY >
 RandomGridAgentMapping (DistributionX &&x, DistributionY &&y, std::size_t agent_count)
 
std::size_t countAt (api::model::GridCell *cell) override
 
virtual std::size_t countAt (api::model::GridCell *cell)=0
 

Detailed Description

api::model::SpatialAgentMapping implementation for grid environments.

Agents are distributed on the environment according to random distributions.

The RandomMapping::rd random generator is used, and can be seeded with RandomMapping::seed() or fpmas::seed().

Constructor & Destructor Documentation

◆ RandomGridAgentMapping()

template<typename DistributionX , typename DistributionY >
fpmas::model::RandomGridAgentMapping::RandomGridAgentMapping ( DistributionX &&  x,
DistributionY &&  y,
std::size_t  agent_count 
)

RandomGridAgentMapping constructor

The x/y position of agent_count agents is computed using the provided random distributions. The same default deterministic random number generator is used on all processes, to ensure that all the processes compute the same agent mapping. To ensure this, it is also required that x/y distributions are the same on all processes.

Once the x/y position of all agents have been computed, the number of agents on each x/y position is stored and used to produce results returned by the countAt() method.

Template Parameters
DistributionXx coordinates distribution
DistributionYy coordinates distribution
Parameters
xx distribution
yy distribution
agent_countagent count

Member Function Documentation

◆ countAt()

std::size_t fpmas::model::RandomGridAgentMapping::countAt ( api::model::GridCell cell)
inlineoverridevirtual

Returns the number of SpatialAgents that must be initialized on the provided Cell.

Notice that the agents instantiation and initialization is not performed by this method, but handled by SpatialAgentBuilder::build().

Parameters
cellcell on which agents will be initialized

Implements fpmas::api::model::SpatialAgentMapping< api::model::GridCell >.


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