Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
JuPedSim
JPScore
Commits
cedfd5a7
Commit
cedfd5a7
authored
Jul 26, 2014
by
Ulrich Kemloh
Browse files
Merging v0.5 into master to create tag v0.5-alhpa1
parents
4109b576
f799698e
Changes
348
Expand all
Hide whitespace changes
Inline
Side-by-side
CMakeLists.txt
View file @
cedfd5a7
...
...
@@ -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
)
...
...
@@ -10,18 +11,23 @@ project(JPScore)
set
(
CMAKE_COLOR_MAKEFILE ON
)
set
(
JPSCORE_MAJOR_VERSION 0
)
set
(
JPSCORE_MINOR_VERSION
1
)
set
(
JPSCORE_MINOR_VERSION
5
)
set
(
JPSCORE_PATCH_VERSION 0
)
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
)
# test units are not 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
)
# Get number of processors. Mac is not supported
if
(
NOT DEFINED PROCESSOR_COUNT
)
# Unknown:
set
(
PROCESSOR_COUNT 0
)
...
...
@@ -33,15 +39,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 +47,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
)
...
...
@@ -66,16 +61,13 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin)
set
(
EXECUTABLE_OUTPUT_PATH
"
${
CMAKE_SOURCE_DIR
}
/bin"
)
set
(
LIBRARY_OUTPUT_PATH
${
CMAKE_SOURCE_DIR
}
/lib/
${
CMAKE_BUILD_TYPE
}
)
set
(
CMAKE_TEST_DIR
${
CMAKE_SOURCE_DIR
}
/Utest
)
#include_directories( ${LIBRARY_OUTPUT_PATH} )
#add_subdirectory(${LIBRARY_OUTPUT_PATH} )
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
}
)
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
}
)
#add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --verbose)
# Debug messages
# 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} )
# 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} )
# add a target to generate API documentation with Doxygen
find_package
(
Doxygen
)
...
...
@@ -88,36 +80,49 @@ if(DOXYGEN_FOUND)
)
endif
(
DOXYGEN_FOUND
)
#find the correct OpenMP flag
#
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
)
message
(
STATUS
"Disabling OpenMP support"
)
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
)
#find and add the CGAL library
#fixme: complete this section
FIND_PACKAGE
(
CGAL QUIET
)
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
}
"
)
message
(
SEND_ERROR
" Erreur:
${
CGAL_USE_FILE
}
"
)
else
(
CGAL_FOUND
)
message
(
STATUS
"CGAL not found. But don't panik .."
)
endif
(
CGAL_FOUND
)
#statically link all gcc stuffs
set
(
CMAKE_EXE_LINKER_FLAGS
"
${
CMAKE_EXE_LINKER_FLAGS
}
-static"
)
# test files: all cpp-files in Utest
file
(
GLOB test_files
"
${
CMAKE_TEST_DIR
}
/*.cpp"
)
# find and add the CGAL library
#fixme: complete this section
# FIND_PACKAGE(CGAL QUIET)
# if(CGAL_FOUND)
# include (${CGAL_USE_FILE})
# INCLUDE_DIRECTORIES(${CGAL_CORE_INCLUDE_DIR})
# add_definitions(-D_CGAL=1)
# message (STATUS "${CGAL_FOUND}")
# message (STATUS "${CGAL_CORE_INCLUDE_DIR}")
# message (STATUS " Erreur: ${CGAL_FOUND}")
# message (STATUS " Erreur: ${CGAL_USE_FILE}")
# else(CGAL_FOUND)
# message( STATUS "CGAL not found." )
# endif(CGAL_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"
)
#string(REGEX REPLACE "CMakeFiles/[^;]+;?" "" SRCS "${test_py_files}")
endif
(
BUILD_TESTING
)
# add sources and headers
set
(
source_files
main.cpp
Simulation.cpp
general/ArgumentParser.cpp
...
...
@@ -143,16 +148,18 @@ set ( source_files
IO/OutputHandler.cpp
IO/TraVisToClient.cpp
math/Distribution.cpp
math/ForceModel.cpp
math/Mathematics.cpp
math/ODESolver.cpp
math/GCFMModel.cpp
math/GompertzModel.cpp
mpi/LCGrid.cpp
pedestrian/Ellipse.cpp
pedestrian/PedDistributor.cpp
pedestrian/Pedestrian.cpp
pedestrian/AgentsParameters.cpp
routing/AccessPoint.cpp
routing/DirectionStrategy.cpp
...
...
@@ -191,6 +198,7 @@ set ( source_files
poly2tri/sweep/cdt.cpp
events/EventManager.cpp
)
set
(
header_files
routing/NavMesh.h
routing/DirectionStrategy.h
...
...
@@ -226,6 +234,7 @@ set ( header_files
pedestrian/Pedestrian.h
pedestrian/PedDistributor.h
pedestrian/Ellipse.h
pedestrian/AgentsParameters.h
mpi/LCGrid.h
...
...
@@ -253,9 +262,10 @@ set ( header_files
IO/TraVisToClient.h
math/ForceModel.h
math/Distribution.h
math/Mathematics.h
math/ODESolver.h
math/GCFMModel.h
math/GompertzModel.h
poly2tri/poly2tri.h
poly2tri/common/shapes.h
...
...
@@ -268,12 +278,14 @@ set ( header_files
)
add_library
(
core SHARED
${
source_files
}
)
#add_library(core OBJECT ${source_files} ${header_files})
add_library
(
core STATIC
${
source_files
}
)
#add_library ( core SHARED ${source_files} )
#Target
add_executable
(
jpscore main.cpp
)
target_link_libraries
(
jpscore core
)
if
(
WIN32
)
...
...
@@ -284,52 +296,81 @@ if(CGAL_FOUND)
target_link_libraries
(
jpscore
${
CGAL_CORE_LIBRARY
}
)
endif
(
CGAL_FOUND
)
#---------------------------- compiler -------------------------------
# Initialize CXXFLAGS.
if
(
CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID STREQUAL
"Clang"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-Wall"
)
set
(
CMAKE_CXX_FLAGS_DEBUG
"
${
CMAKE_CXX_FLAGS_DEBUG
}
-O0 -g -Wunused-variable -Wunused-parameter -Wunused-function -Wunused"
)
set
(
CMAKE_CXX_FLAGS_RELEASE
"
${
CMAKE_CXX_FLAGS_RELEASE
}
-O3 -DNDEBUG"
)
endif
()
# check c++-11
if
((
CMAKE_COMPILER_IS_GNUCXX AND NOT
${
CMAKE_CXX_COMPILER_VERSION
}
VERSION_LESS 4.6
)
OR
(
CMAKE_CXX_COMPILER_ID STREQUAL
"Clang"
AND NOT
${
CMAKE_CXX_COMPILER_VERSION
}
VERSION_LESS 3.1
))
message
(
STATUS
"Checking for C++11 compiler - available"
)
else
()
message
(
STATUS
"Checking for C++11 compiler - unavailable"
)
endif
()
# c++-11 flags
if
(
CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID STREQUAL
"Clang"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-std=c++0x"
)
endif
()
if
(
"
${
CMAKE_CXX_COMPILER_ID
}
"
STREQUAL
"Clang"
)
message
(
STATUS
"Using C
LANG++
"
)
message
(
STATUS
"Using C
lang
"
)
endif
(
"
${
CMAKE_CXX_COMPILER_ID
}
"
STREQUAL
"Clang"
)
if
(
CMAKE_COMPILER_IS_GNUCXX
)
message
(
STATUS
"Set compiler flags (g++)"
)
set
(
CMAKE_CXX_FLAGS_RELEASE
"
${
CMAKE_CXX_FLAGS_RELEASE
}
-Wall -std=c++11"
)
message
(
STATUS
"Using g++"
)
endif
(
CMAKE_COMPILER_IS_GNUCXX
)
if
(
CMAKE_COMPILER_IS_GNUCXX AND CMAKE_BUILD_TYPE MATCHES Debug
)
message
(
STATUS
"In Debug Build"
)
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 -std=c++11"
)
if
(
CMAKE_BUILD_TYPE MATCHES Debug
)
set
(
CMAKE_CXX_LDFLAGS_DEBUG
"
${
CMAKE_CXX_FLAGS_DEBUG
}
-fprofile-arcs -ftest-coverage"
)
message
(
STATUS
"Debug flags for coverage: "
${
CMAKE_CXX_FLAGS_DEBUG
}
)
else
(
CMAKE_COMPILER_IS_GNUCXX AND CMAKE_BUILD_TYPE MATCHES Debug
)
message
(
STATUS
"Release flags: "
${
CMAKE_CXX_FLAGS_RELEASE
}
)
endif
(
CMAKE_COMPILER_IS_GNUCXX AND CMAKE_BUILD_TYPE MATCHES Debug
)
message
(
STATUS
"Debug flags: "
${
CMAKE_CXX_FLAGS
}
" "
${
CMAKE_CXX_FLAGS_DEBUG
}
)
else
(
CMAKE_BUILD_TYPE MATCHES Debug
)
message
(
STATUS
"Release flags: "
${
CMAKE_CXX_FLAGS
}
" , "
${
CMAKE_CXX_FLAGS_RELEASE
}
)
endif
(
CMAKE_BUILD_TYPE MATCHES Debug
)
# PGI ++ Flags
if
(
"
${
CMAKE_CXX_COMPILER_ID
}
"
STREQUAL
"PGI"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
--c++11 -Minform=inform"
)
endif
()
# ----------------------------- cTest ------------------------------------------
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
}
--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 JPScore
--test-command jpscore --ini=
${
CMAKE_SOURCE_DIR
}
/inputfiles/Default/ini.xml
)
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
}
--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 JPScore
--test-command jpscore --ini=
${
CMAKE_SOURCE_DIR
}
/inputfiles/Default/ini.xml
)
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
}
)
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
)
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
}
)
find_package
(
PythonInterp
)
if
(
PYTHONINTERP_FOUND
)
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
}
)
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}")
endif
(
PYTHONINTERP_FOUND
)
endif
(
BUILD_TESTING
)
Doxyfile.in
View file @
cedfd5a7
...
...
@@ -32,7 +32,7 @@ PROJECT_NAME = jpscore
# This could be handy for archiving the generated documentation or
# if some version control system is used.
PROJECT_NUMBER = 0.
4
PROJECT_NUMBER =
v.
0.
5
# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer
...
...
@@ -203,7 +203,7 @@ TAB_SIZE = 4
# will result in a user-defined paragraph with heading "Side Effects:".
# You can put \n's in the value part of an alias to insert newlines.
ALIASES =
#
ALIASES
+
=
version="\par v.0.5"
# This tag can be used to specify a number of word-keyword mappings (TCL only).
# A mapping has the form "name=value". For example adding
...
...
IO/IODispatcher.cpp
View file @
cedfd5a7
This diff is collapsed.
Click to expand it.
IO/IODispatcher.h
View file @
cedfd5a7
/**
* File: IODispatcher.h
* \file IODispatcher.h
* \date Nov 20, 2010
* \version v0.5
* \copyright <2009-2014> Forschungszentrum Jülich GmbH. All rights reserved.
*
* Created on 20. November 2010, 15:20
*
*
* @section LICENSE
* \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 General Public License as published by
* 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.
*
...
...
@@ -17,17 +17,16 @@
* 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 General Public License
* 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 D
ESCRIPTION
*
\
section D
escription
*
*
*
*/
**/
#ifndef _IODISPATCHER_H
#define
_IODISPATCHER_H
#define
_IODISPATCHER_H
#include
"OutputHandler.h"
#include
"../geometry/Building.h"
...
...
@@ -37,91 +36,157 @@
extern
OutputHandler
*
Log
;
class
IODispatcher
{
class
Trajectories
;
class
IODispatcher
{
private:
std
::
vector
<
OutputHandler
*
>
pHandlers
;
std
::
string
WritePed
(
Pedestrian
*
ped
);
std
::
vector
<
Trajectories
*>
_outputHandlers
;
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
();
virtual
~
IODispatcher
();
void
AddIO
(
Trajectories
*
ioh
);
const
std
::
vector
<
Trajectories
*>&
GetIOHandlers
();
void
WriteHeader
(
int
nPeds
,
double
fps
,
Building
*
building
,
int
seed
);
void
WriteGeometry
(
Building
*
building
);
void
WriteFrame
(
int
frameNr
,
Building
*
building
);
void
WriteFooter
();
};
class
Trajectories
{
public:
Trajectories
()
{
_outputHandler
=
NULL
;
};
virtual
~
Trajectories
(){};
virtual
void
WriteHeader
(
int
nPeds
,
double
fps
,
Building
*
building
,
int
seed
)
=
0
;
virtual
void
WriteGeometry
(
Building
*
building
)
=
0
;
virtual
void
WriteFrame
(
int
frameNr
,
Building
*
building
)
=
0
;
virtual
void
WriteFooter
()
=
0
;
void
Write
(
const
std
::
string
&
str
)
{
_outputHandler
->
Write
(
str
);
}
void
SetOutputHandler
(
OutputHandler
*
outputHandler
)
{
_outputHandler
=
outputHandler
;
}
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
;
}
}
protected:
OutputHandler
*
_outputHandler
;
};
class
Trajectories
FLAT
:
public
IODispatcher
{
class
Trajectories
JPSV04
:
public
Trajectories
{
public:
TrajectoriesFLAT
();
virtual
~
TrajectoriesFLAT
(){};
TrajectoriesJPSV04
(){};
virtual
~
TrajectoriesJPSV04
(){};
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
();
std
::
string
WritePed
(
Pedestrian
*
ped
);
};
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
TrajectoriesJPSV05
:
public
Trajectories
{
public:
TrajectoriesJPSV05
(){};
virtual
~
TrajectoriesJPSV05
(){};
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
{
class
TrajectoriesFLAT
:
public
Trajectories
{
public:
TrajectoriesVTK
();
virtual
~
TrajectoriesVTK
(){};
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
TrajectoriesXML_MESH
:
public
IODispatcher
{
class
TrajectoriesVTK
:
public
Trajectories
{
public:
TrajectoriesXML_MESH
(){};
virtual
~
TrajectoriesXML_MESH
(){};
TrajectoriesVTK
();
virtual
~
TrajectoriesVTK
()
{
}
;
//
virtual void WriteHeader(int nPeds, double fps, Building* building, int seed);
//
virtual void Write
Frame(int frameNr,
Building* building);
//
virtual void WriteF
ooter(
);
virtual
void
Write
Geometry
(
Building
*
building
);
virtual
void
WriteHeader
(
int
nPeds
,
double
fps
,
Building
*
building
,
int
seed
);
virtual
void
Write
Geometry
(
Building
*
building
);
virtual
void
WriteF
rame
(
int
frameNr
,
Building
*
building
);
virtual
void
Write
Footer
(
);
};
class
TrajectoriesJPSV06
:
public
IODispatcher
{
class
TrajectoriesXML_MESH
:
public
Trajectories
{
public:
TrajectoriesJPSV06
(){};
virtual
~
TrajectoriesJPSV06
(){};
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
();
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
);
};
#endif
/* _IODISPATCHER_H */
class
TrajectoriesJPSV06
:
public
Trajectories
{
public:
TrajectoriesJPSV06
(){};
virtual
~
TrajectoriesJPSV06
(){
};
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 */
IO/OutputHandler.cpp
View file @
cedfd5a7
/**
* File: OutputHandler.cpp
* \file OutputHandler.cpp
* \date Nov 20, 2010
* \version v0.5
* \copyright <2009-2014> Forschungszentrum Jülich GmbH. All rights reserved.
*
* Created on 20. November 2010, 15:20
*
* @section LICENSE
* \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 General Public License as published by