Time: Moved functionObject execution from "++" to "loop"

This change allows functionObjects to cleanly terminate the code e.g. on convergence.
This commit is contained in:
henry 2010-04-09 12:45:13 +01:00
parent 30dc12f140
commit f8ea34bc59

View File

@ -518,11 +518,28 @@ bool Foam::Time::loop()
if (running)
{
operator++();
if (!subCycling_)
{
readModifiedObjects();
if (timeIndex_ == startTimeIndex_)
{
functionObjects_.start();
}
else
{
functionObjects_.execute();
}
}
// Check update the "running" status following the "++" operation
// to take into account possible side-effects from functionObjects
running = run();
if (running)
{
operator++();
}
}
return running;
@ -667,20 +684,6 @@ Foam::Time& Foam::Time::operator+=(const scalar deltaT)
Foam::Time& Foam::Time::operator++()
{
if (!subCycling_)
{
readModifiedObjects();
if (timeIndex_ == startTimeIndex_)
{
functionObjects_.start();
}
else
{
functionObjects_.execute();
}
}
deltaT0_ = deltaTSave_;
deltaTSave_ = deltaT_;