Commit 7a351266 authored by Ulrich Kemloh's avatar Ulrich Kemloh

Fixed an error which prevented the simulation to shutdown properly when using agent sources

parent 141fff30
......@@ -16,7 +16,7 @@ All notable changes to this project will be documented in this file.
### Fixed
- Visiblity in 3D
-
- Numerous geometrical operations
### Fixed
-
......
......@@ -158,7 +158,7 @@ void TrajectoriesJPSV04::WriteGeometry(Building* building)
// first the rooms
//to avoid writing navigation line twice
vector<int> navLineWritten;
rooms_to_plot.push_back("U9");
//rooms_to_plot.push_back("U9");
for (const auto& it:building->GetAllRooms())
{
......
......@@ -150,7 +150,7 @@ bool Simulation::InitArgs(const ArgumentParser& args)
case FORMAT_XML_PLAIN: {
OutputHandler* tofile = new FileHandler(
args.GetTrajectoriesFile().c_str());
Trajectories* output = new TrajectoriesJPSV04();
Trajectories* output = new TrajectoriesJPSV05();
output->SetOutputHandler(tofile);
_iod->AddIO(output);
break;
......
......@@ -23,7 +23,7 @@
using namespace std;
bool AgentsSourcesManager::_isCompleted=false;
bool AgentsSourcesManager::_isCompleted=true;
AgentsSourcesManager::AgentsSourcesManager()
{
......@@ -42,7 +42,6 @@ void AgentsSourcesManager::Run()
{
Log->Write("INFO:\tStarting agent manager thread");
//Generate all agents required for the complete simulation
//It might be more efficient to generate at each frequency step
for (const auto& src : _sources)
......@@ -62,25 +61,17 @@ void AgentsSourcesManager::Run()
{
int current_time = Pedestrian::GetGlobalTime();
//first step
//if(current_time==0){
//finished=ProcessAllSources();
// ProcessAllSources();
// //cout<<"here:"<<endl; exit(0);
//}
if ((current_time != _lastUpdateTime)
&& ((current_time % updateFrequency) == 0))
{
//cout<<"TIME:"<<current_time<<endl;
finished=ProcessAllSources();
_lastUpdateTime = current_time;
//cout << "source size: " << _sources.size() << endl;
}
//wait some time
//std::this_thread::sleep_for(std::chrono::milliseconds(1));
} while (!finished);
Log->Write("INFO:\tTerminating agent manager thread");
_isCompleted = true;//exit(0);
_isCompleted = true;
}
bool AgentsSourcesManager::ProcessAllSources() const
......@@ -442,6 +433,7 @@ void AgentsSourcesManager::GenerateAgents()
void AgentsSourcesManager::AddSource(std::shared_ptr<AgentsSource> src)
{
_sources.push_back(src);
_isCompleted=false;//at least one source was provided
}
const std::vector<std::shared_ptr<AgentsSource> >& AgentsSourcesManager::GetSources() const
......
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