Commit 4a10c8e9 authored by Ulrich Kemloh's avatar Ulrich Kemloh

Merge remote-tracking branch 'origin/v0.5' into hotfixmerge

Conflicts:
	CMakeLists.txt
	Simulation.cpp
	Simulation.h
	events/EventManager.cpp
	general/ArgumentParser.cpp
	general/ArgumentParser.h
	general/Macros.h
	geometry/Building.cpp
	geometry/Building.h
	main.cpp
	math/ForceModel.cpp
	math/ForceModel.h
	math/ODESolver.cpp
	math/ODESolver.h
	mpi/LCGrid.cpp
	mpi/LCGrid.h
	pedestrian/Pedestrian.cpp
	pedestrian/Pedestrian.h
parents 1ec4a6c2 439a2b42
......@@ -3,6 +3,9 @@
/bin/
/Debug
/Release
/doc/html
/figs
/inputfiles
*~
# Compiled Object files
......@@ -37,3 +40,12 @@ install_manifest.txt
CTestTestfile.cmake
DartConfiguration.tcl
vgcore.*
/d
/figs/*
/TAGS
/math/test.cpp
/.dir-locals.el
/Doxyfile
/*log*
/*plot*
\ No newline at end of file
......@@ -147,6 +147,8 @@ set ( source_files
math/Mathematics.cpp
math/ODESolver.cpp
math/GPU_GCFMModel.cpp
math/GCFMModel.cpp
math/GompertzModel.cpp
mpi/LCGrid.cpp
......@@ -258,6 +260,8 @@ set ( header_files
math/Mathematics.h
math/ODESolver.h
math/GPU_GCFMModel.cpp
math/GCFMModel.h
math/GompertzModel.h
poly2tri/poly2tri.h
poly2tri/common/shapes.h
......
......@@ -26,7 +26,7 @@ DOXYFILE_ENCODING = UTF-8
# identify the project. Note that if you do not use Doxywizard you need
# to put quotes around the project name if it contains spaces.
PROJECT_NAME =
PROJECT_NAME = jpscore
# The PROJECT_NUMBER tag can be used to enter a project or revision number.
# This could be handy for archiving the generated documentation or
......@@ -38,21 +38,21 @@ PROJECT_NUMBER = 0.4
# for a project that appears at the top of each page and should give viewer
# a quick idea about the purpose of the project. Keep the description short.
PROJECT_BRIEF =
PROJECT_BRIEF = "Force-based Framework for simulation of pedestrian dynamics"
# With the PROJECT_LOGO tag one can specify an logo or icon that is
# included in the documentation. The maximum height of the logo should not
# exceed 55 pixels and the maximum width should not exceed 200 pixels.
# Doxygen will copy the logo to the output directory.
PROJECT_LOGO = /home/piccolo/workspace/JuPedSim/manuals/figures/logo.png
PROJECT_LOGO = doc/logo.png
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
# base path where the generated documentation will be put.
# If a relative path is entered, it will be relative to the location
# where doxygen was started. If left blank the current directory will be used.
OUTPUT_DIRECTORY = /home/piccolo/workspace/JPSgcfm/doc
OUTPUT_DIRECTORY = doc
# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
# 4096 sub-directories (in 2 levels) under the output directory of each output
......@@ -194,7 +194,7 @@ SEPARATE_MEMBER_PAGES = NO
# The TAB_SIZE tag can be used to set the number of spaces in a tab.
# Doxygen uses this value to replace tabs by spaces in code fragments.
TAB_SIZE = 8
TAB_SIZE = 4
# This tag can be used to specify a number of aliases that acts
# as commands in the documentation. An alias has the form "name=value".
......@@ -361,12 +361,12 @@ EXTRACT_ALL = YES
# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
# will be included in the documentation.
EXTRACT_PRIVATE = NO
EXTRACT_PRIVATE = YES
# If the EXTRACT_STATIC tag is set to YES all static members of a file
# will be included in the documentation.
EXTRACT_STATIC = NO
EXTRACT_STATIC = YES
# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
# defined locally in source files will be included in the documentation.
......@@ -423,7 +423,7 @@ HIDE_IN_BODY_DOCS = NO
# to NO (the default) then the documentation will be excluded.
# Set it to YES to include the internal documentation.
INTERNAL_DOCS = NO
INTERNAL_DOCS = YES
# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
# file names in lower-case letters. If set to YES upper-case letters are also
......@@ -657,7 +657,7 @@ WARN_LOGFILE =
# directories like "/usr/src/myproject". Separate the files or directories
# with spaces.
INPUT = /home/piccolo/workspace/JPSgcfm
INPUT = @CMAKE_CURRENT_SOURCE_DIR@
# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
......@@ -734,7 +734,7 @@ EXCLUDE_SYMLINKS = NO
# against the file with absolute path, so to exclude all test directories
# for example use the pattern */test/*
EXCLUDE_PATTERNS = */testings/* */scripts/* */samples/* */inputfiles/* */outputfiles/* */Debug/* */Release/* */build/* */MCD/*
EXCLUDE_PATTERNS = */Utest* */testings/* */scripts/* */samples/* */inputfiles/* */outputfiles/* */Debug/* */Release/* */build/* */MCD/*
# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
# (namespaces, classes, functions, etc.) that should be excluded from the
......@@ -1184,7 +1184,7 @@ EXT_LINKS_IN_WINDOW = NO
# to manually remove any form_*.png images from the HTML output directory
# to force them to be regenerated.
FORMULA_FONTSIZE = 10
FORMULA_FONTSIZE = 16
# Use the FORMULA_TRANPARENT tag to determine whether or not the images
# generated for formulas are transparent PNGs. Transparent PNGs are
......
This diff is collapsed.
/**
* File: IODispatcher.h
* @file IODispatcher.h
*
* Created on 20. November 2010, 15:20
* @date Created on 20. November 2010, 15:20
*
*
* @section LICENSE
......@@ -27,7 +27,7 @@
*/
#ifndef _IODISPATCHER_H
#define _IODISPATCHER_H
#define _IODISPATCHER_H
#include "OutputHandler.h"
#include "../geometry/Building.h"
......@@ -39,34 +39,34 @@ extern OutputHandler* Log;
class IODispatcher {
private:
std::vector<OutputHandler* > pHandlers;
std::string WritePed(Pedestrian* ped);
std::vector<OutputHandler* > pHandlers;
std::string WritePed(Pedestrian* ped);
public:
IODispatcher();
IODispatcher(const IODispatcher& orig);
virtual ~IODispatcher();
void AddIO(OutputHandler* ioh);
const std::vector<OutputHandler*>& GetIOHandlers();
void Write(const std::string& str);
virtual void WriteHeader(int nPeds, double fps, Building* building, int seed);
virtual void WriteGeometry(Building* building);
virtual void WriteFrame(int frameNr, Building* building);
virtual void WriteFooter();
int AreaLevel(std::string caption);
template<typename A>
bool IsElementInVector(const std::vector<A> &vec, A& el) {
typename std::vector<A>::const_iterator it;
it = std::find (vec.begin(), vec.end(), el);
if(it==vec.end()){
return false;
}else{
return true;
}
}
IODispatcher();
IODispatcher(const IODispatcher& orig);
virtual ~IODispatcher();
void AddIO(OutputHandler* ioh);
const std::vector<OutputHandler*>& GetIOHandlers();
void Write(const std::string& str);
virtual void WriteHeader(int nPeds, double fps, Building* building, int seed);
virtual void WriteGeometry(Building* building);
virtual void WriteFrame(int frameNr, Building* building);
virtual void WriteFooter();
int AreaLevel(std::string caption);
template<typename A>
bool IsElementInVector(const std::vector<A> &vec, A& el) {
typename std::vector<A>::const_iterator it;
it = std::find (vec.begin(), vec.end(), el);
if(it==vec.end()) {
return false;
} else {
return true;
}
}
};
......@@ -75,43 +75,52 @@ public:
class TrajectoriesFLAT:public IODispatcher {
public:
TrajectoriesFLAT();
virtual ~TrajectoriesFLAT(){};
TrajectoriesFLAT();
virtual ~TrajectoriesFLAT() {};
virtual void WriteHeader(int nPeds, double fps, Building* building, int seed);
virtual void WriteGeometry(Building* building);
virtual void WriteFrame(int frameNr, Building* building);
virtual void WriteFooter();
virtual void WriteHeader(int nPeds, double fps, Building* building, int seed);
virtual void WriteGeometry(Building* building);
virtual void WriteFrame(int frameNr, Building* building);
virtual void WriteFooter();
};
class TrajectoriesVTK:public IODispatcher {
public:
TrajectoriesVTK();
virtual ~TrajectoriesVTK(){};
TrajectoriesVTK();
virtual ~TrajectoriesVTK() {};
virtual void WriteHeader(int nPeds, double fps, Building* building, int seed);
virtual void WriteGeometry(Building* building);
virtual void WriteFrame(int frameNr, Building* building);
virtual void WriteFooter();
virtual void WriteHeader(int nPeds, double fps, Building* building, int seed);
virtual void WriteGeometry(Building* building);
virtual void WriteFrame(int frameNr, Building* building);
virtual void WriteFooter();
};
class TrajectoriesXML_MESH:public IODispatcher {
public:
TrajectoriesXML_MESH(){};
virtual ~TrajectoriesXML_MESH(){};
TrajectoriesXML_MESH() {};
virtual ~TrajectoriesXML_MESH() {};
//virtual void WriteHeader(int nPeds, double fps, Building* building, int seed);
//virtual void WriteFrame(int frameNr, Building* building);
//virtual void WriteFooter();
virtual void WriteGeometry(Building* building);
//virtual void WriteHeader(int nPeds, double fps, Building* building, int seed);
//virtual void WriteFrame(int frameNr, Building* building);
//virtual void WriteFooter();
virtual void WriteGeometry(Building* building);
};
class TrajectoriesJPSV06: public IODispatcher {
public:
TrajectoriesJPSV06() {};
virtual ~TrajectoriesJPSV06() {};
#endif /* _IODISPATCHER_H */
virtual void WriteHeader(int nPeds, double fps, Building* building, int seed);
virtual void WriteGeometry(Building* building);
virtual void WriteFrame(int frameNr, Building* building);
virtual void WriteFooter();
};
#endif /* _IODISPATCHER_H */
/**
* File: OutputHandler.cpp
* @file: OutputHandler.cpp
*
* Created on 20. November 2010, 15:20
* @date Created on 20. November 2010, 15:20
*
* @section LICENSE
* This file is part of JuPedSim.
......@@ -33,96 +33,147 @@
using namespace std;
void OutputHandler::Write(string str) {
if (this != NULL)
cout << str << endl;
void OutputHandler::incrementWarnings()
{
nWarnings += 1;
}
void OutputHandler::Write(const char* message,...) {
char msg[CLENGTH];
va_list ap;
va_start (ap, message);
vsprintf (msg,message ,ap);
va_end (ap);
string str(msg);
if(str.find("ERROR")==string::npos) {
cout<<msg<<endl;
cout.flush();
}
else {
cerr<<msg<<endl;
cerr.flush();
}
//cout << "\033[1;30mbold red text\033[0m\n";
//cout << "\033[1;31"<<msg<<"\033[0m\n";
//cout << "\033[1;31 bla bla \033[0m\n";
int OutputHandler::GetWarnings()
{
return nWarnings;
}
void STDIOHandler::Write(string str) {
if (this != NULL)
cout << str << endl;
void OutputHandler::incrementErrors()
{
nErrors += 1;
}
FileHandler::FileHandler(const char *fn) {
pfp.open(fn);
if (!fn) {
char tmp[CLENGTH];
sprintf(tmp, "Error!!! File [%s] could not be opened!", fn);
cerr << tmp << endl;
exit(0);
}
int OutputHandler::GetErrors()
{
return nErrors;
}
FileHandler::~FileHandler() {
pfp.close();
void OutputHandler::Write(string str)
{
if (this != NULL)
cout << str << endl;
}
void FileHandler::Write(string str) {
if (this != NULL) {
pfp << str << endl;
pfp.flush();
}
#include<math.h>
void OutputHandler::ProgressBar(double TotalPeds, double NowPeds)
{
// based on this answer:
// https://stackoverflow.com/questions/1637587/c-libcurl-console-progress-bar
// how wide you want the progress meter to be
int totaldotz=40;
double fraction = NowPeds / TotalPeds;
// part of the progressmeter that's already "full"
int dotz = round(fraction * totaldotz);
// create the "meter"
int ii=0;
printf("Evacuation: %3.0f%% [",fraction*100);
// part that's full already
for ( ; ii < dotz; ii++) {
printf("=");
}
printf(">");
// remaining part (spaces)
for ( ; ii < totaldotz;ii++) {
printf(" ");
}
// and back to line begin - do not forget the fflush to avoid output buffering problems!
printf("]\r");
fflush(stdout);
}
void FileHandler::Write(const char* string,...) {
char msg[CLENGTH];
va_list ap;
va_start (ap, string);
vsprintf (msg,string ,ap);
va_end (ap);
pfp<<msg<<endl;
pfp.flush();
void OutputHandler::Write(const char* message,...)
{
char msg[CLENGTH];
va_list ap;
va_start (ap, message);
vsprintf (msg, message, ap);
va_end (ap);
string str(msg);
if(str.find("ERROR") == string::npos) {
cout<<msg<<endl;
cout.flush();
incrementErrors();
} else { // Warning
cerr<<msg<<endl;
cerr.flush();
incrementWarnings();
}
}
TraVisToHandler::TraVisToHandler(string host, int port) {
client = new TraVisToClient(host, port);
brokentags.push_back("<trajectoriesDataset>");
brokentags.push_back("</trajectoriesDataset>");
brokentags.push_back("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
void STDIOHandler::Write(string str)
{
if (this != NULL)
cout << str << endl;
}
TraVisToHandler::~TraVisToHandler(){
delete client;
FileHandler::FileHandler(const char *fn)
{
pfp.open(fn);
if (!fn) {
char tmp[CLENGTH];
sprintf(tmp, "Error!!! File [%s] could not be opened!", fn);
cerr << tmp << endl;
exit(0);
}
}
void TraVisToHandler::Write(string str) {
FileHandler::~FileHandler()
{
pfp.close();
}
vector<string>::iterator str_it;
void FileHandler::Write(string str)
{
if (this != NULL) {
pfp << str << endl;
pfp.flush();
}
}
//There are a few broken tags which need to be checked for and removed.
for (str_it = brokentags.begin(); str_it != brokentags.end(); ++str_it) {
int tagstart = str.find(*str_it);
if (tagstart != (int) string::npos) {
str.erase(str.begin() + tagstart, str.begin() + tagstart + (*str_it).size());
}
}
client->sendData(str.c_str());
void FileHandler::Write(const char* string,...)
{
char msg[CLENGTH];
va_list ap;
va_start (ap, string);
vsprintf (msg,string ,ap);
va_end (ap);
pfp<<msg<<endl;
pfp.flush();
}
TraVisToHandler::TraVisToHandler(string host, int port)
{
client = new TraVisToClient(host, port);
brokentags.push_back("<trajectories>");
brokentags.push_back("</trajectories>");
brokentags.push_back("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
}
TraVisToHandler::~TraVisToHandler()
{
delete client;
}
void TraVisToHandler::Write(string str)
{
vector<string>::iterator str_it;
//There are a few broken tags which need to be checked for and removed.
for (str_it = brokentags.begin(); str_it != brokentags.end(); ++str_it) {
int tagstart = str.find(*str_it);
if (tagstart != (int) string::npos) {
str.erase(str.begin() + tagstart, str.begin() + tagstart + (*str_it).size());
}
}
client->sendData(str.c_str());
}
/**
* File: OutputHandler.h
* @file OutputHandler.h
*
* Created on 20. November 2010, 15:20
* @date Created on 20. November 2010, 15:20
*
* @section LICENSE
* This file is part of JuPedSim.
......@@ -37,43 +37,50 @@
#include "../general/Macros.h"
class OutputHandler {
protected:
int nWarnings;
int nErrors;
public:
virtual void Write(std::string str);
virtual void Write(const char *string, ...);
virtual ~OutputHandler(){};
OutputHandler() { nWarnings = 0; nErrors = 0; };
int GetWarnings();
void incrementWarnings();
int GetErrors();
void incrementErrors();
void ProgressBar(double TotalPeds, double NowPeds);
virtual void Write(std::string str);
virtual void Write(const char *string, ...);
virtual ~OutputHandler() {};
};
class STDIOHandler : public OutputHandler {
public:
void Write(std::string str);
void Write(std::string str);
};
class FileHandler : public OutputHandler {
private:
std::ofstream pfp;
std::ofstream pfp;
public:
FileHandler(const char *fn);
virtual ~FileHandler();
void Write(std::string str);
void Write(const char *string,...);
FileHandler(const char *fn);
virtual ~FileHandler();
void Write(std::string str);
void Write(const char *string,...);
};
class TraVisToHandler : public OutputHandler {
private:
TraVisToClient* client;
TraVisToClient* client;
public:
TraVisToHandler(std::string host, int port);
virtual ~TraVisToHandler();
void Write(std::string str);
TraVisToHandler(std::string host, int port);
virtual ~TraVisToHandler();
void Write(std::string str);
//Some tags are broken
std::vector<std::string> brokentags;
//Some tags are broken
std::vector<std::string> brokentags;
};
#endif /*OUTPUT_HANDLER_H_*/
This diff is collapsed.
......@@ -93,56 +93,56 @@ typedef int socket_t;
class TraVisToClient {
public:
/// create a client with specific parameters
TraVisToClient(std::string hostname = HOST, unsigned short port = PORT);
/// create a client with specific parameters
TraVisToClient(std::string hostname = HOST, unsigned short port = PORT);
/// Destructor
virtual ~TraVisToClient();
/// Destructor
virtual ~TraVisToClient();
/// send datablock to the server
/// this functions is still blocking unfortunately, so it may
/// influence the execution time of your program
void sendData(const char* data);
/// send datablock to the server
/// this functions is still blocking unfortunately, so it may
/// influence the execution time of your program
void sendData(const char* data);
/// close the client (end the connection)
void close();
/// close the client (end the connection)
void close();
/// send a datagram using the unreliable
/// udp protokoll