Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
Loading items

Target

Select target project
  • jupedsim/jpsreport
  • chraibi1/jpsreport
2 results
Select Git revision
Loading items
Show changes

Commits on Source 528

428 additional commits have been omitted to prevent performance issues.
# Created by .ignore support plugin (hsz.mobi)
### C template
# Object files
*.o
*.ko
*.obj
*.elf
# Precompiled Headers
*.gch
*.pch
# Libraries
*.lib
*.a
*.la
*.lo
# Shared objects (inc. Windows DLLs)
*.dll
*.so
*.so.*
*.dylib
# Executables
*.exe
*.out
*.app
*.i*86
*.x86_64
*.hex
# Debug files
*.dSYM/
*.su
### C++ template
# Compiled Object files
*.slo
*.lo
*.o
*.obj
# Precompiled Headers
*.gch
*.pch
# Compiled Dynamic libraries
*.so
*.dylib
*.dll
# Fortran module files
*.mod
*.smod
# Compiled Static libraries
*.lai
*.la
*.a
*.lib
# Executables
*.exe
*.out
*.app
### CMake template
CMakeCache.txt
CMakeFiles
CMakeScripts
Makefile
cmake_install.cmake
install_manifest.txt
CTestTestfile.cmake
.gitignore
.idea/
Utest/sample_jpsreport/
bin/
build/
lib/
scripts/overlap.py
scripts/results_rho_v_Voronoi_CROSSING_90_A_07_f_dir/
scripts/rho_v_Voronoi_CROSSING_90_A_07_f_dir.txt_id_1.dat
scripts/stefan copy/
scripts/stefan/
test.py
/Release/
build*
variables:
nproc: "1"
before_script:
- nproc=`grep -c '^processor' /proc/cpuinfo`
- echo "nproc = $nproc"
#========== Pipeline ==================
stages:
- configure
- compile
#=====================================
#============== configure ============
configure-linux:
artifacts:
name: "${CI_BUILD_NAME}_${CI_BUILD_ID}"
expire_in: 1 hour
paths:
- build
- lib
- lib/Debug
- bin
script:
- mkdir -p build
- cd build
- cmake -DCMAKE_BUILD_TYPE=Debug ..
- echo "configure | ${CI_PROJECT_DIR}"
stage: configure
tags:
- linux
#============== compile ============
make-linux:
dependencies:
- configure-linux
artifacts:
name: "${CI_BUILD_NAME}_${CI_BUILD_ID}"
expire_in: 1 hour # optional expiry
paths:
- build
- bin
- lib
- lib/Debug
stage: compile
script:
- cd build
- make -j$nproc
- echo "compile | ${CI_PROJECT_DIR}"
tags:
- linux
after_script:
- echo "End CI" # todo: run report script
JuPedSim contributors:
Andrea Portz
David Haensel
Denis Shhikhalev
Erik Andresen
Jun Zhang
Mohcine Chraibi
Oliver Schmidt
Ulrich Kemloh
This diff is collapsed.
/**
* \file Analysis.h
* \date Oct 10, 2014
* \version v0.7
* \copyright <2009-2015> Forschungszentrum Jülich GmbH. All rights reserved.
*
* \section License
* This file is part of JuPedSim.
*
* JuPedSim is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* JuPedSim is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with JuPedSim. If not, see <http://www.gnu.org/licenses/>.
*
* \section Description
* The Analysis class represents a process of analyzing groups of pedestrian
* trajectories from experiment or simulation. Different measurement methods
* can be used and are defined by various parameters and functions.
*
*
**/
#ifndef ANALYSIS_H_
#define ANALYSIS_H_
#include "general/ArgumentParser.h"
#include "tinyxml/tinyxml.h"
#include "geometry/Building.h"
#include "IO/OutputHandler.h"
#include "general/Macros.h"
#include "methods/PedData.h"
#include <boost/geometry/geometry.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/polygon.hpp>
#include <boost/geometry/geometries/adapted/c_array.hpp>
#include <boost/geometry/geometries/ring.hpp>
using namespace boost::geometry;
typedef model::d2::point_xy<double, cs::cartesian> point_2d;
typedef model::polygon<point_2d> polygon_2d;
typedef model::ring<point_2d> ring;
typedef std::vector<polygon_2d > polygon_list;
typedef boost::geometry::model::segment<boost::geometry::model::d2::point_xy<double> > segment;
#include <map>
#include <vector>
extern OutputHandler* Log;
class Analysis
{
public:
Analysis();
virtual ~Analysis();
void InitArgs(ArgumentParser *args);
void InitializeFiles(const std::string& file);
std::map<int, polygon_2d> ReadGeometry(const fs::path& geometryFile, const std::vector<MeasurementArea_B*>& areas);
/**
* Run the analysis for different files.
* @param file
* @param path
* @return
*/
int RunAnalysis(const fs::path& file, const fs::path& path);
/**
* return the base name from the string.
* // file.txt ---> file
* @param str
*/
std::string GetBasename(const std::string& str);
/**
* extract the filename from the path
* // c:\\windows\\winhelp.exe ---> winhelp.exe
* @param str
*/
std::string GetFilename(const std::string& str);
/**
* create a file and the directory structure if needed.
* @param filename
* @return
*/
static FILE* CreateFile(const std::string& filename);
//TODO: merge apple and linux
#ifdef __linux__
static int mkpath(char* file_path, mode_t mode=0755);
#elif __APPLE__
static int mkpath(char* file_path, mode_t mode=0755);
#else //windows
static int mkpath(char* file_path);
#endif
private:
Building* _building;
//polygon_2d _geoPoly;
std::map<int, polygon_2d> _geoPolyMethodD;
std::map<int, polygon_2d> _geoPolyMethodI;
double _grid_size_X; // the size of the grid
double _grid_size_Y;
double _lowVertexX; // LOWest vertex of the geometry (x coordinate)
double _lowVertexY; // LOWest vertex of the geometry (y coordinate)
double _highVertexX; // Highest vertex of the geometry
double _highVertexY;
int _deltaF; // half of the time interval that used to calculate instantaneous velocity of ped i.
std::vector<int> _deltaT; // the time interval to calculate the classic flow
bool _DoesUseMethodA; // Method A (Zhang2011a)
bool _DoesUseMethodB; // Method B (Zhang2011a)
bool _DoesUseMethodC; // Method C //calculate and save results of classic in separate file
bool _DoesUseMethodD; // Method D--Voronoi method
bool _DoesUseMethodI; // Method I--Voronoi method modified
// no measurement are)
std::vector<int> _StartFramesMethodD;
std::vector<int> _StopFramesMethodD;
std::vector<int> _StartFramesMethodI;
std::vector<int> _StopFramesMethodI;
std::vector<bool> _IndividualFDFlags;
bool _cutByCircle; //Adjust whether cut each original voronoi cell by a circle
double _cutRadius;
int _circleEdges;
bool _getProfile; // Whether make field analysis or not
bool _outputGraph; // Whether output the data for plot the voronoi diagram each frame
bool _plotGraph; // Whether plot the voronoi diagram each
// frame. if (outputGraph==true)
bool _plotIndex; // Whether plot the voronoi diagram each
// frame with index of pedesrians
// if (outputGraph==true and _polotGraph==true)
std::vector<bool> _plotTimeseriesA;
std::vector<bool> _plotTimeseriesC;
std::vector<bool> _plotTimeseriesD;
std::vector<bool> _plotTimeseriesI;
bool _isOneDimensional;
bool _calcIndividualFD; //Adjust whether analyze the individual density and velocity of each pedestrian in stationary state (ALWAYS VORONOI-BASED)
std::string _vComponent; // to mark whether x, y or x and y coordinate are used when calculating the velocity
bool _IgnoreBackwardMovement;
fs::path _projectRootDir;
fs::path _scriptsLocation;
fs::path _outputLocation;
fs::path _geometryFileName;
FileFormat _trajFormat; // format of the trajectory file
std::vector<MeasurementArea_L*> _areaForMethod_A;
std::vector<MeasurementArea_B*> _areaForMethod_B;
std::vector<MeasurementArea_B*> _areaForMethod_C;
std::vector<MeasurementArea_B*> _areaForMethod_D;
std::vector<MeasurementArea_B*> _areaForMethod_I; // we still need to know
// the zpos of the
// measurement are, even
// if we don't use its polygon
};
#endif /*ANALYSIS_H_*/
# Change Log
All notable changes to `jpsreport` will be documented in this file.
## v0.8.4 [TBD]
### Added
- brew install [jpsreport](https://github.com/JuPedSim/homebrew-jps/blob/master/README.md)
- added option --version -version 2e0632be
- Option added to define a customized output directory
```xml
<output location="path/to/directory"/>
```
### Changed
- use c++17 for filesystem functionality !10
- call python detected by cmake 5fb97f32
### Fixed
- Better handling negative frame id 5304efb8
- Fix for polygon output considering interior and exterior rings 361cffdd
- Exit if no measurement area is selected cdf28328
- Exit if no measurement method is selected cdf28328
## v0.8.3 [16.05.2018]
### Added
- Option to output log in a file instead of the screen fe66fa49
```
<logfile>log.txt</logfile>
```
- Output useful debug information like date, git and compiler versions. !6 and discussion in #79
- Option to plot Voronoi diagrams with index instead of little blue circles `plot_index`. Use as:
```xml
<output_voronoi_cells enabled="true" plot_graphs="true" plot_index="true"/>
```
- new format of returned polygons `"index | polygon"` 6fa459ad9ffe5a07699c05b655bcf90f114ed635
- Exit if `framerate` is not found. c1308ef8
### Changed
- Pass Matrix by reference bff89e48
- Better fonts in plot scripts. 56d6a8f7
### Fixed
- Ignore empty line in traj file. 3a3ae04e
- Fixes for profile plots. a8a1414c
- Fix parsing of framerate. 2ad0b01d
## v0.8.2 [06.11.2017]
### Added
- Use the effective distance in method B in case `length_in_movement_direction` is not defined. (2c321cef)
- Added an error warning when the number of agents in the trajectory is not corresponding to total ids or the ped ids are not continuous in the first frame.
### Changed
- Code does not come with Boost anymore. User should install Boost before using jpsreport. (2c0c69f3)
- use boost matrix instead of double pointers (9ff5c978)
- Use own index numbers (9a0d8ec8)
- Use Python3 in scripts.
### Fixed
- Fix SegFault due to reading files from different OS. (9a42c9dd)
## v0.8.1 [11.10.2016]
### Added
- Two options `startframe` and `stopframe` are added for each measurement area for method D to assign the time periods for analysis.
- Individual density based on Voronoi method is added for one dimensional case in the output file (Individual headway is moved to the 5th column).
- z-position of each measurement area can be assigned in inifile so that the trajectories in geometries with several floors can be analyzed.
- The option `plot_time_series` is available for each measurement area.
- The option `frame_interval` for method A now can have different values for different measurement area.
- The option `ignore_backward_movement` and `set_movement_direction` are added to indicate the movement direction for velocity calculation.
### Changed
- The switch for calculating Individual FD is arraged for each measurement area.
- The setting for velocity calculation is changed in inifile. Now velocity can be calculated by projecting to any direction by setting the parameter `set_movement_direction`. The backward movement against the target direction can be considered or removed by setting the parameter `ignore_backward_movement`.
- The way for reading .txt format trajectory file is changed. Now the order of each column in trajectory file is not so important. The trajectory file from JPScore can be analyzed directly.
- The algorithm for loading the '.txt' format trajectory file is modified. Now the order of each column in the file is not so important. JPSreport will search for meaning of each column from the comments (for example `#ID FR X Y Z VD`).
### Fixed
- The script for plot Voronoi cells is modified so that it work when the trajectory files are not the in the same location as the inifile.
- The bug related to #54 is fixed.
- The bug regarding to #43 is fixed.
## v0.8
### Added
- A switch is added in the infile for `method_D` to turn off plotting Voronoi diagrams. Now it is possible to only output data for the diagram but not plot figures.
- Switches for plotting time series of density and velocity are added for `method_C` and `method_D` in inifile.
- A switch for plotting N-t diagram is added for `method_A` in inifile.
- An option for analyzing one dimensional trajectory data is added in `method_D`.
- Issue a warning when the voronoi cell cannot be calculated.
- A warning will will be given and the program stops if trajectory for a given pedestrian ID is not continuous.
### Changed
- Scripts "_Plot_cell_rho.py" and "_Plot_cell_v.py" are modified. Now the geometry is also plotted when plotting voronoi cells.
- The indicator for velocity component can be specified in trajectory files now (.TXT and .XML)
- Scripts "_Plot_FD.py" is modified!
### Fixed
- Output data file "Folw\_NT\_xxxx.dat" is closed before calling script for plotting N-t diagram.
- A bug relating to transformation of units in `method_B` is fixed.
- Fixed error where all trajectories were co-linear.
- A bug for legend in the script "_Plot_timeseries_rho_v.py" is fixed.
- The case that frame ID and Ped ID in trajectory file are not coutinuous can also be analyzed correctly.
- Now when the given file paths in inifile include blank, it still works on windows system.
- when path of trajectory is not given absolutely, the default location is the same folder with the inifile
## v0.7
### Added
- Added four demos as examples for using JPSreport
- Added the option for specifying the location of scripts in configuration file.
- Embedded python scripts (**\_Plot_N\_t.py**, **\_Plot_timeseries\_rho_v.py**) for plotting N-t diagram (Method A), time series of density/velocity diagram (Method C and D) and Voronoi diagrams (Method D).
- Added python script (**SteadyState.py**) for automatically detecting steady state of pedestrian flow based on time series of density and velocity. When plotting fundamental diagrams normally only data under steady state are used due to its generality.
- Added python script (**\_Plot_FD.py**) for plotting fundamenatl diagram based on the detected steady state.
### Changed
- Changed name of some variables in configuration file:
**measurementAreas** ---> **measurement_areas**
**Length_in_movement_direction** ---> **length_in_movement_direction**
**useXComponent** ---> **use_x_component**
**useYComponent** ---> **use_y_component**
**halfFrameNumberToUse** ---> **frame_step**
**timeInterval** ---> **frame_interval**
**measurementArea** ---> **measurement_area**
**outputGraph** ---> **output_graph**
**individualFDdata** ---> **individual_FD**
**cutByCircle** ---> **cut_by_circle**
**getProfile** ---> **profiles**
**scale_x** ---> **grid_size_x**
**scale_y** ---> **grid_size_y**
- Changed the data type of frame rate (fps) from integer to float
- Changed the way for dealing with pedestrian outside geometry. In old version JPSreport stops when some pedestrians are outside geometry but now it continue working by
removing these pedestrians from the list.
- More than one sub rooms in one geometry can be analysed independently.
### Fixed
- Fixed bug for dealing with obstacles inside geometry.
# some options
# -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER:STRING=clang
# -DCMAKE_BUILD_TYPE=Debug (default Release)
# -DCMAKE_VERBOSE_MAKEFILE=ON (default OFF)
# -DBUILD_TESTING=ON (default OFF)
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
set(JPSREPORT_MAJOR_VERSION 0)
set(JPSREPORT_MINOR_VERSION 8)
set(JPSREPORT_PATCH_VERSION 4)
set(JPSREPORT_VERSION
${JPSREPORT_MAJOR_VERSION}.${JPSREPORT_MINOR_VERSION}.${JPSREPORT_PATCH_VERSION})
message( STATUS "JPSREPORT_VERSION: " ${JPSREPORT_VERSION} )
project(JPSreport VERSION ${JPSREPORT_VERSION} LANGUAGES CXX)
#set (CMAKE_CXX_STANDARD 17)
# Fix behavior of CMAKE_CXX_STANDARD when targeting macOS.
if (POLICY CMP0025)
cmake_policy(SET CMP0025 NEW)
endif ()
set(CMAKE_LEGACY_CYGWIN_WIN32 0)
IF (POLICY CMP0054)
cmake_policy(SET CMP0054 NEW)
ENDIF (POLICY CMP0054)
set(CMAKE_COLOR_MAKEFILE ON)
set(LIBRARY_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/lib/${CMAKE_BUILD_TYPE})
if (Boost_NO_SYSTEM_PATHS)
set(Boost_NO_SYSTEM_PATHS ON)
set(BOOST_INCLUDE_DIRS "${BOOST_ROOT}/include")
set(BOOST_LIBRARY_DIRS "${BOOST_ROOT}/stage/lib")
set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} ${BOOST_ROOT})
set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} ${BOOST_LIBRARY_DIRS})
endif (Boost_NO_SYSTEM_PATHS)
find_package(Git REQUIRED) # no need for this msg. It comes from cmake.findgit()
find_program(GIT_SCM git DOC "Git version control")
mark_as_advanced(GIT_SCM)
find_file(GITDIR NAMES .git PATHS ${CMAKE_SOURCE_DIR} NO_DEFAULT_PATH)
if (GIT_SCM AND GITDIR)
# the commit's SHA1, and whether the building workspace was dirty or not
# describe --match=NeVeRmAtCh --always --tags --abbrev=40 --dirty
execute_process(COMMAND
"${GIT_EXECUTABLE}" --no-pager describe --tags --always --dirty
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE GIT_SHA1
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
# branch
execute_process(
COMMAND "${GIT_EXECUTABLE}" rev-parse --abbrev-ref HEAD
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE GIT_BRANCH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
# the date of the commit
execute_process(COMMAND
"${GIT_EXECUTABLE}" log -1 --format=%ad --date=local
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE GIT_DATE
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
# the subject of the commit
execute_process(COMMAND
"${GIT_EXECUTABLE}" log -1 --format=%s
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE GIT_COMMIT_SUBJECT
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
string(REGEX REPLACE "\#"
"" GIT_COMMIT_SUBJECT
${GIT_COMMIT_SUBJECT})
add_definitions("-DGIT_COMMIT_HASH=\"${GIT_SHA1}\"")
add_definitions("-DGIT_COMMIT_DATE=\"${GIT_DATE}\"")
add_definitions("-DGIT_COMMIT_SUBJECT=\"${GIT_COMMIT_SUBJECT}\"")
add_definitions("-DGIT_BRANCH=\"${GIT_BRANCH}\"")
else()
message(STATUS "Not in a git repo")
endif()
#set(EXECUTABLE_OUTPUT_PATH "../")
#INCLUDE_DIRECTORIES("./")
# message( STATUS "CMAKE_BINARY_DIR: " ${CMAKE_BINARY_DIR} )
message( STATUS "CMAKE_SOURCE_DIR: " ${CMAKE_SOURCE_DIR} )
message( STATUS "CMAKE_CURRENT_SOURCE_DIR: " ${CMAKE_CURRENT_SOURCE_DIR} )
set(CMAKE_TEST_DIR ${CMAKE_SOURCE_DIR}/Utest)
add_definitions("-DJPSREPORT_VERSION=\"${JPSREPORT_VERSION}\"")
if(NOT CMAKE_BUILD_TYPE)
set (CMAKE_BUILD_TYPE Release)
endif(NOT CMAKE_BUILD_TYPE)
message( STATUS "CMAKE_BUILD_TYPE: " ${CMAKE_BUILD_TYPE} )
if (NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin)
endif()
if(NOT EXECUTABLE_OUTPUT_PATH)
set(EXECUTABLE_OUTPUT_PATH "${CMAKE_SOURCE_DIR}/bin")
endif()
set(CMAKE_INSTALL_PREFIX "${CMAKE_SOURCE_DIR}/${CMAKE_BUILD_TYPE}")
message( STATUS "CMAKE_RUNTIME_OUTPUT_DIRECTORY: " ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} )
message( STATUS "EXECUTABLE_OUTPUT_PATH: " ${EXECUTABLE_OUTPUT_PATH} )
message( STATUS "CMAKE_VERBOSE_MAKEFILE: " ${CMAKE_VERBOSE_MAKEFILE} )
if(NOT BUILD_TESTING)
set(BUILD_TESTING OFF) # test units are generated.
endif(NOT BUILD_TESTING)
message( STATUS "BUILD_TESTING: " ${BUILD_TESTING} )
if(NOT CMAKE_EXPORT_COMPILE_COMMANDS)
# To generate a compilation database "compilation_commands.json" for clang_check
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
endif(NOT CMAKE_EXPORT_COMPILE_COMMANDS)
if(NOT DEFINED PROCESSOR_COUNT)
# Unknown:
set(PROCESSOR_COUNT 1)
# Linux:
set(cpuinfo_file "/proc/cpuinfo")
if(EXISTS "${cpuinfo_file}")
file(STRINGS "${cpuinfo_file}" procs REGEX "^processor.: [0-9]+$")
list(LENGTH procs PROCESSOR_COUNT)
endif(EXISTS "${cpuinfo_file}")
# Windows:
if(WIN32)
set(PROCESSOR_COUNT "$ENV{NUMBER_OF_PROCESSORS}")
endif(WIN32)
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)
# find the correct OpenMP flag
FIND_PACKAGE(OpenMP)
if(OPENMP_FOUND)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
else(OPENMP_FOUND)
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp")
# somehow find_package(openmp) does not work properly with clang
else(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
message( STATUS "Disabling OpenMP support" )
endif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
endif(OPENMP_FOUND)
# test all cpp-files in Utest
if(BUILD_TESTING)
file(GLOB test_files "${CMAKE_TEST_DIR}/*.cpp")
# file(GLOB test_py_files "${CMAKE_TEST_DIR}/*/runtest*.py")
file(GLOB_RECURSE test_py_files "${CMAKE_TEST_DIR}/*runtest_*.py")
endif(BUILD_TESTING)
set(methods
methods/VoronoiDiagram.cpp
methods/PedData.cpp
methods/Method_A.cpp
methods/Method_B.cpp
methods/Method_C.cpp
methods/Method_D.cpp
methods/Method_I.cpp
)
set(source_files
Analysis.cpp
IO/OutputHandler.cpp
general/ArgumentParser.cpp
tinyxml/tinystr.cpp
tinyxml/tinyxml.cpp
tinyxml/tinyxmlerror.cpp
tinyxml/tinyxmlparser.cpp
geometry/Building.cpp
geometry/Line.cpp
geometry/Point.cpp
geometry/Transition.cpp
geometry/Crossing.cpp
geometry/NavLine.cpp
geometry/Room.cpp
geometry/Wall.cpp
geometry/Hline.cpp
geometry/Obstacle.cpp
geometry/SubRoom.cpp
geometry/Goal.cpp
)
set ( header_files
Analysis.h
methods/MeasurementArea.h
methods/VoronoiDiagram.h
methods/PedData.h
methods/Method_A.h
methods/Method_B.h
methods/Method_C.h
methods/Method_D.h
methods/Method_I.h
IO/OutputHandler.h
general/ArgumentParser.h
general/Macros.h
tinyxml/tinyxml.h
tinyxml/tinystr.h
geometry/Building.h
geometry/Line.h
geometry/Point.h
geometry/Transition.h
geometry/Crossing.h
geometry/NavLine.h
geometry/Room.h
geometry/Wall.h
geometry/Hline.h
geometry/Obstacle.h
geometry/SubRoom.h
geometry/Goal.h
)
#--------------------
#if(NOT CMAKE_GENERATOR MATCHES "Visual Studio")
# include(CheckCXXCompilerFlag)
# CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
# CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
# if(COMPILER_SUPPORTS_CXX11)
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
# message(STATUS "Checking for C++11 compiler - available")
# elseif(COMPILER_SUPPORTS_CXX0X)
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
# message(STATUS "Checking for C++0x compiler - available")
# else()
# message(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} has no c++11 support. Please use a #different C++ compiler.")
# endif()
#endif()
#---------------------
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
message(STATUS "Using Clang " ${CMAKE_CXX_COMPILER_VERSION})
endif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
if(CMAKE_COMPILER_IS_GNUCXX)
message( STATUS "Using g++ " ${CMAKE_CXX_COMPILER_VERSION})
endif(CMAKE_COMPILER_IS_GNUCXX)
if(CMAKE_COMPILER_IS_GNUCXX)
message( STATUS "Set compiler flags (g++)" )
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -Wno-unused-local-typedefs")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Wall -Wno-unused-local-typedefs")
endif(CMAKE_COMPILER_IS_GNUCXX)
if(CMAKE_BUILD_TYPE MATCHES Debug)
message(STATUS "Debug flags: " ${CMAKE_CXX_FLAGS_DEBUG} )
endif()
if(CMAKE_BUILD_TYPE MATCHES Release)
message(STATUS "Release flags: " ${CMAKE_CXX_FLAGS_RELEASE} -static )
endif()
if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_BUILD_TYPE MATCHES Debug)
set(WITH_COVERAGE TRUE)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -W -Wshadow -Wunused-variable -Wunused-parameter -Wunused-function -Wunused -Wno-system-headers -Wno-deprecated -Woverloaded-virtual -Wwrite-strings -fprofile-arcs -ftest-coverage")
set(CMAKE_CXX_LDFLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fprofile-arcs -ftest-coverage")
message(STATUS "Debug flags for coverage: " ${CMAKE_CXX_FLAGS_DEBUG} )
endif(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_BUILD_TYPE MATCHES Debug)
if (Boost_NO_SYSTEM_PATHS)
set(Boost_NO_SYSTEM_PATHS ON)
set(BOOST_INCLUDE_DIRS "${BOOST_ROOT}/include")
set(BOOST_LIBRARY_DIRS "${BOOST_ROOT}/stage/lib")
set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} ${BOOST_ROOT})
set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} ${BOOST_LIBRARY_DIRS})
endif (Boost_NO_SYSTEM_PATHS)
if(MSVC)
find_package(Boost QUIET)
else()
find_package(Boost REQUIRED)
endif()
if (Boost_FOUND)
# set(Boost_USE_STATIC_LIBS ON)
# set(Boost_USE_STATIC_RUNTIME ON)
if(WIN32)
add_definitions(${Boost_LIB_DIAGNOSTIC_DEFINITIONS})
endif()
message(STATUS "BOOST FOUND: " ${Boost_LIB_VERSION})
message(STATUS "Boost_LIBRARY_DIRS: " ${Boost_LIBRARY_DIRS})
message(STATUS "Boost_INCLUDE_DIR: " ${Boost_INCLUDE_DIR})
message(STATUS "Boost_LIB_VERSION: " ${Boost_LIB_VERSION})
message(STATUS "Boost_libraries: " ${Boost_LIBRARIES})
link_directories(${Boost_LIBRARY_DIRS})
include_directories(SYSTEM ${Boost_INCLUDE_DIR})
# suppress warnings in boost libraries with attribute SYSTEM
#include_directories(SYSTEM ${Boost_INCLUDE_DIR})
else()
message(WARNING "BOOST NOT FOUND")
endif()
#if (WIN32)
#find_library (PSAPI Psapi PATH_SUFFIXES "x64")
#message (STATUS "PSAPI: ${PSAPI}")
#endif()
add_library ( geometrycore SHARED ${source_files} ${methods})
set_property(TARGET geometrycore PROPERTY CXX_STANDARD 17)
set_property(TARGET geometrycore PROPERTY CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
target_link_libraries(geometrycore stdc++fs)
add_executable(
jpsreport main.cpp
)
set_property(TARGET jpsreport PROPERTY CXX_STANDARD 17)
set_property(TARGET jpsreport PROPERTY CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
target_link_libraries(jpsreport stdc++fs)
if (Boost_FOUND)
target_link_libraries(geometrycore ${Boost_LIBRARIES})
endif()
if(WIN32)
target_link_libraries (jpsreport wsock32)
#target_link_libraries( jpsreport ${PSAPI} )
endif()
target_link_libraries( jpsreport geometrycore )
if(WIN32)
if(MSVC)
set_property(GLOBAL PROPERTY USE_FOLDERS ON) # groups cmake-projects in CMakePredefinedTargets
set_property(GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER "cmake")
set(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY TRUE)
set(CMAKE_SKIP_PACKAGE_ALL_DEPENDENCY TRUE)
message(STATUS "MSVC: " ${MSVC})
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT /WX-")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd /WX-")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++17")
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT jpsreport)
message(STATUS "set start project for VS")
endif()
endif()
set(Python_ADDITIONAL_VERSIONS 3.0 3.3 3.6 3.7)
find_package(PythonInterp)
if((PYTHONINTERP_FOUND) AND (${PYTHON_VERSION_MAJOR} EQUAL 3))
message(STATUS "Found Python: " ${PYTHON_EXECUTABLE} " (version: ${PYTHON_VERSION_STRING})")
add_definitions("-DPYTHON=\"${PYTHON_EXECUTABLE}\"")
add_definitions("-DPYTHON_VERSION=\"${PYTHON_VERSION_STRING}\"")
else()
message (WARNING "Could not find python 3x")
add_definitions("-DPYTHON=\"${PYTHON_EXECUTABLE}\"")
add_definitions("-DPYTHON_VERSION=\"${PYTHON_VERSION_STRING}\"")
endif()
# ----------------------------- cTest ------------------------------------------
if(BUILD_TESTING)
SET(BUILD_TEST_TIMEOUT 10800 CACHE STRING "Global timeout on all tests (seconds).")
SET(DART_TESTING_TIMEOUT "${BUILD_TEST_TIMEOUT}" CACHE STRING "" FORCE)
message(STATUS "Timeout: " ${BUILD_TEST_TIMEOUT} " s" )
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 (jpsreport_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}
--build-two-config
--build-exe-dir ${EXECUTABLE_OUTPUT_PATH} # todo wo soll der exe hin?: ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
--build-project JPSreport
--test-command jpsreport --ini=${CMAKE_TEST_DIR}/files/input_UO_180.xml
)
# set(Python_ADDITIONAL_VERSIONS 3.0)
find_package(PythonInterp)
if(PYTHONINTERP_FOUND)
message(STATUS "Found Python: " ${PYTHON_EXECUTABLE} " (${PYTHON_VERSION_STRING})")
foreach (test_src ${test_py_files})
GET_FILENAME_COMPONENT(test ${test_src} NAME_WE)
# message (STATUS "Add python test: " ${test} " | test_src: " ${test_src})
add_test(NAME ${test} COMMAND ${test_src})
endforeach(test_src ${test_py_files})
message(STATUS "Found Python: " ${PYTHON_EXECUTABLE})
endif(PYTHONINTERP_FOUND)
endif(BUILD_TESTING)
# ----------- CPACK
set(DEMOS_DIR "demos")
set(DEMO1_DIR "${DEMOS_DIR}/T-Junction")
set(DEMO2_DIR "${DEMOS_DIR}/bottleneck")
set(SCRIPTS_DIR "scripts")
set(NOTEBOOK "${CMAKE_SOURCE_DIR}/${DEMOS_DIR}/HowTo.ipynb")
file(GLOB CT_FILES "${CMAKE_SOURCE_DIR}/${DEMO1_DIR}/*")
file(GLOB CT_FILES2 "${CMAKE_SOURCE_DIR}/${DEMO2_DIR}/*")
file(GLOB SCRIPT_FILES "${CMAKE_SOURCE_DIR}/${SCRIPTS_DIR}/*")
install(TARGETS jpsreport
DESTINATION bin
COMPONENT applications)
install(DIRECTORY DESTINATION ${DEMO1_DIR})
install(DIRECTORY DESTINATION ${DEMO2_DIR})
# notebook
install(FILES ${NOTEBOOK}
DESTINATION ${DEMOS_DIR}
COMPONENT demos)
install(FILES ${CT_FILES}
DESTINATION ${DEMO1_DIR}
COMPONENT demos)
install(FILES ${CT_FILES2}
DESTINATION ${DEMO2_DIR}
COMPONENT demos)
install(FILES ${SCRIPT_FILES}
DESTINATION ${SCRIPTS_DIR}
COMPONENT scripts)
if(WIN32 AND NOT UNIX)
message(STATUS "Package generation - Windows")
set(CPACK_GENERATOR "NSIS")
find_program(NSIS_PATH nsis PATH_SUFFIXES nsis)
if(NSIS_PATH)
set(CPACK_GENERATOR "${CPACK_GENERATOR};NSIS")
message(STATUS " + NSIS YES ")
else(NSIS_PATH)
message(STATUS " + NSIS NO ")
endif(NSIS_PATH)
#CPACK_NSIS_URL_INFO_ABOUT
set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP TRUE)
include(InstallRequiredSystemLibraries)
#message(STATUS "System Dependencies: " ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS})
install(PROGRAMS ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS}
DESTINATION sys
COMPONENT applications)
elseif(APPLE)
set(DEFAULT_CPACK_GENERATOR "DragNDrop")
endif()
set(CPACK_COMPONENTS_ALL applications)
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE")
set(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/LICENSE")
set(CPACK_NSIS_MUI_ICON "${CMAKE_SOURCE_DIR}/forms/jpsreport.ico")
set(CPACK_NSIS_MUI_UNIICON "${CMAKE_SOURCE_DIR}/forms/jpsreport.ico")
set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON)
set(CPACK_NSIS_MODIFY_PATH ON)
set(CPACK_COMPONENTS_ALL applications demos scripts)
#set(CPACK_COMPONENT_CTDATA_GROUP "Demos")
set(CPACK_COMPONENT_APPLICATIONS_DISPLAY_NAME "jpsreport")
set(CPACK_COMPONENT_GROUP_DATA_DESCRIPTION "demo files" "Scripts")
set(CPACK_COMPONENT_DATA_FILES_DESCRIPTION "demo files to get started" "scripts")
SET(CPACK_PACKAGE_DESCRIPTION "Simulation core of JuPedSim")
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "The simulation core of JuPedSim, a framework for simulation and analysis of pedestrian dynamics")
SET(CPACK_PACKAGE_VENDOR "Forschungszentrum Juelich GmbH")
SET(CPACK_PACKAGE_NAME "JPSreport")
SET(CPACK_PACKAGE_CONTACT "m.chraibi@fz-juelich.de")
SET(CPACK_PACKAGE_VERSION_MAJOR "${JPSREPORT_MAJOR_VERSION}")
SET(CPACK_PACKAGE_VERSION_MINOR "${JPSREPORT_MINOR_VERSION}")
SET(CPACK_PACKAGE_VERSION_PATCH "${JPSREPORT_PATCH_VERSION}")
SET(CPACK_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}_${JPSREPORT_VERSION}")
SET(CPACK_SOURCE_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}_${JPSREPORT_VERSION}")
INCLUDE(CPack)
# Contributing
This page provides a starting point for getting involved with the JuPedSim/jpsreport project.
There are several ways to contribute to a project with Git. These are guidelines, not laws. But following this workflow adds a level of quality assurance to the project. Notes describing how to perform specific tasks using Git are given here.
Please open a new [issue](https://github.com/JuPedSim/jpsreport/issues) if you encouter problems or have found a bug in the code.
## Getting started
### Install Git on your local machine
Mac and Linux users will likely already have Git installed. To confirm this, open a terminal and type
```
$git --version
```
To install Git for windows go [here](https://git-scm.com/download/win).
### Create a GitHub account
If you do not already have one, create a [GitHub account](https://github.com/).
### Do some local configuration
You will need to set your [Git configuration](http://www.git-scm.com/docs/git-config) so that the remote server knows who you are when you are pushing.
**Your username** (need not be your GitHub username):
```
$ git config --global user.name "Paul Mustermann"
```
**Your e-mail adress** (same as your GitHub account):
```
$ git config --global user.email "paul@mustermann.com"
```
## Fork repos from JuPedSim
Go to the [JuPedSim](https://github.com/JuPedSim) organization GitHub page. For each project you want to work with, fork the corresponding repo(s) over to your GitHub account by clicking the fork icon on the upper right. [Here](https://help.github.com/en), you can find more information about [forking](https://help.github.com/en/articles/fork-a-repo).
## Clone the forked repos
The repo you will work from is now in your space on GitHub. To get this repo to your computer you need to clone it. There are a few ways to do this. For example, see the "Clone to Desktop" and "Download Zip" buttons to the right side of your project page. Here I will use the command line SSH clone. Note that you need to have an SSH key enabled for your computer. [Here](https://help.github.com/en), you can find more information about [cloning](https://help.github.com/en/articles/cloning-a-repository-from-github).
## Staying up-to-date with the central repo
First, check your remote state. You should see no "upstream" repositories. The only remote repo you should see is origin.
```
$ git remote -v
origin git@github.com:username/jpsreport.git (fetch)
origin git@github.com:username/jpsreport.git (push)
```
If you see "upstream" repos in addition to origin, then you need to remove them.
```
$ git remote rm <repo-name>
```
Add tracking for JuPedSim/jpsreport. Here we will go ahead and name our "upstream" repo "JuPedSim".
```
$ git remote add JuPedSim git://github.com/JuPedSim/jpsreport.git
```
## Updating your repository
To get all the changes committed by other project members to the central repo, do the following:
```
$ git remote update
Fetching origin
Fetching JuPedSim
```
Make sure, you are in your develop branch
```
$ git checkout develop
```
See what different in your development branch
```
$ git diff JuPedSim/develop
```
Merge any changes from the central repo
```
$ git merge JuPedSim/develop
```
Your LOCAL repo will now have changes made to JuPedSim/jpsreport. However, your GitHub repo will still be behind. You need to push the changes up to GitHub.
```
$ git push origin develop
```
## Making changes
When you're working on the JuPedSim/jpsreport project, you're going to have a bunch of different features or ideas in progress at any given time – some of which are ready to go, and others which are not. Branching exists to help you manage this workflow. When you create a branch in your project, you're creating an environment where you can try out new ideas. Changes you make on a branch don't affect the main develop branch, so you're free to experiment and commit changes, safe in the knowledge that your branch won't be merged until it's ready to be reviewed by someone you're collaborating with.
The next step is to "stage" your changes for commit and then to "commit" the changes to your local repo.
**But wait! First, make sure your working branch is up-to-date by fetching and merging (pulling) any last-minute changes from the central repo.**
```
$git fetch JuPedSim
```
```
$ git diff JuPedSim/develop
```
Are these the changes you except to see? **If not, don't merge.**
```
$ git merge JuPedSim/develop
```
Now do your [add](https://www.git-scm.com/docs/git-add) and [commit](https://www.git-scm.com/docs/git-commit).
You are now going to push your commit up to your GitHub repo. It is good to explicitly say which repo and which branch you are pushing to, else you can forget where you are (if you are, say, a topic branch instead) and get your repo in a state that you have to untangle.
```
git push origin develop
```
Now your changes are in your repo on GitHub. It's time to submit a pull request.
## Submit a pull request
Go to your account on GitHub. Make sure you are on your develop branch. You should see a note saying something like "This branch is 1 commit ahead of JuPedSim:develop" (of course, this will depend on the current state of each repo). Next, click the "Compare & pull request" button. Notice you are now on the JuPedSim/jpsreport account page. Use the compare tool to double check the changes you are submitting are the ones you intend to submit. It is also possible to just see a list of the files you are touching.
## Accept or reject the request
Pull requests are accepted or rejected by project members. You can accept your own pull request if you are a member of the JuPedSim organization. The four-eye principle is desirable.
## This file should be placed in the root directory of your project.
## Then modify the CMakeLists.txt file in the root directory of your
## project to incorporate the testing dashboard.
## # The following are required to uses Dart and the Cdash dashboard
## ENABLE_TESTING()
## INCLUDE(CTest)
set(CTEST_PROJECT_NAME "JPSreport")
set(CTEST_NIGHTLY_START_TIME "00:00:00 CET")
set(CTEST_DROP_METHOD "http")
set(CTEST_DROP_SITE "my.cdash.org")
set(CTEST_DROP_LOCATION "/submit.php?project=JPSreport")
set(CTEST_DROP_SITE_CDASH TRUE)
/**
* \file OutputHandler.cpp
* \date Nov 20, 2010
* \version v0.8
* \copyright <2009-2015> Forschungszentrum Jülich GmbH. All rights reserved.
*
* \section License
* This file is part of JuPedSim.
*
* JuPedSim is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* JuPedSim is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with JuPedSim. If not, see <http://www.gnu.org/licenses/>.
*
* \section Description
*
*
**/
#include "OutputHandler.h"
#include <stdio.h>
#include <stdarg.h>
#include <cstdlib>
#include <cmath>
using namespace std;
void OutputHandler::incrementWarnings()
{
_nWarnings += 1;
}
int OutputHandler::GetWarnings()
{
return _nWarnings;
}
void OutputHandler::incrementErrors()
{
_nErrors += 1;
}
int OutputHandler::GetErrors()
{
return _nErrors;
}
void OutputHandler::Write(const string& str)
{
cout << str << endl;
}
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 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)
{
cerr << msg << endl;
cerr.flush();
incrementErrors();
}
else if (str.find("WARNING") != string::npos)
{
cerr << msg << endl;
cerr.flush();
incrementWarnings();
}
else
{ // infos
cout << msg << endl;
cout.flush();
}
}
void STDIOHandler::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)
{
cerr << msg << endl;
cerr.flush();
incrementErrors();
}
else if (str.find("WARNING") != string::npos)
{
cerr << msg << endl;
cerr.flush();
incrementWarnings();
}
else
{ // infos
cout << msg << endl;
cout.flush();
}
}
void STDIOHandler::Write(const string& str)
{
if (str.find("ERROR") != string::npos)
{
cerr << str << endl;
cerr.flush();
incrementErrors();
}
else if (str.find("WARNING") != string::npos)
{
cerr << str << endl;
cerr.flush();
incrementWarnings();
}
else
{ // infos
cout << str << endl;
cout.flush();
}
}
FileHandler::FileHandler(const char *fn)
{
if (fn== nullptr) {
char tmp[CLENGTH];
sprintf(tmp, "Error!!! File could not be opened!");
cerr << tmp << endl;
exit(0);
}
else
{
_pfp.open(fn);
}
}
FileHandler::~FileHandler()
{
_pfp.close();
}
void FileHandler::Write(const string& str)
{
_pfp << str << endl;
_pfp.flush();
if (str.find("ERROR") != string::npos)
{
incrementErrors();
}
else if (str.find("WARNING") != string::npos)
{
incrementWarnings();
}
}
void FileHandler::Write(const char* str_msg,...)
{
char msg[CLENGTH]="";
va_list ap;
va_start (ap, str_msg);
vsprintf (msg,str_msg ,ap);
va_end (ap);
_pfp<<msg<<endl;
_pfp.flush();
string str(msg);
if (str.find("ERROR") != string::npos)
{
incrementErrors();
}
else if (str.find("WARNING") != string::npos)
{
incrementWarnings();
}
}
#ifdef _SIMULATOR
SocketHandler::SocketHandler(const 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\"?>");
}
SocketHandler::~SocketHandler()
{
delete client;
}
void SocketHandler::Write(const string& stringRef)
{
vector<string>::iterator str_it;
string str=stringRef;
//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());
}
#endif
/**
* \file OutputHandler.h
* \date Nov 20, 2010
* \version v0.5
* \copyright <2009-2015> Forschungszentrum Jülich GmbH. All rights reserved.
*
* \section License
* This file is part of JuPedSim.
*
* JuPedSim is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* JuPedSim is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with JuPedSim. If not, see <http://www.gnu.org/licenses/>.
*
* \section Description
*
*
**/
#ifndef OUTPUT_HANDLER_H_
#define OUTPUT_HANDLER_H_
#include <iostream>
#include <fstream>
#include <vector>
#include "../general/Macros.h"
#ifdef _SIMULATOR
#include "../IO/TraVisToClient.h"
#endif
class OutputHandler {
protected:
int _nWarnings;
int _nErrors;
public:
OutputHandler() { _nWarnings = 0; _nErrors = 0; };
virtual ~OutputHandler() {};
int GetWarnings();
void incrementWarnings();
int GetErrors();
void incrementErrors();
void ProgressBar(double TotalPeds, double NowPeds);
virtual void Write(const std::string& str);
virtual void Write(const char *string, ...);
};
class STDIOHandler : public OutputHandler {
public:
void Write(const std::string& str);
void Write(const char *string,...);
};
class FileHandler : public OutputHandler {
private:
std::ofstream _pfp;
public:
FileHandler(const char *fn);
virtual ~FileHandler();
void Write(const std::string& str);
void Write(const char *string,...);
};
#ifdef _SIMULATOR
class SocketHandler : public OutputHandler {
private:
TraVisToClient* client;
public:
SocketHandler(const std::string& host, int port);
virtual ~SocketHandler();
void Write(const std::string& str);
//Some tags are broken
std::vector<std::string> brokentags;
};
#endif
#endif /*OUTPUT_HANDLER_H_*/
JPSreport steps
* Define all input parameters via commandline or initialization file
* Read/Parse the input parameters
* Read/Parse the geometry from the predefined format (e.g JPSvis) to the internal boostformat
* Voronoi-cell generation
* Results/Diagrams
* Cells clipping with the geometry
* Output (Images...)
* User Interface
* What is this? Please better explanations...
\ No newline at end of file
Licence:
========
JuPedSim is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
any later version.
JuPedSim is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with JuPedSim. If not, see <http://www.gnu.org/licenses/>.
Disclaimer:
========
In no event shall JuPedSim be liable to any party for direct, indirect, special,
incidental, or consequential damages, including lost profits, arising out of the
use of this software and its documentation, even if JuPedSim has been advised of
the possibility of such damage.
JuPedSim specifically disclaims any warranties, including, but not limited to,
the implied warranties of merchantability and fitness for a particular purpose.
The software and accompanying documentation, if any, provided hereunder is
provided “as is”. JuPedSim has no obligation to provide maintenance, support,
updates, enhancements, or modifications.
Forschungszentrum J ̈ulich GmbH makes no warranty, expressed or implied,
to users of JuPedSim, and accepts no responsibility for its use. Users of JuPedSim
assume sole responsibility for determining the appropriateness of its use; and for
any actions taken or not taken as a result of analyses performed using this tool.
Users are warned that JuPedSim is intended for academic use only. This
tool is an implementation of several computer models that may or may not have
predictive capability when applied to a specific set of factual circumstances. Lack
of accurate prediction
.PHONY: release debug clean clean-release clean-debug install
DIRS:= bin bin/release bin/debug
all: $(DIRS) release
$(DIRS):
mkdir $@
release:
( cd bin/release && cmake -DCMAKE_BUILD_TYPE=release ../.. && $(MAKE) --no-print-directory )
# ctags -R --language-force=c++ *.*
# ctags -eR --language-force=c++ *.*
debug:
( cd bin/debug && cmake -DCMAKE_BUILD_TYPE=debug ../.. && $(MAKE) --no-print-directory && ctest)
# ctags -R --language-force=c++ *.*
# ctags -eR --language-force=c++ *.*
clean: clean-release clean-debug
clean-release:
( cd bin/release && $(MAKE) --no-print-directory clean )
clean-debug:
( cd bin/debug && $(MAKE) --no-print-directory clean )
#release:
# ( cd build/release && cmake -DCMAKE_BUILD_TYPE=release ../.. && $(MAKE) --no-print-directory && make --no-print-directory install)
# ctags -R --language-force=c++ *.*
# ctags -eR --language-force=c++ *.*
# JPSreport
`JuPedSim` is an open source framework for simulation, analyzing and visualizing pedestrian dynamics. It consists of four modules which are loosely coupled and can be used independently at the moment. For more information, please visit the [JuPedSim website](https://www.jupedsim.org).
`JPSreport` is a tool for analyzing the trajectories of pedestrians. It implements different measurement methods to analyze pedestrian movement in different aspects and scales.
Here are some useful links:
* [Manual](http://jupedsim.github.io/jpsreport/).
* Please open a new [issue](https://github.com/JuPedSim/jpsreport/issues) if you encouter problems or have found a bug in the code.
* [Contributing Guidelines](https://github.com/JuPedSim/jpsreport/blob/develop/CONTRIBUTING.md) to the JuPedSim/jpsreport project.
Pull requests welcome!
[![GitHub license](https://img.shields.io/badge/license-GPL-blue.svg)](https://raw.githubusercontent.com/JuPedSim/jpscore/master/LICENSE) [![DOI](https://zenodo.org/badge/109670242.svg)](https://zenodo.org/badge/latestdoi/109670242)
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<geometry version ="0.5" caption="second life" gridSizeX="20" gridSizeY="20" unit="m" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://xsd.jupedsim.org/0.6/jps_geoemtry.xsd"> >
<rooms>
<room id="0" caption="hall" zpos="0.00">
<subroom id="0" closed="0" class="subroom">
<polygon caption="wall">
<vertex px="-8.00" py="-0.70"/>
<vertex px="-8.00" py="2.80"/>
<vertex px="-4.00" py="2.80"/>
<vertex px="-4.00" py="1.80"/>
<vertex px="4.00" py="1.80"/>
<vertex px="4.00" py="2.80"/>
<vertex px="6.00" py="2.80"/>
<vertex px="6.00" py="-0.70"/>
<vertex px="4.00" py="-0.70"/>
<vertex px="4.00" py="0.00"/>
<vertex px="-4.00" py="0.00"/>
<vertex px="-4.00" py="-0.70"/>
<vertex px="-8.00" py="-0.70"/>
</polygon>
</subroom>
</room>
</rooms>
</geometry>
<?xml version="1.0" encoding="UTF-8"?>
<JPSreport project="JPS-Project" version="0.6" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://xsd.jupedsim.org/0.6/jps_report.xsd">
<!-- geometry file -->
<geometry file = "geo_UO_180.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="txt" unit="m">
<file name="uo-180-180-180.txt" />
<path location="./" />
</trajectories>
<!-- all files in the directories will be used -->
<measurementAreas unit="m">
<area_B id="1" type="BoundingBox">
<vertex x="0.00" y="0.00" /> <!-- Clockwise -->
<vertex x="0.00" y="1.80" />
<vertex x="2.00" y="1.80" />
<vertex x="2.00" y="0.00" />
<Length_in_movement_direction distance="2.0" />
</area_B>
<area_L id="2" type="Line">
<start x="0.00" y="-0.50" />
<end x="0.00" y="2.50" />
</area_L>
</measurementAreas>
<velocity>
<useXComponent>true</useXComponent>
<useYComponent>true</useYComponent>
<!-- half of the time interval that used to calculate instantaneous velocity
of ped i [fr] here v_i = (X(t+deltaF) - X(t+deltaF))/(2*deltaF). X is location. -->
<halfFrameNumberToUse>5</halfFrameNumberToUse>
</velocity>
<!-- Method A (Zhang2011a) Flow and Vel -->
<method_A enabled="true">
<!-- Time interval used to count the flow [fr] -->
<timeInterval unit="frame">
70
</timeInterval>
<!-- The coordinate of the line used to calculate the flow and velocity -->
<measurementArea id="2" />
</method_A>
<!-- Method B (Zhang2011a) Vel and Dens based on Tin and Tout -->
<method_B enabled="true">
<measurementArea id="1" />
</method_B>
<!-- Method C (Zhang2011a) Classical density and Vel -->
<method_C enabled="true">
<measurementArea id="1" />
</method_C>
<!-- Method D (Zhang2011a) Voronoi density and Vel -->
<method_D enabled="true" outputGraph="false" individualFDdata="false">
<measurementArea id="1" />
<cutByCircle enabled="false" radius= "0.5" edges = "6"/> <!-- edges represent the precision of discretization of the circle --->
<getProfile enabled="false" scale_x="0.10" scale_y="0.10"/>
</method_D>
</JPSreport>
This diff is collapsed.
This diff is collapsed.
#include<cstdlib>
#include "../Analysis.h"
extern OutputHandler* Log;
int testGetBasename()
{
Analysis analysis = Analysis();
std::string strWin("winhelp.exe");
std::string str;
str = analysis.GetBasename(strWin);
return (str.compare("winhelp")==0)?EXIT_SUCCESS:EXIT_FAILURE;
}
int main ()
{
return testGetBasename();
}