From 845c464a8eb8f1905109675c841f02b7b373ac09 Mon Sep 17 00:00:00 2001 From: hiwis <hiwis@irmb.tu-bs.de> Date: Wed, 13 Mar 2019 14:18:20 +0100 Subject: [PATCH] add method calculateJunctionStep() to TrafficMovement --- src/Traffic/TrafficMovement.cpp | 14 +++++++++----- src/Traffic/TrafficMovement.h | 1 + 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/Traffic/TrafficMovement.cpp b/src/Traffic/TrafficMovement.cpp index 47f046157..c47970898 100644 --- a/src/Traffic/TrafficMovement.cpp +++ b/src/Traffic/TrafficMovement.cpp @@ -131,17 +131,14 @@ void TrafficMovement::calculateTimestep(uint step) VectorHelper::fillVector(*pnext, -1); if (concWriter != nullptr) concWriter->resetConcentrations(); - //apply rules on all cars + //apply rules on all cars for (uint i = 0; i < road->roadLength; i++) { if ((*pcurrent)[i] > -1) { applyRules(i); } } - for (auto &junction : road->junctions) { - junction->updateJunction(); - junction->calculateTimeStep(*this); - } + calculateJunctionStep(); calculateSourceStep(); @@ -168,6 +165,13 @@ void TrafficMovement::calculateSourceStep() } } +void TrafficMovement::calculateJunctionStep() +{ + for (auto &junction : road->junctions) { + junction->updateJunction(); + junction->calculateTimeStep(*this); + } +} void TrafficMovement::switchCurrentNext() { diff --git a/src/Traffic/TrafficMovement.h b/src/Traffic/TrafficMovement.h index f3f9a354d..b02d2ee39 100644 --- a/src/Traffic/TrafficMovement.h +++ b/src/Traffic/TrafficMovement.h @@ -52,6 +52,7 @@ private: //calculate timestep void calculateSourceStep(); + void calculateJunctionStep(); void switchCurrentNext(); //gap -- GitLab