Commit 692843a6 authored by Ulrich Kemloh's avatar Ulrich Kemloh

refactoring main. Launch an additional thread only when there are agents

sources.
parent 54f2f844
...@@ -6,14 +6,16 @@ All notable changes to this project will be documented in this file. ...@@ -6,14 +6,16 @@ All notable changes to this project will be documented in this file.
### Added ### Added
- Changelog file - Changelog file
- Rimea testcases - Rimea testcases
- risk tolerance factor (value in [0 1]) for pedestrian. Pedestrians with high values are likely to take more risks. - Boost testcases for geometry functions
- risk tolerance factor (value in [0 1]) for pedestrian. Pedestrians with high values are likely to take more risks.
- Sources for generating agents at runtime. Parameter are frequency(agents per seconds) and maximum number
### Changed ### Changed
- -
- -
### Fixed ### Fixed
- - Visiblity in 3D
- -
### Fixed ### Fixed
......
...@@ -72,24 +72,29 @@ int main(int argc, char **argv) ...@@ -72,24 +72,29 @@ int main(int argc, char **argv)
//process the normal simulation //process the normal simulation
else else
#endif #endif
{ if(sim.GetAgentSrcManager().GetMaxAgentNumber())
//Start the threads for managing the sources of agents if any {
std::thread t1(sim.GetAgentSrcManager()); //Start the thread for managing the sources of agents if any
//std::thread t1(sim.GetAgentSrcManager());
//std::thread t1(&AgentsSourcesManager::Run, &sim.GetAgentSrcManager()); std::thread t1(&AgentsSourcesManager::Run, &sim.GetAgentSrcManager());
//main thread for the simulation //main thread for the simulation
Log->Write("INFO: \tStart runSimulation()"); Log->Write("INFO: \tStart runSimulation()");
//evacTime = sim.RunSimulation(args->GetTmax()); evacTime = sim.RunStandardSimulation(args->GetTmax());
evacTime = sim.RunStandardSimulation(args->GetTmax()); Log->Write("\nINFO: \tEnd runSimulation()");
Log->Write("\nINFO: \tEnd runSimulation()"); time(&endtime);
time(&endtime);
//Join the main thread
//the execution is finished at this time t1.join();
//so join the main thread }
t1.join(); else
{
} //main thread for the simulation
Log->Write("INFO: \tStart runSimulation()");
evacTime = sim.RunStandardSimulation(args->GetTmax());
Log->Write("\nINFO: \tEnd runSimulation()");
time(&endtime);
}
// some statistics output // some statistics output
if(args->ShowStatistics()) if(args->ShowStatistics())
......
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