Commit cfc65f22 authored by Mohcine Chraibi's avatar Mohcine Chraibi

Add option for progressbar

<progressbar/>
parent 9e1bf36f
......@@ -2,7 +2,9 @@
All notable changes to this project will be documented in this file.
## v0.8.3 [unreleased]
### Added
- Router tests
- Option for printing progressbar: `<progressbar/>`
## v0.8.2 [2016-10-11]
Repository moved to [new server](https://gitlab.version.fz-juelich.de/jupedsim/jpscore)
......
......@@ -118,6 +118,12 @@ bool IniFileParser::Parse(std::string iniFile)
Log->Write("INFO: \tMaximal simulation time <%.2f> seconds", _config->GetTmax());
}
// Progressbar
if (xMainNode->FirstChild("progressbar")) {
_config->SetPRB(true);
Log->Write("INFO: \tUse Progressbar");
}
// geometry file name
if (xMainNode->FirstChild("geometry")) {
std::string filename = xMainNode->FirstChild("geometry")->FirstChild()->Value();
......
......@@ -460,7 +460,7 @@ double Simulation::RunBody(double maxSimTime)
ProcessAgentsQueue();
_nPeds = _building->GetAllPedestrians().size();
std::cout << "\n";
std::string description = "Evacuation of " + std::to_string(_nPeds) + " agents.";
std::string description = "Evacutation ";
ProgressBar *bar = new ProgressBar(_nPeds, description);
// bar->SetFrequencyUpdate(10);
#ifdef _WINDOWS
......@@ -510,7 +510,8 @@ double Simulation::RunBody(double maxSimTime)
if (0==frameNr%writeInterval) {
_iod->WriteFrame(frameNr/writeInterval, _building.get());
}
if(0 && !_gotSources && !_periodic /*&& _printPB*/) // @todo: option for print progressbar
if(!_gotSources && !_periodic && _config->print_prog_bar())
// Log->ProgressBar(initialnPeds, initialnPeds-_nPeds, t);
bar->Progressed(initialnPeds-_nPeds);
else
......@@ -518,6 +519,7 @@ double Simulation::RunBody(double maxSimTime)
(frameNr > 100 && frameNr % 100 == 0))
printf("time: %6.2f (%4.0f) | Agents: %6ld / %d [%4.1f%%]\n", t , maxSimTime, _nPeds, initialnPeds, (double)(initialnPeds-_nPeds)/initialnPeds*100);
// needed to control the execution time PART 2
// time(&endtime);
// double timeToWait=t-difftime(endtime, starttime);
......
......@@ -6,6 +6,7 @@ xsi:noNamespaceSchemaLocation="../../xsd/jps_ini_core.xsd">
<!-- seed used for initialising random generator -->
<seed>1254</seed>
<progressbar/>
<max_sim_time>200</max_sim_time>
<!-- geometry file -->
<geometry>corridor_geo.xml</geometry>
......
/**
* \file ArgumentParser.cpp
* \date Apr 20, 2009
* \version v0.7
* \copyright <2009-2015> Forschungszentrum Jülich GmbH. All rights reserved.
* \version v0.8
* \copyright <2009-2018> Forschungszentrum Jülich GmbH. All rights reserved.
*
* \section License
* This file is part of JuPedSim.
......
......@@ -62,6 +62,7 @@ public:
_linkedCellSize = 2.2; // meter
_model = nullptr;//std::shared_ptr<OperationalModel>(new OperationalModel());
_tMax = 500; // seconds
_PRB = false;
_dT = 0.01;
_isPeriodic = 0; // use only for Tordeux2015 with "trivial" geometries
// ----------- GCFM repulsive force ------
......@@ -133,6 +134,9 @@ public:
void SetPort(int port) { _port = port; };
void SetPRB(bool prb) {_PRB = prb; };
bool print_prog_bar() const {return _PRB; };
unsigned int GetSeed() const { return _seed; };
void SetSeed(unsigned int seed) { _seed = seed; };
......@@ -327,6 +331,7 @@ private:
double _linkedCellSize;
std::shared_ptr<OperationalModel> _model;
double _tMax;
bool _PRB;
double _dT;
int _isPeriodic;
double _nuPed;
......
......@@ -62,8 +62,9 @@
#define JPS_OLD_VERSION "0.5" // this version is still supported
#define JPS_VERSION_MINOR "8"
#define JPS_VERSION_MAJOR "0"
#define JPS_PATCH_VERSION "2"
#define JPS_VERSION JPS_VERSION_MAJOR "." JPS_VERSION_MINOR
#define JPS_VERSION JPS_VERSION_MAJOR "." JPS_VERSION_MINOR "." JPS_PATCH_VERSION
// disable openmp in debug mode
#ifdef _NDEBUG
......
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