Commit 5a3cf6d6 authored by Mohcine Chraibi's avatar Mohcine Chraibi

1. Doxygen with cmake.

2. add Doxifile.in
3. Documentation
4. add dir doc for jpscore
5. documentation of new model Gompertz.
parent af126578
......@@ -3,6 +3,7 @@
/bin/
/Debug
/Release
/doc/html
*~
# Compiled Object files
......
......@@ -75,6 +75,18 @@ 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)
# add a target to generate API documentation with Doxygen
find_package(Doxygen)
if(DOXYGEN_FOUND)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
add_custom_target(doc
${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Generating API documentation with Doxygen" VERBATIM
)
endif(DOXYGEN_FOUND)
#find the correct OpenMP flag
FIND_PACKAGE(OpenMP)
if(OPENMP_FOUND)
......
......@@ -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
......
/**
* @file Simulation.cpp
* @file Simulation.cpp
* @date Created on: Dec 15, 2010
* Copyright (C) <2009-2011>
*
......
......@@ -19,13 +19,12 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with JuPedSim. If not, see <http://www.gnu.org/licenses/>.
* along with JuPedSim. If not, see <a href="http://www.gnu.org/licenses/">GNU LICENCE</a>.
*
* @section DESCRIPTION
*
*
*/
/**
* @mainpage
*
......@@ -33,14 +32,13 @@
*
* JuPedSim stands for Jülich Pedestrians Simulator and is currently developed at the Forschungszentrum Jülich in Germany.
*
* @image html logo.png " "
*
*
* Some useful links:
*
* 1: <a href="http://www.openpedsim.org">www.openpedsim.org</a> <br>
* 1: <A HREF="http://www.openpedsim.org">www.openpedsim.org</A> <BR>
* 2: <a href="http://www.vtk.org">www.vtk.org</a> <br>
* 3: <a href="http://www.digia.com/">www.digia.com</a> <br>
* 4: <a href="http://www.fz-juelich.de">www.fz-juelich.de</a> <br>
* 3: <a href="http://www.fz-juelich.de">www.fz-juelich.de</a> <br>
* 4: <a href="http://www.jupedsim.org">www.fz-juelich.de</a> <br>
*
*/
......@@ -49,6 +47,7 @@
#include "general/ArgumentParser.h"
#include "Simulation.h"
///global unique log variable
OutputHandler* Log;
......
/**
* File: ForceModel.cpp
* @file ForceModel.cpp
*
* Created on 13. December 2010, 15:05
* @date 13. December 2010, 15:05
*
* @section LICENSE
* This file is part of JuPedSim.
......@@ -20,7 +20,7 @@
* along with JuPedSim. If not, see <http://www.gnu.org/licenses/>.
*
* @section DESCRIPTION
*
* Implementation of the GCFM and the Gompertz model
*
*
*/
......@@ -51,16 +51,8 @@ ForceModel::~ForceModel() {
GCFM ForceModel
************************************************************/
// Private Funktionen
/* treibende Kraft
* Parameter:
* - ped: Fußgänger für den die Kraft berechnet wird
* - room: Raum (mit SubRooms) in dem das Ziel gesucht wird
* Rückgabewerte:
* - Vektor(x,y) zum Ziel
* */
inline Point GCFMModel::ForceDriv(Pedestrian* ped, Room* room) const {
inline Point GCFMModel::ForceDriv(Pedestrian* ped, Room* room) const {
const Point& target = _direction->GetTarget(room, ped);
Point F_driv;
const Point& pos = ped->GetPos();
......@@ -80,13 +72,6 @@ inline Point GCFMModel::ForceDriv(Pedestrian* ped, Room* room) const {
return F_driv;
}
/* abstoßende Kraft zwischen ped1 und ped2
* Parameter:
* - ped1: Fußgänger für den die Kraft berechnet wird
* - ped2: Fußgänger mit dem die Kraft berechnet wird
* Rückgabewerte:
* - Vektor(x,y) mit abstoßender Kraft
* */
Point GCFMModel::ForceRepPed(Pedestrian* ped1, Pedestrian* ped2) const {
Point F_rep;
......@@ -143,6 +128,7 @@ Point GCFMModel::ForceRepPed(Pedestrian* ped1, Pedestrian* ped2) const {
//todo: runtime normsquare?
if (distp12.Norm() >= J_EPS) {
ep12 = distp12.Normalized();
} else {
Log->Write("ERROR: \tin GCFMModel::forcePedPed() ep12 kann nicht berechnet werden!!!\n");
Log->Write("ERROR:\t fix this as soon as possible");
......@@ -572,11 +558,106 @@ void GCFMModel::CalculateForceLC(double time, double tip1, Building* building) c
}//end parallel
//update the CA Model
UpdateCellularModel(building);
//UpdateCellularModel(building);
}
void GCFMModel::UpdateCellularModel(Building* building) const {
// void GCFMModel::UpdateCellularModel(Building* building) const {
const vector< Pedestrian* >& allPeds = building->GetAllPedestrians();
// const vector< Pedestrian* >& allPeds = building->GetAllPedestrians();
// }
/************************************************************
Gompertz ForceModel
************************************************************/
Point GompertzModel::ForceDriv(Pedestrian* ped, Room* room) const {
const Point& target = _direction->GetTarget(room, ped);
Point F_driv;
const Point& pos = ped->GetPos();
double dist = ped->GetExitLine()->DistTo(pos);
if (dist > J_EPS_GOAL) {
const Point& v0 = ped->GetV0(target);
//printf("MC v0= [%.2f %.2f]\n", v0.GetX(), v0.GetY());
//fprintf(stderr, "%.2f %.2f %.2f %.2f %f %f\n", v0.GetX(), v0.GetY(), pos.GetX(), pos.GetY(), target.GetX(), target.GetY());
F_driv = ((v0 * ped->GetV0Norm() - ped->GetV()) * ped->GetMass()) / ped->GetTau();
} else {
const Point& v0 = ped->GetV0();
//fprintf(stderr, "%.2f %.2f %.2f %.2f %f %f\n", v0.GetX(), v0.GetY(), pos.GetX(), pos.GetY(), target.GetX(), target.GetY());
F_driv = ((v0 * ped->GetV0Norm() - ped->GetV()) * ped->GetMass()) / ped->GetTau();
}
return F_driv;
}
Point GompertzModel::ForceRepPed(Pedestrian* ped1, Pedestrian* ped2) const {
Point F_rep = Point(0.0, 0.0);;
// x- and y-coordinate of the distance between p1 and p2
Point distp12 = ped2->GetPos() - ped1->GetPos();
const Point& vp1 = ped1->GetV(); // v Ped1
//const Point& vp2 = ped2->GetV(); // v Ped2
Point ep12; // x- and y-coordinate of the normalized vector between p1 and p2
double K_ij, B_ij, f;
const JEllipse& E1 = ped1->GetEllipse();
const JEllipse& E2 = ped2->GetEllipse();
Point AP1inE1 = E1.GetCenter();
Point AP2inE2 = E2.GetCenter();
// ActionPoint von E1 in Koordinaten von E2 (transformieren)
Point AP1inE2 = AP1inE1.CoordTransToEllipse(E2.GetCenter(), E2.GetCosPhi(), E2.GetSinPhi());
// ActionPoint von E2 in Koordinaten von E1 (transformieren)
Point AP2inE1 = AP2inE2.CoordTransToEllipse(E1.GetCenter(), E1.GetCosPhi(), E1.GetSinPhi());
double r1 = (AP1inE1 - E1.PointOnEllipse(AP2inE1)).Norm();
double r2 = (AP2inE2 - E2.PointOnEllipse(AP1inE2)).Norm();
double Distance = distp12.Norm();
if (Distance >= J_EPS) {
ep12 = distp12.Normalized();
}
else {
Log->Write("ERROR: \tin GompertzModel::forcePedPed() ep12 can not be calculated!!!\n");
Log->Write("ERROR:\t Pedestrians are too near to each other.");
Log->Write("ERROR:\t How come? Are they the same? Get your model right. Going to exit.");
return F_rep; // should never happen
exit(0);
}
double vp1_sq = vp1.ScalarP(vp1);
if (vp1_sq < J_EPS_V*J_EPS_V){ // if(norm(v_i)==0)
K_ij = 0;
}
else{ // calculate K_ij
double tmp = vp1.ScalarP(ep12); // < v_i , e_ij >
double bla = tmp + fabs(tmp);
K_ij = 0.25 * bla * bla / vp1_sq; //squared
if (K_ij < J_EPS * J_EPS){
return F_rep;
}
K_ij = sqrt(K_ij);
}
// calculate B_ij
B_ij = 1.0 - Distance/(r1 + r2);
double b=1, c=1; //Gompertz-function parameter. TODO: Check later if other values are more appropriate
B_ij = exp(-b*exp(-c*B_ij));
f = -ped1->GetMass() * ped1->GetV0Norm() * K_ij * B_ij;
F_rep = ep12 * f;
//check isNan
if (F_rep.GetX() != F_rep.GetX() || F_rep.GetY() != F_rep.GetY()) {
char tmp[CLENGTH];
sprintf(tmp, "\nNAN return ----> p1=%d p2=%d Frepx=%f, Frepy=%f\n", ped1->GetID(),
ped2->GetID(), F_rep.GetX(), F_rep.GetY());
Log->Write(tmp);
Log->Write("ERROR:\t fix this as soon as possible");
return Point(0,0); // FIXME: should never happen
exit(0);
}
return F_rep;
}
Point ForceRepRoom(Pedestrian* ped, SubRoom* subroom){
};
Point ForceRepWall(Pedestrian* ped, const Wall& l){
}
/**
* File: ForceModel.h
* @file ForceModel.h
*
* Created on 13. December 2010, 15:05
* @brief Implementation of classes for some force-based models
*
* @section LICENSE
* This file is part of JuPedSim.
* 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
......@@ -20,11 +20,15 @@
* along with JuPedSim. If not, see <http://www.gnu.org/licenses/>.
*
* @section DESCRIPTION
* Implementation of classes for force-based models.
* Actually we've got two different models:
* 1. Generalized Centrifugal Force Model
* 2. Gompertz Model
*
*
*
* @date Tue Apr 15 19:19:04 2014
*/
//
#ifndef _FORCEMODEL_H
#define _FORCEMODEL_H
......@@ -70,20 +74,46 @@ public:
class GCFMModel : public ForceModel {
private:
/// define the strategy for crossing a door (used for calculating the driving force)
DirectionStrategy* _direction;
DirectionStrategy* _direction;
// Modellparameter
double _nuPed;
double _nuWall;
double _intp_widthPed; // Interpolation cutoff radius (in cm)
double _intp_widthWall; // Interpolation cutoff radius (in cm)
double _nuPed; /**< strength of the pedestrian repulsive force */
double _nuWall; /**< strength of the wall repulsive force */
double _intp_widthPed; /**< Interpolation cutoff radius (in cm) */
double _intp_widthWall; /**< Interpolation cutoff radius (in cm) */
double _maxfPed;
double _maxfWall;
double _distEffMaxPed; // maximal effective distance
double _distEffMaxWall; // maximal effective distance
// Private Funktionen
/**
* Driving force \f$ F_i =\frac{\mathbf{v_0}-\mathbf{v_i}}{\tau}\f$
*
* @param ped Pointer to Pedestrians
* @param room Pointer to Room
*
* @return Point
*/
Point ForceDriv(Pedestrian* ped, Room* room) const;
/**
* Repulsive force between two pedestrians ped1 and ped2 according to
* the Generalized Centrifugal Force Model (chraibi2010a)
*
* @param ped1 Pointer to Pedestrian: First pedestrian
* @param ped2 Pointer to Pedestrian: Second pedestrian
*
* @return Point
*/
Point ForceRepPed(Pedestrian* ped1, Pedestrian* ped2) const;
/**
* Repulsive force acting on pedestrian <ped> from the walls in
* <subroom>. The sum of all repulsive forces of the walls in <subroom> is calculated
* @see ForceRepWall
* @param ped Pointer to Pedestrian
* @param subroom Pointer to SubRoom
*
* @return
*/
Point ForceRepRoom(Pedestrian* ped, SubRoom* subroom) const;
Point ForceRepWall(Pedestrian* ped, const Wall& l) const;
Point ForceRepStatPoint(Pedestrian* ped, const Point& p, double l, double vn) const;
......@@ -107,7 +137,7 @@ public:
double GetDistEffMaxWall() const;
void UpdateCellularModel(Building* building) const;
//void UpdateCellularModel(Building* building) const;
// virtuelle Funktionen
virtual void CalculateForce(double time, std::vector< Point >& result_acc, Building* building,
......@@ -119,26 +149,66 @@ public:
/************************************************************
GOMPERTZ ForceModel
************************************************************/
/**
* Class defining the Gompertz model
*
*
*
*/
class GompertzModel : public ForceModel {
private:
/// define the strategy for crossing a door (used for calculating the driving force)
DirectionStrategy* _direction;
// Modellparameter
/// Modellparameter
double _nuPed;
double _nuWall;
// Private Funktionen
/**
* Driving force \f$ F_i =\frac{\mathbf{v_0}-\mathbf{v_i}}{\tau}\$
* This is a duplicate of @see GCFMModel::ForceDriv
* @param ped Pointer to Pedestrians
* @param room Pointer to Room
*
*
* @return Point
*/
Point ForceDriv(Pedestrian* ped, Room* room) const;
/**
* Repulsive force between two pedestrians ped1 and ped2 according to
* the Gompertz model (unpublished)
*
* @param ped1 Pointer to Pedestrian: First pedestrian
* @param ped2 Pointer to Pedestrian: Second pedestrian
*
* @return Point
*/
Point ForceRepPed(Pedestrian* ped1, Pedestrian* ped2) const;
/**
* Repulsive force acting on pedestrian <ped> from the walls in
* <subroom>. The sum of all repulsive forces of the walls in <subroom> is calculated
* @see ForceRepWall
* @param ped Pointer to Pedestrian
* @param subroom Pointer to SubRoom
*
* @return
*/
Point ForceRepRoom(Pedestrian* ped, SubRoom* subroom) const;
/**
* Repulsive force between pedestrian <ped> and wall <l>
*
* @param ped Pointer to Pedestrian
* @param l reference to Wall
*
* @return
*/
Point ForceRepWall(Pedestrian* ped, const Wall& l) const;
public:
GompertzModel(DirectionStrategy* dir, double nuped, double nuwall);
virtual ~GompertzModel(void);
// Getter
DirectionStrategy* GetDirection() const;
double GetNuPed() const;
double GetNuWall() const;
......
......@@ -37,7 +37,7 @@ DirectionStrategy::DirectionStrategy(const DirectionStrategy& orig) {
DirectionStrategy::~DirectionStrategy() {
}
//@{
Point DirectionMiddlePoint::GetTarget(Room* room, Pedestrian* ped) const {
return (ped->GetExitLine()->GetPoint1() + ped->GetExitLine()->GetPoint2())*0.5;
}
......@@ -83,8 +83,16 @@ Point DirectionInRangeBottleneck::GetTarget(Room* room, Pedestrian* ped) const {
}
// this strategy should work without Hlines for a general geometry.
Point DirectionGeneral::GetTarget(Room* room, Pedestrian* ped) const {
/**
* this strategy is designed to work without Hlines for a general geometry.
* First tested for bottlenecks and corners.
* @param room Pointer
* @param ped Pointer to Pedestrians
*
* @todo Need more tests e.g. for complex geometries.
* @todo Need refactoring: Put the WALL and OBS loops in appropriate functions
* @return Target (Point)
*/Point DirectionGeneral::GetTarget(Room* room, Pedestrian* ped) const {
using namespace std;
const Point& p1 = ped->GetExitLine()->GetPoint1();
const Point& p2 = ped->GetExitLine()->GetPoint2();
......@@ -128,7 +136,7 @@ using namespace std;
for(unsigned int obs=0; obs<obstacles.size(); ++obs){
const vector<Wall>& owalls = obstacles[obs]->GetAllWalls();
for (unsigned int i = 0; i < owalls.size(); i++) {
dist = tmpDirection.GetIntersectionDistance(owalls[i]);
dist = tmpDirection.GetIntersectionDistance(owalls[i]);
printf("Check OBS:obs=%d, i=%d Dist = %f (%f)\n", obs, i, dist, minDist);
if (dist < minDist)
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment