Commit b8c4d320 authored by Mohcine Chraibi's avatar Mohcine Chraibi

no calculations From time 0 to minPreMovementTime of all peds

sometimes from 0 to say 30 seconds no pedestrian will move. However,
the calculations are performed, which is slow and not necessary.

Check if actual time is smaller than the minPreMovementtime.
parent 7b813e8d
......@@ -497,13 +497,15 @@ int Simulation::RunBody(double maxSimTime)
while ( (_nPeds || !_agentSrcManager.IsCompleted() ) && t < maxSimTime)
{
t = 0 + (frameNr - 1) * _deltaT;
//process the queue for incoming pedestrians
ProcessAgentsQueue();
if(t>Pedestrian::GetMinPremovementTime())
{
//update the linked cells
_building->UpdateGrid();
// update the positions
_operationalModel->ComputeNextTimeStep(t, _deltaT, _building.get());
......@@ -517,7 +519,7 @@ int Simulation::RunBody(double maxSimTime)
//other updates
//someone might have left the building
_nPeds = _building->GetAllPedestrians().size();
}
// update the global time
Pedestrian::SetGlobalTime(t);
......
......@@ -61,7 +61,7 @@ int main(int argc, char **argv)
{
//evacuation time
int evacTime = 0;
Log->Write("INFO: \tStart runSimulation()");
Log->Write("INFO: \tStart runSimulation() with %d pedestrians", sim.GetPedsNumber());
#ifdef _USE_PROTOCOL_BUFFER
//Start the thread for managing incoming messages from MatSim
......
......@@ -120,15 +120,13 @@ void GCFMModel::ComputeNextTimeStep(double current, double deltaT, Building* bui
int partSize = nSize / nThreads;
int debugPed = -33;//10;
//building->GetGrid()->HighlightNeighborhood(debugPed, building);
#pragma omp parallel default(shared) num_threads(nThreads)
{
vector< Point > result_acc = vector<Point > ();
result_acc.reserve(2200);
const int threadID = omp_get_thread_num();
int start = threadID*partSize;
int end = (threadID + 1) * partSize - 1;
if ((threadID == nThreads - 1)) end = nSize - 1;
......
......@@ -125,7 +125,6 @@ void GompertzModel::ComputeNextTimeStep(double current, double deltaT, Building*
int partSize;
partSize = (int) (nSize / nThreads);
#pragma omp parallel default(shared) num_threads(nThreads)
{
vector< Point > result_acc = vector<Point > ();
......
......@@ -40,6 +40,7 @@ using namespace std;
// initialize the static variables
double Pedestrian::_globalTime = 0.0;
int Pedestrian::_agentsCreated=1;
double Pedestrian::_minPremovementTime = FLT_MAX;
AgentColorMode Pedestrian::_colorMode=BY_VELOCITY;
Pedestrian::Pedestrian()
......@@ -863,9 +864,17 @@ void Pedestrian::SetPatienceTime(double patienceTime)
void Pedestrian::SetPremovementTime(double pretime)
{
if(pretime < _minPremovementTime)
_minPremovementTime = pretime;
_premovement=pretime;
}
double Pedestrian::GetMinPremovementTime()
{
return _minPremovementTime;
}
double Pedestrian::GetPremovementTime()
{
return _premovement;
......
......@@ -125,6 +125,7 @@ private:
// the current time in the simulation
static double _globalTime;
static double _minPremovementTime;
static AgentColorMode _colorMode;
bool _spotlight;
......@@ -334,6 +335,12 @@ public:
*/
double GetPremovementTime();
/***
* Get min Premovement time of all pedestrians
*/
static double GetMinPremovementTime();
/**
* Set/Get the risk tolerance of a pedestrians.
* The value should be in the interval [0 1].
......
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