Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Development
openfoam
Commits
aa671090
Commit
aa671090
authored
Feb 17, 2009
by
henry
Browse files
Added Time::loop() to allow the
while(runTime.loop()) { ... } idiom. Demonstrated in the shallowWaterFoam solver.
parent
fcd4e88e
Changes
3
Hide whitespace changes
Inline
Side-by-side
applications/solvers/incompressible/shallowWaterFoam/shallowWaterFoam.C
View file @
aa671090
...
...
@@ -48,10 +48,8 @@ int main(int argc, char *argv[])
Info
<<
"
\n
Starting time loop
\n
"
<<
endl
;
while
(
runTime
.
run
())
while
(
runTime
.
loop
())
{
runTime
++
;
Info
<<
"
\n
Time = "
<<
runTime
.
timeName
()
<<
nl
<<
endl
;
#include
"readPISOControls.H"
...
...
src/OpenFOAM/db/Time/Time.C
View file @
aa671090
...
...
@@ -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_
);
...
...
src/OpenFOAM/db/Time/Time.H
View file @
aa671090
...
...
@@ -352,7 +352,7 @@ public:
// also invokes the functionObjectList::end() method
// when the time goes out of range
// @note
// For correct b
ahe
viour, the following style of time-loop
// For correct b
eha
viour, 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
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment