![]() |
fpmas 1.6
|
#include <spatial_agent_mapping.h>
Public Member Functions | |
UniformAgentMapping (api::communication::MpiCommunicator &comm, api::model::AgentGroup &cell_group, std::size_t agent_count) | |
std::size_t | countAt (api::model::Cell *cell) override |
virtual std::size_t | countAt (api::model::Cell *cell)=0 |
An api::model::SpatialAgentMapping implementation that randomly assign SpatialAgents to available Cells.
The RandomMapping::rd random generator is used, and can be seeded with RandomMapping::seed() or fpmas::seed().
fpmas::model::UniformAgentMapping::UniformAgentMapping | ( | api::communication::MpiCommunicator & | comm, |
api::model::AgentGroup & | cell_group, | ||
std::size_t | agent_count | ||
) |
UniformAgentMapping constructor.
agent_count
agents are distributed on the distributed set of Cells contained in the specified cell_group
.
For the same reasons, the same agent_count
must be specified on all processes, since this corresponds to the global count of SpatialAgents to initialize.
This constructor call is synchronous: since global MPI communications are performed, all processes block until the constructor is called on all processes.
comm | MPI communicator |
cell_group | AgentGroup containing Cells to which a SpatialAgent count will be assigned. |
agent_count | total number of SpatialAgents to distribute on a set of Cells. |
|
overridevirtual |
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::Cell >.