From d4ca02cf7e76e7abd477cd0616899a571520fadc Mon Sep 17 00:00:00 2001 From: mattijs Date: Thu, 15 Apr 2010 12:22:56 +0100 Subject: [PATCH] BUG: using Time::run() as a loop construct was not doing the functionObjects. --- src/OpenFOAM/db/Time/Time.C | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/OpenFOAM/db/Time/Time.C b/src/OpenFOAM/db/Time/Time.C index 36bccb3911..35525f65f4 100644 --- a/src/OpenFOAM/db/Time/Time.C +++ b/src/OpenFOAM/db/Time/Time.C @@ -508,19 +508,11 @@ bool Foam::Time::run() const } } - return running; -} - - -bool Foam::Time::loop() -{ - bool running = run(); - if (running) { if (!subCycling_) { - readModifiedObjects(); + const_cast(*this).readModifiedObjects(); if (timeIndex_ == startTimeIndex_) { @@ -532,14 +524,22 @@ bool Foam::Time::loop() } } - // Check update the "running" status following the "++" operation - // to take into account possible side-effects from functionObjects - running = run(); + // Update the "running" status following the + // possible side-effects from functionObjects + running = value() < (endTime_ - 0.5*deltaT_); + } - if (running) - { - operator++(); - } + return running; +} + + +bool Foam::Time::loop() +{ + bool running = run(); + + if (running) + { + operator++(); } return running;