Commit bff89e48 authored by Mohcine Chraibi's avatar Mohcine Chraibi

Pass Matrix by reference

HUGE performace boost
parent 827c693f
Pipeline #5117 passed with stages
in 1 minute and 8 seconds
...@@ -123,7 +123,7 @@ void Method_A::WriteFile_N_t(string data) ...@@ -123,7 +123,7 @@ void Method_A::WriteFile_N_t(string data)
string file_N_t ="Flow_NT_"+_trajName+"_id_"+_measureAreaId+".dat"; string file_N_t ="Flow_NT_"+_trajName+"_id_"+_measureAreaId+".dat";
if(_plotTimeSeries) if(_plotTimeSeries)
{ {
string parameters_N_t="python \""+_scriptsLocation+"/_Plot_N_t.py\" -p \""+ METHOD_A_LOCATION + "\" -n "+file_N_t; string parameters_N_t="python3 \""+_scriptsLocation+"/_Plot_N_t.py\" -p \""+ METHOD_A_LOCATION + "\" -n "+file_N_t;
int res = system(parameters_N_t.c_str()); int res = system(parameters_N_t.c_str());
Log->Write("INFO:\tPlotting N-t diagram! Status: %d", res); Log->Write("INFO:\tPlotting N-t diagram! Status: %d", res);
} }
......
...@@ -567,7 +567,7 @@ vector<int> PedData::GetIdInFrame(int frame, const vector<int>& ids, double zPos ...@@ -567,7 +567,7 @@ vector<int> PedData::GetIdInFrame(int frame, const vector<int>& ids, double zPos
return IdInFrame; return IdInFrame;
} }
double PedData::GetInstantaneousVelocity(int Tnow,int Tpast, int Tfuture, int ID, int *Tfirst, int *Tlast, ub::matrix<double> Xcor, ub::matrix<double> Ycor) const double PedData::GetInstantaneousVelocity(int Tnow,int Tpast, int Tfuture, int ID, int *Tfirst, int *Tlast, const ub::matrix<double> & Xcor, const ub::matrix<double> & Ycor) const
{ {
std::string vcmp = _vComp(ID,Tnow); std::string vcmp = _vComp(ID,Tnow);
double v=0.0; double v=0.0;
...@@ -628,7 +628,7 @@ double PedData::GetInstantaneousVelocity(int Tnow,int Tpast, int Tfuture, int ID ...@@ -628,7 +628,7 @@ double PedData::GetInstantaneousVelocity(int Tnow,int Tpast, int Tfuture, int ID
return fabs(v); return fabs(v);
} }
double PedData::GetInstantaneousVelocity1(int Tnow,int Tpast, int Tfuture, int ID, int *Tfirst, int *Tlast, ub::matrix<double> Xcor, ub::matrix<double> Ycor) const double PedData::GetInstantaneousVelocity1(int Tnow,int Tpast, int Tfuture, int ID, int *Tfirst, int *Tlast, const ub::matrix<double> & Xcor, const ub::matrix<double> & Ycor) const
{ {
std::string vcmp = _vComp(ID,Tnow); // the vcmp is the angle from 0 to 360 std::string vcmp = _vComp(ID,Tnow); // the vcmp is the angle from 0 to 360
if(vcmp=="X+") if(vcmp=="X+")
......
...@@ -81,8 +81,8 @@ private: ...@@ -81,8 +81,8 @@ private:
bool InitializeVariables(const std::string& filename); bool InitializeVariables(const std::string& filename);
bool InitializeVariables(TiXmlElement* xRootNode); bool InitializeVariables(TiXmlElement* xRootNode);
void CreateGlobalVariables(int numPeds, int numFrames); void CreateGlobalVariables(int numPeds, int numFrames);
double GetInstantaneousVelocity(int Tnow,int Tpast, int Tfuture, int ID, int *Tfirst, int *Tlast, ub::matrix<double> Xcor, ub::matrix<double> Ycor) const; double GetInstantaneousVelocity(int Tnow,int Tpast, int Tfuture, int ID, int *Tfirst, int *Tlast, const ub::matrix<double> & Xcor, const ub::matrix<double> & Ycor) const;
double GetInstantaneousVelocity1(int Tnow,int Tpast, int Tfuture, int ID, int *Tfirst, int *Tlast, ub::matrix<double> Xcor, ub::matrix<double> Ycor) const; double GetInstantaneousVelocity1(int Tnow,int Tpast, int Tfuture, int ID, int *Tfirst, int *Tlast, const ub::matrix<double> & Xcor, const ub::matrix<double> & Ycor) const;
private: private:
......
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