Simulation.h 3.53 KB
Newer Older
1
/**
Ulrich Kemloh's avatar
Ulrich Kemloh committed
2 3
 * \file        Simulation.h
 * \date        Dec 15, 2010
4
 * \version     v0.6
5
 * \copyright   <2009-2014> Forschungszentrum J?lich GmbH. All rights reserved.
6
 *
Ulrich Kemloh's avatar
Ulrich Kemloh committed
7
 * \section License
8 9 10
 * This file is part of JuPedSim.
 *
 * JuPedSim is free software: you can redistribute it and/or modify
11
 * it under the terms of the GNU Lesser General Public License as published by
12 13 14 15 16 17 18 19
 * 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.
 *
20
 * You should have received a copy of the GNU Lesser General Public License
21 22
 * along with JuPedSim. If not, see <http://www.gnu.org/licenses/>.
 *
Ulrich Kemloh's avatar
Ulrich Kemloh committed
23
 * \section Description
24 25 26 27
 * The Simulation class represents a simulation of pedestrians
 * based on a certain model in a specific scenario. A simulation is defined by
 * various parameters and functions.
 *
Ulrich Kemloh's avatar
Ulrich Kemloh committed
28 29 30 31
 *
 **/


Ulrich Kemloh's avatar
Ulrich Kemloh committed
32 33 34 35

#ifndef SIMULATION_H_
#define SIMULATION_H_

36

Ulrich Kemloh's avatar
Ulrich Kemloh committed
37 38 39 40
#include "general/ArgumentParser.h"
#include "geometry/Building.h"
#include "IO/OutputHandler.h"
#include "IO/IODispatcher.h"
41
#include "math/OperationalModel.h"
Ulrich Kemloh's avatar
Ulrich Kemloh committed
42 43 44 45
#include "math/ODESolver.h"
#include "routing/GlobalRouter.h"
#include "routing/QuickestPathRouter.h"
#include "routing/DirectionStrategy.h"
46
#include "routing/DummyRouter.h"
47
#include "routing/GraphRouter.h"
48
#include "routing/MeshRouter.h"
49
#include "routing/RoutingEngine.h"
50
#include "routing/SafestPathRouter.h"
Ulrich Kemloh's avatar
Ulrich Kemloh committed
51
#include "pedestrian/PedDistributor.h"
52
#include "events/EventManager.h"
53
#include "routing/CognitiveMapRouter.h"
54
#include <memory>
Ulrich Kemloh's avatar
Ulrich Kemloh committed
55

56 57
class Simulation
{
58 59
private:

60
	///Number of pedestrians in the simulation
61
    long _nPeds;
62 63 64 65 66 67
    ///Maximum simulation time
    double _tmax;
    /// time step
    double _deltaT;
    /// frame rate for the trajectories
    double _fps;
68 69
    ///seed using for the random number generator
    unsigned int _seed;
70 71 72
    /// building object
    Building* _building;
    ///initial distribution of the pedestrians
73
    std::unique_ptr<PedDistributor> _distribution;
74
    /// door crossing strategy for the pedestrians
75
    //DirectionStrategy* _direction;
76
    /// Force model to use
77
    std::shared_ptr<OperationalModel> _operationalModel;
78 79 80 81
    /// differential equation solver
    ODESolver* _solver;
    /// writing the trajectories to file
    IODispatcher* _iod;
82
    ///new: EventManager
83
    EventManager* _em;
84
    /// argument parser
85
    ArgumentParser _argsParser;
86
    /// profiling flag
87
    bool _profiling;
88
    /// architecture flag
89
    int _hpc;
90 91

public:
92
    Simulation(const ArgumentParser& args);
Ulrich Kemloh's avatar
Ulrich Kemloh committed
93
    virtual ~Simulation();
94 95 96 97 98 99 100 101 102

    /**
     * Initialize the number of agents in the simulation
     */
    int GetPedsNumber() const;

    /**
     * Read parameters from the argument parser class.
     */
103
    bool InitArgs(const ArgumentParser& args);
104 105 106 107

    /**
     * @return the total simulated/evacuation time
     */
Ulrich Kemloh's avatar
Ulrich Kemloh committed
108
    int RunSimulation();
109 110

    /**
111
     * Updathe route of the pedestrians and reassign rooms, in the case a room change happens
112
     */
113 114 115
    void UpdateRoutesAndLocations();


116
    //void Update(double &b, double &p, double &t, double &g);
117 118 119 120 121 122 123 124 125 126

    /**
     * Set the ProfilingFlag
     */
    void SetProfileFlag(bool flag);

    /**
     * Get the ProfileFlag
     */
    bool GetProfileFlag();
127

128 129 130 131
    /**
     * Get the HPCFlag
     */
    int GetHPCFlag();
Ulrich Kemloh's avatar
Ulrich Kemloh committed
132

133 134 135 136
    /**
     * print some statistics about the simulation
     */
    void PrintStatistics();
Ulrich Kemloh's avatar
Ulrich Kemloh committed
137

Ulrich Kemloh's avatar
Ulrich Kemloh committed
138 139 140
};

#endif /*SIMULATION_H_*/