Added Time::loop() to allow the
while(runTime.loop()) { ... } idiom. Demonstrated in the shallowWaterFoam solver.
This commit is contained in:
parent
fcd4e88e0e
commit
aa6710901e
@ -48,10 +48,8 @@ int main(int argc, char *argv[])
|
||||
|
||||
Info<< "\nStarting time loop\n" << endl;
|
||||
|
||||
while (runTime.run())
|
||||
while (runTime.loop())
|
||||
{
|
||||
runTime++;
|
||||
|
||||
Info<< "\n Time = " << runTime.timeName() << nl << endl;
|
||||
|
||||
#include "readPISOControls.H"
|
||||
|
@ -507,6 +507,19 @@ bool Foam::Time::run() const
|
||||
}
|
||||
|
||||
|
||||
bool Foam::Time::loop()
|
||||
{
|
||||
bool running = run();
|
||||
|
||||
if (running)
|
||||
{
|
||||
operator++();
|
||||
}
|
||||
|
||||
return running;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::Time::end() const
|
||||
{
|
||||
return value() > (endTime_ + 0.5*deltaT_);
|
||||
|
@ -352,7 +352,7 @@ public:
|
||||
// also invokes the functionObjectList::end() method
|
||||
// when the time goes out of range
|
||||
// @note
|
||||
// For correct baheviour, the following style of time-loop
|
||||
// For correct behaviour, the following style of time-loop
|
||||
// is recommended:
|
||||
// @code
|
||||
// while (runTime.run())
|
||||
@ -364,6 +364,21 @@ public:
|
||||
// @endcode
|
||||
virtual bool run() const;
|
||||
|
||||
//- Return true if run should continue and if so increment time
|
||||
// also invokes the functionObjectList::end() method
|
||||
// when the time goes out of range
|
||||
// @note
|
||||
// For correct behaviour, the following style of time-loop
|
||||
// is recommended:
|
||||
// @code
|
||||
// while (runTime.loop())
|
||||
// {
|
||||
// solve;
|
||||
// runTime.write();
|
||||
// }
|
||||
// @endcode
|
||||
virtual bool loop();
|
||||
|
||||
//- Return true if end of run,
|
||||
// does not invoke any functionObject methods
|
||||
// @note
|
||||
|
Loading…
Reference in New Issue
Block a user