STYLE: use 'statusDone' keyword for coupling (#1243)

This commit is contained in:
Mark Olesen
2019-03-22 08:00:01 +01:00
parent 962e2ef54c
commit 6bd3b727cf
3 changed files with 11 additions and 10 deletions

View File

@ -94,7 +94,7 @@ Foam::externalFileCoupler::externalFileCoupler()
:
runState_(NONE),
commsDir_("<case>/comms"),
statusEnd_("done"),
statusDone_("done"),
waitInterval_(1u),
timeOut_(100u),
slaveFirst_(false),
@ -109,7 +109,7 @@ Foam::externalFileCoupler::externalFileCoupler(const fileName& commsDir)
:
runState_(NONE),
commsDir_(commsDir),
statusEnd_("done"),
statusDone_("done"),
waitInterval_(1u),
timeOut_(100u),
slaveFirst_(false),
@ -157,7 +157,7 @@ bool Foam::externalFileCoupler::readDict(const dictionary& dict)
dict.readEntry("commsDir", commsDir_);
commsDir_.expand();
commsDir_.clean();
statusEnd_ = dict.lookupOrDefault<word>("shutdown", "done");
statusDone_ = dict.lookupOrDefault<word>("statusDone", "done");
slaveFirst_ = dict.lookupOrDefault("initByExternal", false);
Info<< type() << ": initialize" << nl
@ -360,10 +360,10 @@ void Foam::externalFileCoupler::shutdown() const
{
if (Pstream::master() && runState_ == MASTER && Foam::isDir(commsDir_))
{
Log << type() << ": lock file status=" << statusEnd_ << endl;
Log << type() << ": lock file status=" << statusDone_ << endl;
std::ofstream os(lockFile());
os << "status=" << statusEnd_ << nl;
os << "status=" << statusDone_ << nl;
}
runState_ = DONE; // Avoid re-triggering in destructor

View File

@ -8,7 +8,7 @@
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify i
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
@ -54,7 +54,7 @@ Description
waitInterval 1;
timeOut 100;
initByExternal no;
shutdown done;
statusDone done;
}
\endverbatim
@ -129,7 +129,7 @@ private:
fileName commsDir_;
//- Value for "status=..." on termination
word statusEnd_;
word statusDone_;
//- Interval time between checking for return data [s]
unsigned waitInterval_;
@ -283,6 +283,7 @@ public:
//- Generate \c status=done in lock (only when run-state = master)
// The exact text can be specified via the statusDone keyword
void shutdown() const;
//- Remove files written by OpenFOAM

View File

@ -88,7 +88,7 @@ Usage
log yes;
commsDir "<case>/comms";
initByExternal yes;
shutdown done; // Any arbitrary status=... value
statusDone done; // Any arbitrary status=... value
regions
{
@ -129,7 +129,7 @@ Usage
commsDir | Communication directory | yes |
waitInterval | wait interval in (s) | no | 1
timeOut | timeout in (s) | no | 100*waitInterval
shutdown | Lockfile status=... on termination | no | done
statusDone | Lockfile status=... on termination | no | done
initByExternal | Initialization values supplied by external app | yes
calcFrequency | Calculation frequency | no | 1
regions | The regions to couple | yes |