From cbfb8410c7142c0d89d85572dbc08d1c648652f1 Mon Sep 17 00:00:00 2001
From: Mohcine Chraibi <m.chraibi@fz-juelich.de>
Date: Thu, 7 Sep 2017 16:29:04 +0200
Subject: [PATCH] Add Debug informations

---
 CMakeLists.txt                          |  1 +
 demos/T-Junction/ini_KO_240_050_240.xml |  2 +-
 demos/corridor_JPScore/ini_Aufgabe2.xml |  6 +++---
 main.cpp                                |  6 +-----
 methods/Method_A.cpp                    |  2 +-
 methods/Method_D.cpp                    | 16 ++++++++--------
 methods/PedData.cpp                     | 16 ++++++++++++++--
 scripts/_Plot_cell_rho.py               |  5 ++++-
 scripts/_Plot_cell_v.py                 |  6 +++++-
 9 files changed, 38 insertions(+), 22 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 38a02bb0..8fe7afaa 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -94,6 +94,7 @@ if(BUILD_TESTING)
 endif(BUILD_TESTING)
 
 set(source_files
+  getRSS.c
   Analysis.cpp
   IO/OutputHandler.cpp
   general/ArgumentParser.cpp
diff --git a/demos/T-Junction/ini_KO_240_050_240.xml b/demos/T-Junction/ini_KO_240_050_240.xml
index e9f699f7..88fb87f3 100644
--- a/demos/T-Junction/ini_KO_240_050_240.xml
+++ b/demos/T-Junction/ini_KO_240_050_240.xml
@@ -8,7 +8,7 @@
 		<file name="traj_KO_240_050_240_x.txt" />
 		<path location="./" />  
 	</trajectories>
-	<!----give relative path based on the location inifile or give the absolute path--->
+	<!-- give relative path based on the location inifile or give the absolute path- -->
 	<scripts location="../../scripts/"/> 
 
 	
diff --git a/demos/corridor_JPScore/ini_Aufgabe2.xml b/demos/corridor_JPScore/ini_Aufgabe2.xml
index 2153130a..7cfc5703 100644
--- a/demos/corridor_JPScore/ini_Aufgabe2.xml
+++ b/demos/corridor_JPScore/ini_Aufgabe2.xml
@@ -4,9 +4,9 @@
 	<geometry file = "geo_Aufgabe2.xml" />
 	<!-- trajectories file and format -->
 	<!-- either a file name or a path location. In the latter case all files in the directory will be used-->
-	<trajectories format="xml" unit="m">
-		<file name="traj_Aufgabe2.xml" />
-		<path location="./" />  
+	<trajectories format="txt" unit="m">
+		<!-- <file name="traj_Aufgabe2.xml" /> -->
+		<path location="traj" /> 
 	</trajectories>
 	<!-- give relative path based on the location inifile or give the absolute path- -->
 	<scripts location="../../scripts/"/> 
diff --git a/main.cpp b/main.cpp
index 65a8328b..d02f6309 100644
--- a/main.cpp
+++ b/main.cpp
@@ -25,11 +25,7 @@
  *
  * Some useful links:
  *
- * 	1: <a href="http://www.openpedsim.org">www.openpedsim.org</a> <br>
- * 	2: <a href="http://www.vtk.org">www.vtk.org</a> <br>
- * 	3: <a href="http://www.trolltech.com">www.trolltech.com</a> <br>
- * 	4: <a href="http://www.fz-juelich.de">www.fz-juelich.de</a> <br>
- * 	4: <a href="http://www.jupedsim.org">www.fz-juelich.de</a> <br>
+ * 	1: <a href="http://jupedsim.org">jupedsim.org</a> <br>
  *
  **/
 
diff --git a/methods/Method_A.cpp b/methods/Method_A.cpp
index 480e3104..1c9d9b03 100644
--- a/methods/Method_A.cpp
+++ b/methods/Method_A.cpp
@@ -105,7 +105,7 @@ bool Method_A::Process (const PedData& peddata,const string& scriptsLocation, co
      }
      else
      {
-    	 Log->Write("Warning: No any pedestrian exists on the plane of the selected Measurement area!!");
+    	 Log->Write("Warning: No pedestrian exists on the plane of the selected Measurement area!!");
      }
      delete []_passLine;
      return true;
diff --git a/methods/Method_D.cpp b/methods/Method_D.cpp
index cbe274c0..e3349e06 100644
--- a/methods/Method_D.cpp
+++ b/methods/Method_D.cpp
@@ -457,14 +457,14 @@ void Method_D::OutputVoroGraph(const string & frameId, vector<polygon_2d>& polyg
 
      if(_plotVoronoiCellData)
      {
-    	 string parameters_rho="python "+_scriptsLocation+"/_Plot_cell_rho.py -f \""+ voronoiLocation + "\" -n "+ _trajName+"_id_"+_measureAreaId+"_"+frameId+
-				 " -g "+_geometryFileName+" -p "+_trajectoryPath;
-		 string parameters_v="python "+_scriptsLocation+"/_Plot_cell_v.py -f \""+ voronoiLocation + "\" -n "+ _trajName+"_id_"+_measureAreaId+"_"+frameId+
-					 " -g "+_geometryFileName+" -p "+_trajectoryPath;
-		 //Log->Write("INFO:\t%s",parameters_rho.c_str());
-		 Log->Write("INFO:\tPlotting Voronoi Cell at the frame <%s>",frameId.c_str());
-		 system(parameters_rho.c_str());
-		 system(parameters_v.c_str());
+          string parameters_rho="python "+_scriptsLocation+"/_Plot_cell_rho.py -f \""+ voronoiLocation + "\" -n "+ _trajName+"_id_"+_measureAreaId+"_"+frameId+
+               " -g "+_geometryFileName+" -p "+_trajectoryPath;
+          string parameters_v="python "+_scriptsLocation+"/_Plot_cell_v.py -f \""+ voronoiLocation + "\" -n "+ _trajName+"_id_"+_measureAreaId+"_"+frameId+
+               " -g "+_geometryFileName+" -p "+_trajectoryPath;
+          Log->Write("INFO:\t%s",parameters_rho.c_str());
+          Log->Write("INFO:\tPlotting Voronoi Cell at the frame <%s>",frameId.c_str());
+          system(parameters_rho.c_str());
+          system(parameters_v.c_str());
      }
      //points.close();
      polys.close();
diff --git a/methods/PedData.cpp b/methods/PedData.cpp
index 999ebe7e..abab8451 100644
--- a/methods/PedData.cpp
+++ b/methods/PedData.cpp
@@ -35,6 +35,7 @@ using std::map;
 using std::vector;
 using std::ifstream;
 
+#include "getRSS.c"
 
 PedData::PedData()
 {
@@ -55,9 +56,9 @@ bool PedData::ReadData(const string& projectRootDir, const string& path, const s
      _projectRootDir = projectRootDir;
      _trajName = filename;
 
-     string fullTrajectoriesPathName= path+"./"+_trajName;
+     string fullTrajectoriesPathName= path+ "/" +_trajName;
      Log->Write("INFO:\tthe name of the trajectory is: <%s>",_trajName.c_str());
-
+     Log->Write("INFO:\tfull name of the trajectory is: <%s>",fullTrajectoriesPathName.c_str());
      bool result=true;
      if(trajformat == FORMAT_XML_PLAIN)
      {
@@ -78,6 +79,7 @@ bool PedData::ReadData(const string& projectRootDir, const string& path, const s
      return result;
 }
 
+// init _xCor, _yCor and _zCor
 bool PedData::InitializeVariables(const string& filename)
 {
      vector<double> xs;
@@ -672,12 +674,22 @@ void PedData::CreateGlobalVariables(int numPeds, int numFrames)
      Log->Write("INFO: Enter CreateGlobalVariables with numPeds=%d and numFrames=%d", numPeds, numFrames);
      Log->Write("INFO: allocate memory for xCor");
      _xCor = ub::matrix<double>(numPeds, numFrames);
+     size_t currentSize = getCurrentRSS( )/1000000;
+     size_t peakSize    = getPeakRSS( )/1000000;
+     std::cout << "currentSize: " << currentSize  <<" (MB)" << std::endl;
+     std::cout << "peakSize: " << peakSize << " (MB)" << std::endl;
      Log->Write("INFO: allocate memory for yCor");
      _yCor = ub::matrix<double>(numPeds, numFrames);
+     std::cout << "currentSize: " << currentSize  <<" (MB)" << std::endl;
+     std::cout << "peakSize: " << peakSize << " (MB)" << std::endl;
      Log->Write("INFO: allocate memory for zCor");
      _zCor = ub::matrix<double>(numPeds, numFrames);
+     std::cout << "currentSize: " << currentSize  <<" (MB)" << std::endl;
+     std::cout << "peakSize: " << peakSize << " (MB)" << std::endl;
      Log->Write("INFO: allocate memory for vComp");
      _vComp = ub::matrix<std::string>(numPeds, numFrames);
+     std::cout << "currentSize: " << currentSize  <<" (MB)" << std::endl;
+     std::cout << "peakSize: " << peakSize << " (MB)" << std::endl;
      Log->Write(" Finished memory allocation");   
      _firstFrame = new int[numPeds];  // Record the first frame of each pedestrian
      _lastFrame = new int[numPeds];  // Record the last frame of each pedestrian
diff --git a/scripts/_Plot_cell_rho.py b/scripts/_Plot_cell_rho.py
index 2f3392a8..91089565 100644
--- a/scripts/_Plot_cell_rho.py
+++ b/scripts/_Plot_cell_rho.py
@@ -150,7 +150,10 @@ if __name__ == '__main__':
    geoLocation = filepath.split("Output")[0]
    trajName = namefile.split(".")[0]
    trajType = namefile.split(".")[1].split("_")[0]
-   trajFile = trajpath+trajName+"."+trajType
+   trajFile = os.path.join(trajpath, trajName+"."+trajType) #trajpath+trajName+"."+trajType
+   print(">> plot_cell_rho trajpath %s" %trajpath)
+   print(">> plot_cell_rho  trajName %s"%trajName+"."+trajType)
+   print(">> plot_cell_rho trajFile %s" % trajFile)
    frameNr=int(namefile.split("_")[-1])
    geominX, geomaxX, geominY, geomaxY = get_geometry_boundary(geoFile)
    
diff --git a/scripts/_Plot_cell_v.py b/scripts/_Plot_cell_v.py
index 47004975..cb11ed1d 100644
--- a/scripts/_Plot_cell_v.py
+++ b/scripts/_Plot_cell_v.py
@@ -32,7 +32,11 @@ if __name__ == '__main__':
    geoLocation = filepath.split("Output")[0]
    trajName = namefile.split(".")[0]
    trajType = namefile.split(".")[1].split("_")[0]
-   trajFile = trajpath+trajName+"."+trajType
+   trajFile = os.path.join(trajpath, trajName+"."+trajType)
+   print(">> plot_cell_rho trajpath %s" %trajpath)
+   print(">> plot_cell_rho  trajName %s"%trajName+"."+trajType)
+   print(">> plot_cell_rho trajFile %s" % trajFile)
+
    frameNr=int(namefile.split("_")[-1])
    geominX, geomaxX, geominY, geomaxY = get_geometry_boundary(geoFile)
 
-- 
GitLab