41 #ifndef SIMULATIONRUNNER_H_
42 #define SIMULATIONRUNNER_H_
46 #include <boost/mpi/communicator.hpp>
48 #include "boost/algorithm/string/split.hpp"
49 #include "boost/algorithm/string/classification.hpp"
51 #include "repast_hpc/Properties.h"
52 #include "repast_hpc/RepastProcess.h"
54 #include "RelogoLink.h"
55 #include "WorldCreator.h"
56 #include "WorldDefinition.h"
62 using namespace boost;
63 using namespace boost::algorithm;
70 boost::mpi::communicator* comm;
105 template<
typename ObserverType,
typename PatchType>
109 template<
typename ObserverType,
typename PatchType>
115 int buffer = strToInt(props.
getProperty(
"grid.buffer"));
117 bool worldIsWrapped =
true;
118 if(props.
contains(
"non.toroidal")) worldIsWrapped =
false;
125 if(props.
contains(
"DirectedNetworks")){
126 std::string netList = props.
getProperty(
"DirectedNetworks");
127 std::vector<std::string> directedNetworks;
128 split(directedNetworks, netList, boost::is_any_of(
" ,"), boost::token_compress_on);
129 for(
unsigned int i = 0; i < directedNetworks.size(); i++){
130 if(directedNetworks[i].compare(
"default") == 0) def.
defineNetwork(
true, &rlcm);
135 if(props.
contains(
"UndirectedNetworks")){
136 std::string netList = props.
getProperty(
"UndirectedNetworks");
137 std::vector<std::string> undirectedNetworks;
138 split(undirectedNetworks, netList, boost::is_any_of(
" ,"), boost::token_compress_on);
139 for(
unsigned int i = 0; i < undirectedNetworks.size(); i++){
140 if(undirectedNetworks[i].compare(
"default") == 0) def.
defineNetwork(
false, &rlcm);
145 int processesPerX = strToInt(props.
getProperty(
"proc.per.x"));
146 int processesPerY = strToInt(props.
getProperty(
"proc.per.y"));
147 std::vector<int> procsPerDim;
148 procsPerDim.push_back(processesPerX);
149 procsPerDim.push_back(processesPerY);
152 ObserverType* obs = creator.
createWorld<ObserverType, PatchType> (def, procsPerDim);
SimulationRunner(boost::mpi::communicator *communicator)
Creates a SimulationRunner.
Definition: SimulationRunner.h:76
void defineNetwork(std::string name, bool directed, RelogoLinkContentManager *rlcm)
Defines a network with the specified name and whether or not the network is directed.
Definition: WorldDefinition.cpp:61
Subclass of RepastEdgeContentManager, used to package and rebuild edges during synchronization.
Definition: RelogoLink.h:130
ScheduleRunner & getScheduleRunner()
Gets the ScheduleRunner used by this RepastProcess.
Definition: RepastProcess.h:401
void run(Properties &props)
Creates and runs the simulation using the properties defined in props.
Definition: SimulationRunner.h:110
bool contains(const std::string &key) const
Gets whether or not this Properties contains the specified key.
Definition: Properties.cpp:86
Runs a Relogo simulation.
Definition: SimulationRunner.h:68
Creates a the relogo world given some parameters.
Definition: WorldCreator.h:65
void run()
Starts and runs the simulation schedule.
Definition: Schedule.cpp:182
Defines a Relogo world.
Definition: WorldDefinition.h:61
static RepastProcess * instance()
Gets this RepastProcess.
Definition: RepastProcess.cpp:126
std::string getProperty(const std::string &key) const
Gets the property with the specified key.
Definition: Properties.cpp:90
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
Map type object that contains key, value(string) properties.
Definition: Properties.h:77