mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
change solvers, utilities, etc. to use while (..) time-looping idiom
- this (now deprecated) idiom:
for (runTime++; !runTime.end(); runTime++) { ... }
has a few problems:
* stop-on-next-write will be off-by-one (ie, doesn't work)
* function objects are not executed on exit with runTime.end()
Fixing these problems is not really possible.
- this idiom
while (runTime.run())
{
runTime++;
...
}
works without the above problems.
This commit is contained in:
@ -46,8 +46,9 @@ int main(int argc, char *argv[])
|
||||
# include "createTime.H"
|
||||
# include "createDynamicFvMesh.H"
|
||||
|
||||
for (runTime++; !runTime.end(); runTime++)
|
||||
while (runTime.run())
|
||||
{
|
||||
runTime++;
|
||||
Info<< "Time = " << runTime.timeName() << endl;
|
||||
|
||||
mesh.update();
|
||||
|
||||
@ -47,8 +47,9 @@ int main(int argc, char *argv[])
|
||||
|
||||
Info<< "\nStarting time loop\n" << endl;
|
||||
|
||||
for (runTime++; !runTime.end(); runTime++)
|
||||
while (runTime.run())
|
||||
{
|
||||
runTime++;
|
||||
Info<< "Time = " << runTime.theta() << " CA-deg\n" << endl;
|
||||
|
||||
mesh.move();
|
||||
|
||||
@ -46,8 +46,9 @@ int main(int argc, char *argv[])
|
||||
|
||||
autoPtr<Foam::motionSolver> motionPtr = motionSolver::New(mesh);
|
||||
|
||||
for (runTime++; !runTime.end(); runTime++)
|
||||
while (runTime.run())
|
||||
{
|
||||
runTime++;
|
||||
Info<< "Time = " << runTime.timeName() << endl;
|
||||
|
||||
mesh.movePoints(motionPtr->newPoints());
|
||||
|
||||
Reference in New Issue
Block a user