Base grid implementation, implementing elements common to both Grids and ContinuousSpaces.
More...
|
| BaseGrid (std::string name, GridDimensions dimensions) |
| Creates a BaseGrid with the specified name and dimensions. More...
|
|
virtual bool | contains (const AgentId &id) |
| Gets whether or not this grid contains the agent with the specified id. More...
|
|
virtual bool | getLocation (const T *agent, std::vector< GPType > &pt) const |
| Gets the location of this agent and puts it in the specified vector. More...
|
|
virtual bool | getLocation (const AgentId &id, std::vector< GPType > &out) const |
| Gets the location of this agent and puts it in the specified vectors. More...
|
|
virtual T * | getObjectAt (const Point< GPType > &pt) const |
| Gets the first object found at the specified point, or NULL if there is no such object. More...
|
|
virtual void | getObjectsAt (const Point< GPType > &pt, std::vector< T * > &out) const |
| Gets all the objects found at the specified point. More...
|
|
virtual bool | moveTo (const T *agent, const std::vector< GPType > &newLocation) |
| Moves the specified agent to the specified location. More...
|
|
virtual bool | moveTo (const T *agent, const Point< GPType > &newLocation) |
| Moves the specified agent to the specified location. More...
|
|
virtual bool | moveTo (const AgentId &id, const std::vector< GPType > &newLocation) |
| Moves the specified agent to the specified location. More...
|
|
virtual bool | moveTo (const AgentId &id, const Point< GPType > &pt) |
| Moves the specified agent to the specified point. More...
|
|
virtual std::pair< bool, Point< GPType > > | moveByDisplacement (const T *agent, const std::vector< GPType > &displacement) |
| Moves the specified object from its current location by the specified amount. More...
|
|
virtual std::pair< bool, Point< GPType > > | moveByVector (const T *agent, double distance, const std::vector< double > &anglesInRadians) |
| doc inherited from Grid
|
|
virtual const_iterator | begin () const |
| Gets an iterator over the agents in this BaseGrid starting with the first agent. More...
|
|
virtual const_iterator | end () const |
| Gets the end of an iterator over the agents in this BaseGrid. More...
|
|
virtual size_t | size () const |
| Gets the number of agents in this BaseGrid. More...
|
|
virtual double | getDistance (const Point< GPType > &pt1, const Point< GPType > &pt2) const |
| Gets the distance between the two grid points. More...
|
|
virtual double | getDistanceSq (const Point< GPType > &pt1, const Point< GPType > &pt2) const |
| Gets the square of the distance between the two grid points. More...
|
|
virtual void | getDisplacement (const Point< GPType > &pt1, const Point< GPType > &pt2, std::vector< GPType > &out) const |
| Gets vector difference between point 1 and point 2, putting the result in out. More...
|
|
virtual const GridDimensions | dimensions () const |
| Gets the dimensions of this Grid. More...
|
|
virtual void | translate (const Point< GPType > &location, const Point< GPType > &displacement, std::vector< GPType > &out) const |
| Translates the specified location by the specified displacement put the result in out. More...
|
|
virtual void | transform (const std::vector< GPType > &location, std::vector< GPType > &out) const |
| Transforms the specified location using the properties (e.g. More...
|
|
virtual bool | isPeriodic () const |
| Gets whether or not this grid is periodic (i.e. More...
|
|
virtual ProjectionInfoPacket * | getProjectionInfo (AgentId id, bool secondaryInfo=false, std::set< AgentId > *secondaryIds=0, int destProc=-1) |
|
virtual void | updateProjectionInfo (ProjectionInfoPacket *pip, Context< T > *context) |
|
virtual void | getAgentsToPush (std::set< AgentId > &agentsToTest, std::map< int, std::set< AgentId > > &agentsToPush) |
| Given a set of agents, gets the agents that this projection implementation must 'push' to other processes. More...
|
|
virtual void | getInfoExchangePartners (std::set< int > &psToSendTo, std::set< int > &psToReceiveFrom) |
| Gets the set of processes with which this Projection exchanges projection info. More...
|
|
virtual void | getAgentStatusExchangePartners (std::set< int > &psToSendTo, std::set< int > &psToReceiveFrom) |
| 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...
|
|
| Grid (std::string name) |
| Creates a Grid with the specified name. More...
|
|
virtual const GridDimensions | bounds () const =0 |
|
virtual void | getRequiredAgents (std::set< AgentId > &agentsToTest, std::set< AgentId > &agentsRequired, RADIUS radius=Projection< T >::PRIMARY) |
| 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 bool | keepsAgentsOnSyncProj () |
| Should return true if the Projection implemented can 'keep' some (non-local) agents during a projection information synchronization operation. More...
|
|
virtual bool | sendsSecondaryAgentsOnStatusExchange () |
| Should return true if the Projection implemented will send secondary agents during a status exchange. More...
|
|
virtual void | cleanProjectionInfo (std::set< AgentId > &agentsToKeep) |
|
| 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 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 | balance () |
|
template<typename T, typename CellAccessor, typename GPTransformer, typename Adder, typename GPType>
class repast::BaseGrid< T, CellAccessor, GPTransformer, Adder, GPType >
Base grid implementation, implementing elements common to both Grids and ContinuousSpaces.
Standard grid and space types that provide defaults for the various template parameters can be found in Space in Space.h
- Template Parameters
-
T | the type of objects contained by this BaseGrid (generally the type of agents) |
CellAccessor | implements the actual storage for the grid. |
GPTransformer | transforms cell points according to the topology (e.g. periodic) of the BaseGrid. |
Adder | determines how objects are added to the grid from its associated context. |
GPType | the coordinate type of the grid point locations; this must be an int or a double. |
template<typename T , typename CellAccessor , typename GPTransformer , typename Adder , typename GPType >
virtual void repast::BaseGrid< T, CellAccessor, GPTransformer, Adder, GPType >::getAgentStatusExchangePartners |
( |
std::set< int > & |
psToSendTo, |
|
|
std::set< int > & |
psToReceiveFrom |
|
) |
| |
|
inlinevirtual |
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.
Implements repast::Grid< T, GPType >.
Reimplemented in 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 >.
template<typename T , typename CellAccessor , typename GPTransformer , typename Adder , typename GPType >
virtual void repast::BaseGrid< T, CellAccessor, GPTransformer, Adder, GPType >::getInfoExchangePartners |
( |
std::set< int > & |
psToSendTo, |
|
|
std::set< int > & |
psToReceiveFrom |
|
) |
| |
|
inlinevirtual |
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.
Implements repast::Grid< T, GPType >.
Reimplemented in 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 >.