RepastHPC
2.3.1
|
Abstract base class for all Projections. More...
#include <Projection.h>
Public Types | |
enum | RADIUS { PRIMARY, SECONDARY } |
Public Member Functions | |
Projection (std::string name) | |
Creates a projection with specified name. More... | |
const std::string | name () const |
Gets the name of this projection. | |
void | addFilterVal (int type) |
Adds an entry to the list of agent types that can be added to this projection. More... | |
void | removeFilterVal (int type) |
Removes an entry from the list of agent types that can be added to this projection. More... | |
void | clearFilter () |
Clears the list of agent types that can be added to this projection; the result is that the filter is empty, and any agent can be added. | |
bool | agentCanBeAdded (boost::shared_ptr< T > agent) |
Returns true if the agent can be added to the projection, which will be the case if the filter list is empty or if the agent's type is in the filter list. More... | |
virtual bool | keepsAgentsOnSyncProj ()=0 |
Should return true if the Projection implemented can 'keep' some (non-local) agents during a projection information synchronization operation. More... | |
virtual bool | sendsSecondaryAgentsOnStatusExchange ()=0 |
Should return true if the Projection implemented will send secondary agents during a status exchange. More... | |
virtual void | getInfoExchangePartners (std::set< int > &psToSendTo, std::set< int > &psToReceiveFrom)=0 |
Gets the set of processes with which this Projection exchanges projection info. More... | |
virtual void | getAgentStatusExchangePartners (std::set< int > &psToSendTo, std::set< int > &psToReceiveFrom)=0 |
Gets the set of processes with which this Projection exchanges agent status info- that is, the set of processes from which agents can move to this one or to which they can move when moving from this one. More... | |
virtual void | getRequiredAgents (std::set< AgentId > &agentsToTest, std::set< AgentId > &agentsRequired, RADIUS radius=PRIMARY)=0 |
Given a set of agents to test, gets the subset that must be kept in order to fulfill the projection's 'contract' to the specified radius. More... | |
virtual void | getAgentsToPush (std::set< AgentId > &agentsToTest, std::map< int, std::set< AgentId > > &agentsToPush)=0 |
Given a set of agents, gets the agents that this projection implementation must 'push' to other processes. More... | |
virtual void | getProjectionInfo (std::vector< AgentId > &agents, std::vector< ProjectionInfoPacket * > &packets, bool secondaryInfo=false, std::set< AgentId > *secondaryIds=0, int destProc=-1) |
Convenience wrapper that gets all of the projection information for the agents specified (calls implementation in child class that gets only the information for one agent). | |
void | updateProjectionInfo (std::vector< ProjectionInfoPacket * > &pips, Context< T > *context) |
Updates the projection information for the agents in this projection according to the information contained in the vector of information packets passed. | |
virtual void | cleanProjectionInfo (std::set< AgentId > &agentsToKeep)=0 |
virtual void | balance () |
Protected Member Functions | |
virtual bool | addAgent (boost::shared_ptr< T > agent)=0 |
virtual void | removeAgent (T *agent)=0 |
virtual ProjectionInfoPacket * | getProjectionInfo (AgentId id, bool secondaryInfo=false, std::set< AgentId > *secondaryIds=0, int destProc=-1)=0 |
virtual void | updateProjectionInfo (ProjectionInfoPacket *pip, Context< T > *context)=0 |
Protected Attributes | |
std::string | name_ |
std::set< int > | filter |
Friends | |
class | Context< T > |
Abstract base class for all Projections.
|
inline |
Creates a projection with specified name.
name | the name of the projection. This must be unique across projections |
|
inline |
Adds an entry to the list of agent types that can be added to this projection.
Note: no indication if type is already listed
type | type to be added |
|
inline |
Returns true if the agent can be added to the projection, which will be the case if the filter list is empty or if the agent's type is in the filter list.
agent | pointer to the agent to be tested |
|
pure virtual |
Gets the set of processes with which this Projection exchanges agent status info- that is, the set of processes from which agents can move to this one or to which they can move when moving from this one.
In the most general case this will be all other processors. However, simulations where agents move in spaces will usually exchange agents only with a small subset of 'neighbor' processes, which is knowable in advance and constant. To accommodate the general case, the algorithm for exchanging information must poll all other processes to see which are sending to this one; if this is known in advance, this additional (expensive) step can be skipped.
Implemented in repast::Grid< T, GPType >, repast::Grid< RelogoAgent, int >, repast::Grid< T, double >, repast::Grid< T, int >, repast::BaseGrid< T, CellAccessor, GPTransformer, Adder, GPType >, repast::BaseGrid< T, MultipleOccupancy< T, double >, GPTransformer, Adder, double >, repast::BaseGrid< T, MultipleOccupancy< T, GPType >, GPTransformer, Adder, GPType >, repast::BaseGrid< RelogoAgent, MultipleOccupancy< RelogoAgent, int >, GPTransformer, Adder, int >, repast::BaseGrid< T, MultipleOccupancy< T, int >, GPTransformer, Adder, int >, repast::Graph< V, E, Ec, EcM >, repast::SharedBaseGrid< T, GPTransformer, Adder, GPType >, repast::SharedBaseGrid< RelogoAgent, GPTransformer, Adder, int >, repast::SharedBaseGrid< T, GPTransformer, Adder, int >, and repast::SharedBaseGrid< T, GPTransformer, Adder, double >.
|
pure virtual |
Given a set of agents, gets the agents that this projection implementation must 'push' to other processes.
Generally spaces must push agents that are in 'buffer zones' and graphs must push local agents that are vertices to master edges where the other vertex is non- local. The results are returned per-process in the agentsToPush map.
Implemented in repast::Grid< T, GPType >, repast::Grid< RelogoAgent, int >, repast::Grid< T, double >, repast::Grid< T, int >, repast::BaseGrid< T, CellAccessor, GPTransformer, Adder, GPType >, repast::BaseGrid< T, MultipleOccupancy< T, double >, GPTransformer, Adder, double >, repast::BaseGrid< T, MultipleOccupancy< T, GPType >, GPTransformer, Adder, GPType >, repast::BaseGrid< RelogoAgent, MultipleOccupancy< RelogoAgent, int >, GPTransformer, Adder, int >, repast::BaseGrid< T, MultipleOccupancy< T, int >, GPTransformer, Adder, int >, repast::Graph< V, E, Ec, EcM >, repast::SharedBaseGrid< T, GPTransformer, Adder, GPType >, repast::SharedBaseGrid< RelogoAgent, GPTransformer, Adder, int >, repast::SharedBaseGrid< T, GPTransformer, Adder, int >, and repast::SharedBaseGrid< T, GPTransformer, Adder, double >.
|
pure virtual |
Gets the set of processes with which this Projection exchanges projection info.
In the most general case this will be all other processors; this is the case for graphs, where agent connections can be arbitrary. However, spaces usually exchange information only with a small subset of 'neighbor' processes, which is knowable in advance and constant. To accommodate the general case, the algorithm for exchanging information must poll all other processes to see which are sending to this one; if this is known in advance, this additional (expensive) step can be skipped.
Implemented in repast::Grid< T, GPType >, repast::Grid< RelogoAgent, int >, repast::Grid< T, double >, repast::Grid< T, int >, repast::BaseGrid< T, CellAccessor, GPTransformer, Adder, GPType >, repast::BaseGrid< T, MultipleOccupancy< T, double >, GPTransformer, Adder, double >, repast::BaseGrid< T, MultipleOccupancy< T, GPType >, GPTransformer, Adder, GPType >, repast::BaseGrid< RelogoAgent, MultipleOccupancy< RelogoAgent, int >, GPTransformer, Adder, int >, repast::BaseGrid< T, MultipleOccupancy< T, int >, GPTransformer, Adder, int >, repast::Graph< V, E, Ec, EcM >, repast::SharedBaseGrid< T, GPTransformer, Adder, GPType >, repast::SharedBaseGrid< RelogoAgent, GPTransformer, Adder, int >, repast::SharedBaseGrid< T, GPTransformer, Adder, int >, and repast::SharedBaseGrid< T, GPTransformer, Adder, double >.
|
pure virtual |
Given a set of agents to test, gets the subset that must be kept in order to fulfill the projection's 'contract' to the specified radius.
Generally spaces do not require any agents, but graphs do- generally the non-local ends to master copies of edges.
Implemented in repast::Grid< T, GPType >, repast::Grid< T, double >, and repast::Grid< T, int >.
|
pure virtual |
Should return true if the Projection implemented can 'keep' some (non-local) agents during a projection information synchronization operation.
Generally spaces will allow all non-local agents to be deleted, but graphs keep the non-local agents that participate in Master edges.
It is possible to override these. A graph projection can be created that does not permit non-local agents to be 'kept'. This would be an extremely unusual use case, but it is possible.
Note that these are used for optimization. If no projection in a given context keeps any agents, several steps in the synchronization algorithm can be omitted. Of course, omitting these steps when a projection actually retains agents can caused undefined problems.
Implemented in repast::Graph< V, E, Ec, EcM >, repast::Grid< T, GPType >, repast::Grid< RelogoAgent, int >, repast::Grid< T, double >, and repast::Grid< T, int >.
|
inline |
Removes an entry from the list of agent types that can be added to this projection.
Note: no indication if type is not listed
type | entry to be removed |
|
pure virtual |
Should return true if the Projection implemented will send secondary agents during a status exchange.
Generally spaces do not and graphs do.
If no secondary agents will be sent, portions of the algorithm can be omitted for optimization.
Implemented in repast::Graph< V, E, Ec, EcM >, repast::Grid< T, GPType >, repast::Grid< RelogoAgent, int >, repast::Grid< T, double >, and repast::Grid< T, int >.