mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Added Time::loop() to allow the
while(runTime.loop())
{
...
}
idiom.
Demonstrated in the shallowWaterFoam solver.
This commit is contained in:
@ -48,10 +48,8 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
Info<< "\nStarting time loop\n" << endl;
|
Info<< "\nStarting time loop\n" << endl;
|
||||||
|
|
||||||
while (runTime.run())
|
while (runTime.loop())
|
||||||
{
|
{
|
||||||
runTime++;
|
|
||||||
|
|
||||||
Info<< "\n Time = " << runTime.timeName() << nl << endl;
|
Info<< "\n Time = " << runTime.timeName() << nl << endl;
|
||||||
|
|
||||||
#include "readPISOControls.H"
|
#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
|
bool Foam::Time::end() const
|
||||||
{
|
{
|
||||||
return value() > (endTime_ + 0.5*deltaT_);
|
return value() > (endTime_ + 0.5*deltaT_);
|
||||||
|
|||||||
@ -352,7 +352,7 @@ public:
|
|||||||
// also invokes the functionObjectList::end() method
|
// also invokes the functionObjectList::end() method
|
||||||
// when the time goes out of range
|
// when the time goes out of range
|
||||||
// @note
|
// @note
|
||||||
// For correct baheviour, the following style of time-loop
|
// For correct behaviour, the following style of time-loop
|
||||||
// is recommended:
|
// is recommended:
|
||||||
// @code
|
// @code
|
||||||
// while (runTime.run())
|
// while (runTime.run())
|
||||||
@ -364,6 +364,21 @@ public:
|
|||||||
// @endcode
|
// @endcode
|
||||||
virtual bool run() const;
|
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,
|
//- Return true if end of run,
|
||||||
// does not invoke any functionObject methods
|
// does not invoke any functionObject methods
|
||||||
// @note
|
// @note
|
||||||
|
|||||||
Reference in New Issue
Block a user