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.
### Added
- Changelog file
- Rimea testcases
- 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
-
-
### Fixed
-
- Visiblity in 3D
-
### Fixed
......
......@@ -72,23 +72,28 @@ int main(int argc, char **argv)
//process the normal simulation
else
#endif
if(sim.GetAgentSrcManager().GetMaxAgentNumber())
{
//Start the threads for managing the sources of agents if any
std::thread t1(sim.GetAgentSrcManager());
//std::thread t1(&AgentsSourcesManager::Run, &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());
//main thread for the simulation
Log->Write("INFO: \tStart runSimulation()");
//evacTime = sim.RunSimulation(args->GetTmax());
evacTime = sim.RunStandardSimulation(args->GetTmax());
Log->Write("\nINFO: \tEnd runSimulation()");
time(&endtime);
//the execution is finished at this time
//so join the main thread
//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
......
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