void RepastHPCDemoModel::initSchedule(repast::ScheduleRunner& runner){ runner.scheduleEvent(1, repast::Schedule::FunctorPtr(new repast::MethodFunctor<RepastHPCDemoModel> (this, &RepastHPCDemoModel::requestAgents))); runner.scheduleEvent(1.1, repast::Schedule::FunctorPtr(new repast::MethodFunctor<RepastHPCDemoModel> (this, &RepastHPCDemoModel::connectAgentNetwork))); runner.scheduleEvent(2, 1, repast::Schedule::FunctorPtr(new repast::MethodFunctor<RepastHPCDemoModel> (this, &RepastHPCDemoModel::doSomething))); runner.scheduleEvent(3, repast::Schedule::FunctorPtr(new repast::MethodFunctor<RepastHPCDemoModel> (this, &RepastHPCDemoModel::moveAgents))); runner.scheduleEndEvent(repast::Schedule::FunctorPtr(new repast::MethodFunctor<RepastHPCDemoModel> (this, &RepastHPCDemoModel::recordResults))); runner.scheduleStop(stopAt); // Data collection runner.scheduleEvent(1.5, 5, repast::Schedule::FunctorPtr(new repast::MethodFunctor<repast::DataSet>(agentValues, &repast::DataSet::record))); runner.scheduleEvent(10.6, 10, repast::Schedule::FunctorPtr(new repast::MethodFunctor<repast::DataSet>(agentValues, &repast::DataSet::write))); runner.scheduleEndEvent(repast::Schedule::FunctorPtr(new repast::MethodFunctor<repast::DataSet>(agentValues, &repast::DataSet::write))); }
void RepastHPCDemoModel::initSchedule(repast::ScheduleRunner& runner){ runner.scheduleEvent(1, repast::Schedule::FunctorPtr(new repast::MethodFunctor<RepastHPCDemoModel> (this, &RepastHPCDemoModel::requestAgents))); runner.scheduleEvent(2, 1, repast::Schedule::FunctorPtr(new repast::MethodFunctor<RepastHPCDemoModel> (this, &RepastHPCDemoModel::doSomething))); runner.scheduleEndEvent(repast::Schedule::FunctorPtr(new repast::MethodFunctor<RepastHPCDemoModel> (this, &RepastHPCDemoModel::recordResults))); runner.scheduleStop(stopAt); }
void BirdModel::initSchedule(repast::ScheduleRunner& runner) { runner.scheduleStop(stopAt); runner.scheduleEvent(1, 1, repast::Schedule::FunctorPtr( new repast::MethodFunctor<BirdModel>(this, &BirdModel::step))); runner.scheduleEvent(1.05, 1, repast::Schedule::FunctorPtr( new repast::MethodFunctor<BirdModel>(this, &BirdModel::synchAgents))); // Create a builder for netcdf aggregate data collection repast::SVDataSetBuilder testBuilder("./logs/data.csv", ";", repast::RepastProcess::instance()->getScheduleRunner().schedule()); // This is the data source BirdData* bData = new BirdData(this); testBuilder.addDataSource( repast::createSVDataSource("RANDOM_NUMBERS", bData, std::plus<int>())); repast::DataSet* testDataSet = testBuilder.createDataSet(); // Schedule the record and write on the dataset runner.scheduleEvent(1.1, 1, repast::Schedule::FunctorPtr( new repast::MethodFunctor<repast::DataSet>(testDataSet, &repast::DataSet::record))); repast::Schedule::FunctorPtr dataWrite = repast::Schedule::FunctorPtr( new repast::MethodFunctor<repast::DataSet>(testDataSet, &repast::DataSet::write)); runner.scheduleEvent(1.2, 1, dataWrite); // Make sure we write the data when the sim ends runner.scheduleEndEvent(dataWrite); /** * NETCDF TEST 2 */ // Create a builder for netcdf aggregate data collection repast::SVDataSetBuilder fastBuilder("./logs/fastest.csv", ";", repast::RepastProcess::instance()->getScheduleRunner().schedule()); // This is the data source Fastest* fast = new Fastest(this); fastBuilder.addDataSource( repast::createSVDataSource("NUM_OF_FASTEST_BIRDS", fast, std::plus<int>())); repast::DataSet* fastDataSet = fastBuilder.createDataSet(); // Schedule the record and write on the dataset runner.scheduleEvent(1.1, 1, repast::Schedule::FunctorPtr( new repast::MethodFunctor<repast::DataSet>(fastDataSet, &repast::DataSet::record))); repast::Schedule::FunctorPtr fastWrite = repast::Schedule::FunctorPtr( new repast::MethodFunctor<repast::DataSet>(fastDataSet, &repast::DataSet::write)); runner.scheduleEvent(1.2, 1, fastWrite); // Make sure we write the data when the sim ends runner.scheduleEndEvent(fastWrite); /** * NETCDF TEST 3 * // Create a builder for netcdf aggregate data collection repast::SVDataSetBuilder fastBuilder("./logs/fastest.csv", ";", repast::RepastProcess::instance()->getScheduleRunner().schedule()); // This is the data source Speed* speed = new Speed(this); SpeedBuilder.addDataSource( repast::createSVDataSource("SPEED", speed, std::plus<int>())); repast::DataSet* speedDataSet = speedBuilder.createDataSet(); // Schedule the record and write on the dataset runner.scheduleEvent(1.1, 1, repast::Schedule::FunctorPtr( new repast::MethodFunctor<repast::DataSet>(speedDataSet, &repast::DataSet::record))); repast::Schedule::FunctorPtr fastWrite = repast::Schedule::FunctorPtr( new repast::MethodFunctor<repast::DataSet>(speedDataSet, &repast::DataSet::write)); runner.scheduleEvent(1.2, 1, speedWrite); // Make sure we write the data when the sim ends runner.scheduleEndEvent(speedWrite); * * */ }