42 #ifndef WORLDCREATOR_H_
43 #define WORLDCREATOR_H_
47 #include <boost/mpi/communicator.hpp>
49 #include "repast_hpc/SharedSpaces.h"
51 #include "WorldDefinition.h"
52 #include "RelogoDiscreteSpaceAdder.h"
53 #include "RelogoContinuousSpaceAdder.h"
56 #include "grid_types.h"
67 boost::mpi::communicator* comm;
70 WorldCreator(boost::mpi::communicator* communicator):comm(communicator) {}
87 template<
typename ObsType,
typename PatchType,
typename PatchCreator>
100 template<
typename ObsType,
typename PatchType>
109 template<
typename ObsType,
typename PatchType>
112 return createWorld<ObsType, PatchType> (worldDef, pConfig, pCreator);
115 template<
typename ObsType,
typename PatchType,
typename PatchCreator>
117 PatchCreator& pCreator) {
118 ObsType* observer =
new ObsType();
120 observer->context.addProjection(createDiscreteSpace(worldDef, pConfig));
123 observer->context.addProjection(spaceProj);
124 std::string projName = spaceProj->
name();
125 std::vector<std::string>::iterator iter = observer->context.getAgentsToPushProjOrder.begin();
126 while(iter != observer->context.getAgentsToPushProjOrder.end()){
127 if(*iter == projName) iter = observer->context.getAgentsToPushProjOrder.erase(iter);
144 PatchType* patch = pCreator(agentId, observer);
145 observer->context.addAgent(patch);
153 observer->context.addProjection(*iter);
const Point< double > & extents() const
Gets the extents along each dimension.
Definition: GridDimensions.h:90
Agent identity information.
Definition: AgentId.h:60
const Point< double > & origin() const
Gets the origin.
Definition: GridDimensions.h:83
proj_iter networks_end() const
Gets the end of an iterator over the network Projections defined in this WorldDefinition.
Definition: WorldDefinition.h:127
int currentRank() const
Gets the current process rank of this AgentId.
Definition: AgentId.h:135
proj_iter networks_begin() const
Gets the start of an iterator over the network Projections defined in this WorldDefinition.
Definition: WorldDefinition.h:118
Basic structure for specifying grid dimenions.
Definition: GridDimensions.h:58
Creates a the relogo world given some parameters.
Definition: WorldCreator.h:65
Defines a Relogo world.
Definition: WorldDefinition.h:61
ObsType * createWorld(const WorldDefinition &worldDef, const std::vector< int > &pConfig, PatchCreator &patchCreator)
Creates the Relogo world using the specified parameters and returns an Observer of ObsType.
Definition: WorldCreator.h:116
operator() that creates an agent of type Agent.
Definition: creators.h:61
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.
std::vector< Projection< RelogoAgent > * >::const_iterator proj_iter
An iterator over pointers to Projection<RelogoAgent>.
Definition: WorldDefinition.h:76
virtual const GridDimensions dimensions() const =0
Gets the dimensions of this Grid.