Commit 3659603b authored by Oliver Schmidts's avatar Oliver Schmidts

moved the operational modelparsing to the argumentparser and changed int to...

moved the operational modelparsing to the argumentparser and changed int to long in IODispatcher::Write
parent 090c0122
......@@ -64,7 +64,7 @@ const vector<Trajectories*>& IODispatcher::GetIOHandlers()
return _outputHandlers;
}
void IODispatcher::WriteHeader(int nPeds, double fps, Building* building, int seed)
void IODispatcher::WriteHeader(long nPeds, double fps, Building* building, int seed)
{
for (auto const & it : _outputHandlers)
{
......@@ -125,7 +125,7 @@ string TrajectoriesJPSV04::WritePed(Pedestrian* ped)
return agentText;
}
void TrajectoriesJPSV04::WriteHeader(int nPeds, double fps, Building* building, int seed )
void TrajectoriesJPSV04::WriteHeader(long nPeds, double fps, Building* building, int seed )
{
nPeds = building->GetNumberOfPedestrians();
......@@ -339,7 +339,7 @@ TrajectoriesFLAT::TrajectoriesFLAT() : Trajectories()
{
}
void TrajectoriesFLAT::WriteHeader(int nPeds, double fps, Building* building, int seed)
void TrajectoriesFLAT::WriteHeader(long nPeds, double fps, Building* building, int seed)
{
(void) seed; (void) nPeds;
char tmp[CLENGTH] = "";
......@@ -391,7 +391,7 @@ TrajectoriesVTK::TrajectoriesVTK()
{
}
void TrajectoriesVTK::WriteHeader(int nPeds, double fps, Building* building, int seed)
void TrajectoriesVTK::WriteHeader(long nPeds, double fps, Building* building, int seed)
{
//suppress unused warnings
(void) nPeds; (void) fps ; (void) seed;
......@@ -458,7 +458,7 @@ void TrajectoriesVTK::WriteFooter()
}
void TrajectoriesJPSV06::WriteHeader(int nPeds, double fps, Building* building, int seed)
void TrajectoriesJPSV06::WriteHeader(long nPeds, double fps, Building* building, int seed)
{
nPeds = building->GetNumberOfPedestrians();
string tmp;
......@@ -635,7 +635,7 @@ void TrajectoriesXML_MESH::WriteGeometry(Building* building)
}
void TrajectoriesJPSV05::WriteHeader(int nPeds, double fps, Building* building, int seed)
void TrajectoriesJPSV05::WriteHeader(long nPeds, double fps, Building* building, int seed)
{
nPeds = building->GetNumberOfPedestrians();
string tmp;
......
......@@ -49,7 +49,7 @@ public:
void AddIO(Trajectories* ioh);
const std::vector<Trajectories*>& GetIOHandlers();
void WriteHeader(int nPeds, double fps, Building* building, int seed);
void WriteHeader(long nPeds, double fps, Building* building, int seed);
void WriteGeometry(Building* building);
void WriteFrame(int frameNr, Building* building);
void WriteFooter();
......@@ -63,7 +63,7 @@ public:
_outputHandler = NULL;
};
virtual ~Trajectories(){};
virtual void WriteHeader(int nPeds, double fps, Building* building, int seed)=0;
virtual void WriteHeader(long nPeds, double fps, Building* building, int seed)=0;
virtual void WriteGeometry(Building* building)=0;
virtual void WriteFrame(int frameNr, Building* building)=0;
virtual void WriteFooter()=0;
......@@ -103,7 +103,7 @@ public:
TrajectoriesJPSV04(){};
virtual ~TrajectoriesJPSV04(){};
virtual void WriteHeader(int nPeds, double fps, Building* building, int seed);
virtual void WriteHeader(long nPeds, double fps, Building* building, int seed);
virtual void WriteGeometry(Building* building);
virtual void WriteFrame(int frameNr, Building* building);
virtual void WriteFooter();
......@@ -116,7 +116,7 @@ public:
TrajectoriesJPSV05(){};
virtual ~TrajectoriesJPSV05(){};
virtual void WriteHeader(int nPeds, double fps, Building* building, int seed);
virtual void WriteHeader(long nPeds, double fps, Building* building, int seed);
virtual void WriteGeometry(Building* building);
virtual void WriteFrame(int frameNr, Building* building);
virtual void WriteFooter();
......@@ -133,7 +133,7 @@ public:
}
;
virtual void WriteHeader(int nPeds, double fps, Building* building, int seed);
virtual void WriteHeader(long nPeds, double fps, Building* building, int seed);
virtual void WriteGeometry(Building* building);
virtual void WriteFrame(int frameNr, Building* building);
virtual void WriteFooter();
......@@ -150,7 +150,7 @@ public:
}
;
virtual void WriteHeader(int nPeds, double fps, Building* building, int seed);
virtual void WriteHeader(long nPeds, double fps, Building* building, int seed);
virtual void WriteGeometry(Building* building);
virtual void WriteFrame(int frameNr, Building* building);
virtual void WriteFooter();
......@@ -183,7 +183,7 @@ public:
TrajectoriesJPSV06(){};
virtual ~TrajectoriesJPSV06(){ };
virtual void WriteHeader(int nPeds, double fps, Building* building, int seed);
virtual void WriteHeader(long nPeds, double fps, Building* building, int seed);
virtual void WriteGeometry(Building* building);
virtual void WriteFrame(int frameNr, Building* building);
virtual void WriteFooter();
......
......@@ -69,8 +69,6 @@ Simulation::~Simulation()
{
delete _building;
delete _distribution;
//delete _direction;
delete _operationalModel;
delete _solver;
delete _iod;
delete _em;
......@@ -133,14 +131,15 @@ bool Simulation::InitArgs(ArgumentParser* args)
Log->Write(
"INFO: \tFormat plain not yet supported in streaming\n");
return false;
break;
}
case FORMAT_VTK: {
Log->Write(
"INFO: \tFormat vtk not yet supported in streaming\n");
return false;
break;
}
default: {
return false;
}
}
s.append("\tonline streaming enabled \n");
......@@ -189,6 +188,9 @@ bool Simulation::InitArgs(ArgumentParser* args)
// _iod->AddIO(output);
break;
}
default: {
break;
}
}
}
......@@ -196,60 +198,14 @@ bool Simulation::InitArgs(ArgumentParser* args)
_distribution->InitDistributor(_argsParser);
//s.append(_distribution->writeParameter());
// define how the navigation line is crossed
auto direction = args->GetExitStrategy();
//sprintf(tmp, "\tDirection to the exit: %d\n", direction);
//s.append(tmp);
int model = args->GetModel();
if (model == MODEL_GFCM) { //GCFM
//if(args->GetHPCFlag()==0){
_operationalModel = new GCFMModel(direction.get(), args->GetNuPed(),
args->GetNuWall(), args->GetDistEffMaxPed(),
args->GetDistEffMaxWall(), args->GetIntPWidthPed(),
args->GetIntPWidthWall(), args->GetMaxFPed(),
args->GetMaxFWall());
s.append("\tModel: GCFMModel\n");
s.append(_operationalModel->GetDescription());
//}
//else if(args->GetHPCFlag()==2){
// _model = new GPU_acc_GCFMModel(_direction, args->GetNuPed(), args->GetNuWall(), args->GetDistEffMaxPed(),
// args->GetDistEffMaxWall(), args->GetIntPWidthPed(), args->GetIntPWidthWall(),
// args->GetMaxFPed(), args->GetMaxFWall());
//s.append("\tModel: GCFMModel\n");
//s.append(_model->writeParameter());
//}
//else {
// _model = new GPU_ocl_GCFMModel(_direction, args->GetNuPed(), args->GetNuWall(), args->GetDistEffMaxPed(),
// args->GetDistEffMaxWall(), args->GetIntPWidthPed(), args->GetIntPWidthWall(),
// args->GetMaxFPed(), args->GetMaxFWall());
//s.append("\tModel: GCFMModel\n");
//s.append(_model->writeParameter());
//}
} else if (model == MODEL_GOMPERTZ) { //Gompertz
_operationalModel = new GompertzModel(direction.get(), args->GetNuPed(),
args->GetaPed(), args->GetbPed(), args->GetcPed(),
args->GetNuWall(), args->GetaWall(), args->GetbWall(),
args->GetcWall());
s.append("\tModel: GompertzModel\n");
s.append(_operationalModel->GetDescription());
}
_operationalModel = args->GetModel();
s.append(_operationalModel->GetDescription());
// ODE solver
// ODE solver which is never used!
auto solver = args->GetSolver();
sprintf(tmp, "\tODE Solver: %d\n", solver);
s.append(tmp);
//switch (solver) {
//case 1:
//_solver = new EulerSolver(_model);
//break;
//case 2:
// _solver = new VelocityVerletSolver(_model);
// break;
//case 3:
// _solver = new LeapfrogSolver(_model);
// break;
//}
sprintf(tmp, "\tnCPU: %d\n", args->GetMaxOpenMPThreads());
s.append(tmp);
_tmax = args->GetTmax();
......@@ -449,7 +405,7 @@ void Simulation::UpdateRoutesAndLocations()
const vector<Pedestrian*>& allPeds = _building->GetAllPedestrians();
const map<int, Goal*>& goals = _building->GetAllGoals();
unsigned int nSize = allPeds.size();
unsigned long nSize = allPeds.size();
int nThreads = omp_get_max_threads();
int partSize = nSize / nThreads;
......@@ -504,11 +460,11 @@ void Simulation::UpdateRoutesAndLocations()
break;
}
}
if (assigned == true)
if (assigned)
break; // stop the loop
}
if (assigned == false) {
if (!assigned) {
#pragma omp critical
pedsToRemove.push_back(ped);
}
......
......@@ -58,7 +58,7 @@ class Simulation
private:
///Number of pedestrians in the simulation
int _nPeds;
long _nPeds;
///Maximum simulation time
double _tmax;
/// time step
......@@ -74,7 +74,7 @@ private:
/// door crossing strategy for the pedestrians
//DirectionStrategy* _direction;
/// Force model to use
OperationalModel* _operationalModel;
std::shared_ptr<OperationalModel> _operationalModel;
/// differential equation solver
ODESolver* _solver;
/// writing the trajectories to file
......
......@@ -54,6 +54,8 @@
#include "../routing/DummyRouter.h"
#include "../routing/SafestPathRouter.h"
#include "../routing/CognitiveMapRouter.h"
#include "../math/GompertzModel.h"
#include "../math/GCFMModel.h"
using namespace std;
......@@ -838,6 +840,11 @@ void ArgumentParser::ParseGCFMModel(TiXmlElement* xGCFM)
//Parsing the agent parameters
ParseAgentParameters(xGCFM);
p_op_model = std::shared_ptr<OperationalModel>(new GCFMModel(p_exit_strategy.get(), this->GetNuPed(),
this->GetNuWall(), this->GetDistEffMaxPed(),
this->GetDistEffMaxWall(), this->GetIntPWidthPed(),
this->GetIntPWidthWall(), this->GetMaxFPed(),
this->GetMaxFWall()));
}
......@@ -961,6 +968,10 @@ void ArgumentParser::ParseGompertzModel(TiXmlElement* xGompertz)
//Parsing the agent parameters
ParseAgentParameters(xGompertz);
p_op_model = std::shared_ptr<OperationalModel>(new GompertzModel(p_exit_strategy.get(), this->GetNuPed(),
this->GetaPed(), this->GetbPed(), this->GetcPed(),
this->GetNuWall(), this->GetaWall(), this->GetbWall(),
this->GetcWall()));
}
void ArgumentParser::ParseAgentParameters(TiXmlElement* operativModel)
......@@ -1150,9 +1161,8 @@ void ArgumentParser::parseNodeToSolver(const TiXmlNode &solverNode)
}
}
int ArgumentParser::GetModel() const
{
return pModel;
shared_ptr<OperationalModel> ArgumentParser::GetModel() const {
return p_op_model;
}
const FileFormat& ArgumentParser::GetFileFormat() const
{
......
......@@ -161,7 +161,7 @@ public:
double Getfps() const;
double GetLinkedCellSize() const;
int GetModel() const;
std::shared_ptr<OperationalModel> GetModel() const;
double GetTmax() const;
double Getdt() const;
double GetV0Mu() const;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment