![]() |
fpmas 1.6
|
#include <grid_agent_mapping.h>
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 |
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().
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.
DistributionX | x coordinates distribution |
DistributionY | y coordinates distribution |
x | x distribution |
y | y distribution |
agent_count | agent count |
|
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().
cell | cell on which agents will be initialized |
Implements fpmas::api::model::SpatialAgentMapping< api::model::GridCell >.