Time: Fix logical error in re-evaluation of running state

An unintended change in the running-state logic was introduced by commit
9a35ce69. The running state should only be re-evaluated when in the
simulation is not ending. The "execute/end" function object invocation
should not be permitted to change the running state. The simulation
should always end if this state is reached.
This commit is contained in:
Will Bainbridge
2018-01-26 16:31:56 +00:00
parent a4ca234215
commit 9ed84852a7

View File

@ -786,7 +786,7 @@ bool Foam::Time::running() const
bool Foam::Time::run() const
{
const bool running = this->running();
bool running = this->running();
if (!subCycling_)
{
@ -812,23 +812,23 @@ bool Foam::Time::run() const
functionObjects_.execute();
}
}
// Re-evaluate if running in case a function object has changed things
running = this->running();
}
// Re-evaluate if running in case a function object has changed things
return this->running();
return running;
}
bool Foam::Time::loop()
{
const bool running = this->running();
if (run())
{
operator++();
}
return running;
return running();
}