47 #include "Projection.h"
49 #include "GridDimensions.h"
61 template<
typename T,
typename GPType>
63 typedef typename Projection<T>::RADIUS RADIUS;
86 virtual bool contains(
const AgentId&
id) = 0;
96 virtual bool moveTo(
const AgentId&
id,
const Point<GPType>& pt) = 0;
114 virtual std::pair<bool, Point<GPType> >
moveByVector(
const T* agent,
double distance,
115 const std::vector<double>& anglesInRadians) = 0;
134 virtual std::pair<bool, Point<GPType> >
142 virtual const GridDimensions
dimensions()
const = 0;
144 virtual const GridDimensions bounds()
const = 0;
154 virtual T*
getObjectAt(
const Point<GPType>& pt)
const = 0;
163 virtual void getObjectsAt(
const Point<GPType>& pt, std::vector<T*>& out)
const = 0;
175 virtual bool getLocation(
const T* agent, std::vector<GPType>& out)
const = 0;
187 virtual bool getLocation(
const AgentId&
id, std::vector<GPType>& out)
const = 0;
198 virtual void getDisplacement(
const Point<GPType>& pt1,
const Point<GPType>& pt2, std::vector<GPType>& out)
const = 0;
208 virtual double getDistance(
const Point<GPType>& pt1,
const Point<GPType>& pt2)
const = 0;
218 virtual double getDistanceSq(
const Point<GPType>& pt1,
const Point<GPType>& pt2)
const = 0;
228 translate(
const Point<GPType>& location,
const Point<GPType>& displacement, std::vector<GPType>& out)
const = 0;
237 transform(
const std::vector<GPType>& location, std::vector<GPType>& out)
const = 0;
246 virtual ProjectionInfoPacket* getProjectionInfo(AgentId
id,
bool secondaryInfo =
false, std::set<AgentId>* secondaryIds = 0,
int destProc = -1 ) = 0;
248 virtual void updateProjectionInfo(ProjectionInfoPacket* pip, Context<T>* context) = 0;
252 virtual void getAgentsToPush(std::set<AgentId>& agentsToTest, std::map<
int, std::set<AgentId> >& agentsToPush) = 0;
262 virtual void cleanProjectionInfo(std::set<AgentId>& agentsToKeep){};
virtual double getDistanceSq(const Point< GPType > &pt1, const Point< GPType > &pt2) const =0
Gets the square of the distance between the two grid points.
virtual bool keepsAgentsOnSyncProj()
Should return true if the Projection implemented can 'keep' some (non-local) agents during a projecti...
Definition: Grid.h:254
virtual void getInfoExchangePartners(std::set< int > &psToSendTo, std::set< int > &psToReceiveFrom)=0
Gets the set of processes with which this Projection exchanges projection info.
virtual T * getObjectAt(const Point< GPType > &pt) const =0
Gets the first object found at the specified point, or NULL if there is no such object.
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...
Definition: Grid.h:250
virtual double getDistance(const Point< GPType > &pt1, const Point< GPType > &pt2) const =0
Gets the distance between the two grid points.
Grid(std::string name)
Creates a Grid with the specified name.
Definition: Grid.h:73
virtual bool isPeriodic() const =0
Gets whether or not this grid is periodic (i.e.
virtual bool contains(const AgentId &id)=0
Gets whether or not this grid contains the agent with the specified id.
Abstract base class for all Projections.
Definition: Projection.h:125
virtual bool getLocation(const T *agent, std::vector< GPType > &out) const =0
Gets the location of this agent and puts it in the specified vector.
virtual std::pair< bool, Point< GPType > > moveByDisplacement(const T *agent, const std::vector< GPType > &displacement)=0
Moves the specified object from its current location by the specified amount.
Abstract interface for Grids and ContinuousSpaces.
Definition: Grid.h:62
virtual void getObjectsAt(const Point< GPType > &pt, std::vector< T * > &out) const =0
Gets all the objects found at the specified point.
virtual bool sendsSecondaryAgentsOnStatusExchange()
Should return true if the Projection implemented will send secondary agents during a status exchange.
Definition: Grid.h:256
virtual void translate(const Point< GPType > &location, const Point< GPType > &displacement, std::vector< GPType > &out) const =0
Translates the specified location by the specified displacement put the result in out.
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 proce...
virtual void getDisplacement(const Point< GPType > &pt1, const Point< GPType > &pt2, std::vector< GPType > &out) const =0
Gets vector difference between point 1 and point 2, putting the result in out.
virtual void transform(const std::vector< GPType > &location, std::vector< GPType > &out) const =0
Transforms the specified location using the properties (e.g.
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,...
const std::string name() const
Gets the name of this projection.
Definition: Projection.h:164
virtual bool moveTo(const AgentId &id, const Point< GPType > &pt)=0
Moves the specified agent to the specified point.
virtual std::pair< bool, Point< GPType > > moveByVector(const T *agent, double distance, const std::vector< double > &anglesInRadians)=0
Moves the specifed object the specified distance from its current position along the specified angle.
virtual const GridDimensions dimensions() const =0
Gets the dimensions of this Grid.