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

#include <spatial_agent_mapping.h>

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

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
 

Detailed Description

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().

Constructor & Destructor Documentation

◆ UniformAgentMapping()

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.

Parameters
commMPI communicator
cell_groupAgentGroup containing Cells to which a SpatialAgent count will be assigned.
agent_counttotal number of SpatialAgents to distribute on a set of Cells.

Member Function Documentation

◆ countAt()

std::size_t fpmas::model::UniformAgentMapping::countAt ( api::model::Cell cell)
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().

Parameters
cellcell on which agents will be initialized

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


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