Commit d9a7b185 authored by Mohcine Chraibi's avatar Mohcine Chraibi

Formatting Code

The goal of this commit is always to make  diffs unambiguous by
2. Untabifying all files
1. Indent all files by using 4 spaces

Please adapt you editor so that it uses NO tabs  and only 4 spaces for indenting
parent 7c16ba28
......@@ -2,6 +2,7 @@
# -DCMAKE_CXX_COMPILER:STRING=clang++ -DCMAKE_C_COMPILER:STRING=clang .
# -DCMAKE_BUILD_TYPE:STRING=Debug (default Release)
# -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON (default OFF)
# -DBUILD_TESTING=ON (default OFF)
#--------------------------------------------------------------------------
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
......@@ -16,12 +17,11 @@ set(JPSCORE_VERSION
${JPSCORE_MAJOR_VERSION}.${JPSCORE_MINOR_VERSION}.${JPSCORE_PATCH_VERSION})
message( STATUS "JPSCORE_VERSION: " ${JPSCORE_VERSION} )
# # configure_file (
# # "${CMAKE_SOURCE_DIR}/Config.h.in"
# # "${CMAKE_BINARY_DIR}/Config.h"
# # )
# #include_directories ("${CMAKE_BINARY_DIR}")
if(NOT BUILD_TESTING)
set(BUILD_TESTING OFF)
endif(NOT BUILD_TESTING)
message( STATUS "BUILD_TESTING: " ${BUILD_TESTING} )
if(NOT DEFINED PROCESSOR_COUNT)
# Unknown:
set(PROCESSOR_COUNT 0)
......@@ -33,15 +33,6 @@ if(NOT DEFINED PROCESSOR_COUNT)
list(LENGTH procs PROCESSOR_COUNT)
endif(EXISTS "${cpuinfo_file}")
# Mac:
# if(APPLE)
# find_program(cmd_sys_pro "system_profiler")
# if(cmd_sys_pro)
# execute_process(COMMAND ${cmd_sys_pro} OUTPUT_VARIABLE info)
# string(REGEX REPLACE "^.*Total Number Of Cores: ([0-9]+).*$" "\\1"
# PROCESSOR_COUNT "${info}")
# endif(cmd_sys_pro)
# endif(APPLE)
# Windows:
if(WIN32)
......@@ -50,8 +41,6 @@ if(NOT DEFINED PROCESSOR_COUNT)
endif(NOT DEFINED PROCESSOR_COUNT)
if(PROCESSOR_COUNT)
# add 1 should be magic! http://www.kitware.com/blog/home/post/63
#math(EXPR PROCESSOR_COUNT "${PROCESSOR_COUNT} + 1")
message( STATUS "PROCESSOR_COUNT: " ${PROCESSOR_COUNT})
set(CTEST_BUILD_FLAGS "-j${PROCESSOR_COUNT}")
endif(PROCESSOR_COUNT)
......@@ -105,7 +94,6 @@ if(CGAL_FOUND)
include (${CGAL_USE_FILE})
INCLUDE_DIRECTORIES(${CGAL_CORE_INCLUDE_DIR})
add_definitions(-D_CGAL=1)
target_link_libraries (jpscore ${CGAL_CORE_LIBRARY})
message (SEND_ERROR "${CGAL_FOUND}")
message (FATAL_ERROR "${CGAL_CORE_INCLUDE_DIR}")
message (SEND_ERROR " Erreur: ${CGAL_FOUND}")
......@@ -115,7 +103,10 @@ else(CGAL_FOUND)
endif(CGAL_FOUND)
# test files: all cpp-files in Utest
file(GLOB test_files "${CMAKE_TEST_DIR}/*.cpp")
if(BUILD_TESTING)
file(GLOB test_files "${CMAKE_TEST_DIR}/*.cpp")
endif(BUILD_TESTING)
set ( source_files
main.cpp
Simulation.cpp
......@@ -269,7 +260,7 @@ set ( header_files
add_library ( core SHARED ${source_files} )
#add_library(core OBJECT ${source_files} ${header_files})
#Target
add_executable(
jpscore main.cpp
......@@ -303,11 +294,12 @@ else(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_BUILD_TYPE MATCHES Debug)
endif(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_BUILD_TYPE MATCHES Debug)
# ----------------------------- cTest ------------------------------------------
enable_testing() #adds another build target, which is test for Makefile generators
include(CTest) #adding Dart support
if(BUILD_TESTING)
enable_testing() #adds another build target, which is test for Makefile generators
include(CTest) #adding Dart support
#test if code compiles and runs default setting. Takes about 30 seconds
add_test (jpscore_compile ${CMAKE_CTEST_COMMAND}
#test if code compiles and runs default setting. Takes about 30 seconds
add_test (jpscore_compile ${CMAKE_CTEST_COMMAND}
--build-and-test "${CMAKE_SOURCE_DIR}" "${EXECUTABLE_OUTPUT_PATH}" #"${CMAKE_BINARY_DIR}"
--build-generator ${CMAKE_GENERATOR}
--build-makeprogram ${CMAKE_MAKE_PROGRAM} -j${PROCESSOR_COUNT}
......@@ -317,19 +309,18 @@ add_test (jpscore_compile ${CMAKE_CTEST_COMMAND}
--test-command jpscore --ini=${CMAKE_SOURCE_DIR}/inputfiles/Default/ini.xml
)
foreach (test_src ${test_files})
foreach (test_src ${test_files})
GET_FILENAME_COMPONENT(test ${test_src} NAME_WE)
add_executable( ${test} ${test_src})
target_link_libraries (${test} core)
add_test(NAME ${test} COMMAND ${test})
endforeach(test_src ${test_files})
endforeach(test_src ${test_files})
find_package(PythonInterp)
if(PYTHONINTERP_FOUND)
find_package(PythonInterp)
if(PYTHONINTERP_FOUND)
message(STATUS "Found Python: " ${PYTHON_EXECUTABLE})
message(STATUS "run: " ${CMAKE_SOURCE_DIR}/Utest/testflow.py)
set (test_parameters "${CMAKE_SOURCE_DIR}")
add_test(NAME flow COMMAND "${CMAKE_TEST_DIR}/testflow.py" "${test_parameters}")
#add_test(testtime "${CMAKE_SOURCE_DIR}/Utest/run.py")
endif(PYTHONINTERP_FOUND)
endif(PYTHONINTERP_FOUND)
endif(BUILD_TESTING)
......@@ -38,11 +38,11 @@
extern OutputHandler* Log;
class IODispatcher {
private:
private:
std::vector<OutputHandler* > pHandlers;
std::string WritePed(Pedestrian* ped);
public:
public:
IODispatcher();
IODispatcher(const IODispatcher& orig);
virtual ~IODispatcher();
......@@ -74,7 +74,7 @@ public:
class TrajectoriesFLAT:public IODispatcher {
public:
public:
TrajectoriesFLAT();
virtual ~TrajectoriesFLAT(){};
......@@ -87,7 +87,7 @@ public:
class TrajectoriesVTK:public IODispatcher {
public:
public:
TrajectoriesVTK();
virtual ~TrajectoriesVTK(){};
......@@ -100,7 +100,7 @@ public:
class TrajectoriesXML_MESH:public IODispatcher {
public:
public:
TrajectoriesXML_MESH(){};
virtual ~TrajectoriesXML_MESH(){};
......@@ -113,7 +113,7 @@ public:
class TrajectoriesJPSV06: public IODispatcher {
public:
public:
TrajectoriesJPSV06(){};
virtual ~TrajectoriesJPSV06(){};
......
......@@ -37,22 +37,22 @@
#include "../general/Macros.h"
class OutputHandler {
public:
public:
virtual void Write(std::string str);
virtual void Write(const char *string, ...);
virtual ~OutputHandler(){};
};
class STDIOHandler : public OutputHandler {
public:
public:
void Write(std::string str);
};
class FileHandler : public OutputHandler {
private:
private:
std::ofstream pfp;
public:
public:
FileHandler(const char *fn);
virtual ~FileHandler();
void Write(std::string str);
......@@ -60,10 +60,10 @@ public:
};
class TraVisToHandler : public OutputHandler {
private:
private:
TraVisToClient* client;
public:
public:
TraVisToHandler(std::string host, int port);
virtual ~TraVisToHandler();
void Write(std::string str);
......
......@@ -91,7 +91,7 @@ typedef int socket_t;
#define HOST "localhost"
class TraVisToClient {
public:
public:
/// create a client with specific parameters
TraVisToClient(std::string hostname = HOST, unsigned short port = PORT);
......@@ -111,7 +111,7 @@ public:
/// udp protokoll
void sendDatagram(char *datagram);
private:
private:
void createConnection();
unsigned long lookupHostAddress(const char *hostName);
......@@ -132,12 +132,12 @@ private:
bool _startWin32SocketSession(void);
void _stopWin32SocketSession(void);
#else
#define closesocket close
#define closesocket close
#endif
private:
private:
bool _isConnected;
socket_t _tcpSocket;
std::string _hostname;
......
......@@ -51,7 +51,7 @@
extern OutputHandler* Log;
class Simulation {
private:
private:
///Number of pedestrians in the simulation
int _nPeds;
///Maximum simulation time
......@@ -80,7 +80,7 @@ private:
ArgumentParser* _argsParser;
public:
public:
Simulation();
virtual ~Simulation();
......
......@@ -17,7 +17,7 @@
extern OutputHandler* Log;
class EventManager {
private:
private:
std::vector<double> _event_times;
std::vector<std::string> _event_types;
std::vector<std::string> _event_states;
......@@ -30,7 +30,7 @@ private:
bool _dynamic;
int _eventCounter;
public:
public:
//Konstruktor
EventManager(Building *_b);
//Dateien einlesen
......
......@@ -41,7 +41,7 @@ class OutputHandler;
extern OutputHandler* Log;
class ArgumentParser {
private:
private:
int pModel;
string pHostname;
string pTrajectoriesFile;
......@@ -87,7 +87,7 @@ private:
// private Funktionen
void Usage();
public:
public:
// Konstruktor
ArgumentParser(); // gibt die Programmoptionen aus
......
......@@ -49,7 +49,7 @@ class LCGrid;
class Building {
private:
private:
std::string _caption;
std::string _projectFilename;
std::string _projectRootDir;
......@@ -68,7 +68,7 @@ private:
bool _savePathway;
std::ofstream _pathWayStream;
public:
public:
/// constructor
Building();
/// destructor
......@@ -203,7 +203,7 @@ public:
void SanityCheck();
private:
private:
void StringExplode(std::string str, std::string separator, std::vector<std::string>* results);
};
......
......@@ -36,7 +36,7 @@ class Room;
class SubRoom;
class Crossing : public NavLine {
private:
private:
/// ? unique between crossings and transitions ?
int _id;
/// only one room needed, since a crossing only separates 2 subrooms
......@@ -45,7 +45,7 @@ private:
SubRoom* _subRoom1;
SubRoom* _subRoom2;
public:
public:
Crossing();
virtual ~Crossing();
......
......@@ -37,7 +37,7 @@ class Wall;
class Goal {
private:
private:
int _isFinalGoal;
int _id;
Point _centroid;
......@@ -45,7 +45,7 @@ private:
std::vector<Wall> _walls;
std::vector<Point> _poly;
public:
public:
Goal();
virtual ~Goal();
......@@ -121,7 +121,7 @@ public:
*/
std::string Write();
private:
private:
int WhichQuad(const Point& vertex, const Point& hitPos) const;
// x-Koordinate der Linie von einer Eccke zur nächsten
......
......@@ -38,13 +38,13 @@ class Room;
class Hline: public NavLine {
private:
private:
int _id;
Room* _room;
std::string _caption;
SubRoom* _subRoom;
public:
public:
Hline();
virtual ~Hline();
......
......@@ -40,7 +40,7 @@ extern OutputHandler* Log;
class Line {
private:
private:
Point _point1;
Point _point2;
Point _centre;
......@@ -49,7 +49,7 @@ private:
static int _static_UID;
int _uid;
public:
public:
Line();
Line(const Point& p1, const Point& p2);
......@@ -231,7 +231,7 @@ public:
* @return the angle between two lines
*/
double GetAngle(const Line& l) const;
// double GetAngle(SubRoom s) const;
// double GetAngle(SubRoom s) const;
};
......
......@@ -32,7 +32,7 @@
class NavLine: public Line {
public:
public:
NavLine();
NavLine(Line l);
virtual ~NavLine();
......
......@@ -38,7 +38,7 @@
class Obstacle {
private:
private:
double _isClosed;
double _height;
int _id;
......@@ -46,7 +46,7 @@ private:
std::vector<Wall> _walls;
std::vector<Point> _poly;
public:
public:
Obstacle();
virtual ~Obstacle();
......@@ -134,7 +134,7 @@ public:
*/
std::string Write();
private:
private:
int WhichQuad(const Point& vertex, const Point& hitPos) const;
// x-Koordinate der Linie von einer Eccke zur nächsten
......
......@@ -30,11 +30,11 @@
#include <string>
class Point {
public:
public:
double _x;
double _y;
public:
public:
// constructors
Point();
Point(double x, double y);
......
......@@ -33,7 +33,7 @@
//class SubRoom;
class Room {
private:
private:
/// room ID and index
int _id;
......@@ -50,7 +50,7 @@ private:
/// needed if the trajectories for this room are to be write in a special way
OutputHandler* _outputFile;
public:
public:
Room();
Room(const Room& orig);
virtual ~Room();
......
......@@ -41,16 +41,16 @@ class Obstacle;
class Crossing;
#ifdef _SIMULATOR
class Pedestrian;
class Pedestrian;
#endif
/************************************************************
SubRoom
************************************************************/
************************************************************/
class SubRoom {
private:
private:
/// the id set using the SetID method
int _id;
/// the unique id resulting from the count of all subrooms in the system
......@@ -79,11 +79,11 @@ private:
std::vector<Pedestrian*> _peds; // pedestrians container
#endif
protected:
protected:
std::vector<Wall> _walls;
std::vector<Point> _poly; // Polygonal representation of the subroom
public:
public:
// constructors
SubRoom();
......@@ -335,16 +335,16 @@ public:
/************************************************************
NormalSubroom
************************************************************/
************************************************************/
class NormalSubRoom : public SubRoom {
private:
private:
///@see IsInSubRoom
int WhichQuad(const Point& vertex, const Point& hitPos) const;
double Xintercept(const Point& point1, const Point& point2, double hitY) const;
public:
public:
NormalSubRoom();
NormalSubRoom(const NormalSubRoom& orig);
virtual ~NormalSubRoom();
......@@ -359,15 +359,15 @@ public:
/************************************************************
Stair
************************************************************/
************************************************************/
class Stair : public NormalSubRoom {
private:
private:
Point pUp; /// Punkt der den oberen Bereich der Treppe markiert
Point pDown; /// Punkt der den unteren Bereich der Treppe markiert
const Point* CheckCorner(const Point** otherPoint, const Point** aktPoint, const Point* nextPoint);
public:
public:
Stair();
Stair(const Stair& orig);
virtual ~Stair();
......
......@@ -34,7 +34,7 @@ class Room;
class Subroom;
class Transition : public Crossing {
private:
private:
Room* _room2;
bool _isOpen;
std::string _type;
......@@ -42,7 +42,7 @@ private:
int _doorUsage;
double _lastPassingTime;
public:
public:
Transition();
virtual ~Transition();
......
......@@ -32,7 +32,7 @@
class Wall : public Line {
public:
public:
Wall();
Wall(const Point& p1, const Point& p2);
Wall(const Wall& orig);
......
......@@ -68,8 +68,6 @@ int main(int argc, char **argv) {
time(&starttime);
Log->Write("INFO: \tStart runSimulation()\n");
Simulation sim = Simulation();
sim.InitArgs(args);
int evacTime = sim.RunSimulation();
......
......@@ -33,10 +33,10 @@
class Distribution {
private:
private:
double _mean;
double _sigma;
public:
public:
Distribution();
Distribution(double mean, double sigma);
Distribution(const Distribution& orig);
......@@ -59,12 +59,12 @@ public:
};
class Gauss : public Distribution {
private:
private:
std::vector<double> _queue;
const std::vector<double>& GetQueue() const;
void GetPair();
public:
public:
Gauss();
Gauss(double mean, double sigma);
......@@ -79,9 +79,9 @@ public:
class Equal : public Distribution {
private:
private: