ENH: add timeControl clear() method to reset to 'always' (pass-through)

This commit is contained in:
Mark Olesen
2019-12-13 10:01:19 +01:00
parent 042c529f9f
commit e90de78cac
2 changed files with 36 additions and 13 deletions

View File

@ -81,7 +81,7 @@ Foam::timeControl::timeControl
} }
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
bool Foam::timeControl::entriesPresent bool Foam::timeControl::entriesPresent
( (
@ -95,27 +95,47 @@ bool Foam::timeControl::entriesPresent
} }
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::timeControl::clear()
{
timeControl_ = ocAlways;
intervalSteps_ = 0;
interval_ = -1;
executionIndex_ = 0;
}
void Foam::timeControl::read(const dictionary& dict) void Foam::timeControl::read(const dictionary& dict)
{ {
// Default is timeStep
timeControl_ = ocTimeStep;
word controlName(prefix_ + "Control"); word controlName(prefix_ + "Control");
word intervalName(prefix_ + "Interval"); word intervalName(prefix_ + "Interval");
// For backward compatibility support the deprecated 'outputControl' option if (prefix_ == "write")
// now superseded by 'writeControl' for compatibility with Time
if (prefix_ == "write" && dict.found("outputControl"))
{ {
IOWarningInFunction(dict) // TBD: Could have timeControl_ = ocWriteTime;
<< "Using deprecated 'outputControl'" << nl
<< " Please use 'writeControl' with 'writeInterval'"
<< endl;
error::warnAboutAge("outputControl", 1606);
// Change to the old names for this option if (dict.found("outputControl"))
controlName = "outputControl"; {
intervalName = "outputInterval"; // Accept deprecated 'outputControl' instead of 'writeControl'
IOWarningInFunction(dict)
<< "Using deprecated 'outputControl'" << nl
<< " Please use 'writeControl' with 'writeInterval'"
<< endl;
error::warnAboutAge("outputControl", 1606);
// Change to the old names for this option
controlName = "outputControl";
intervalName = "outputInterval";
}
} }
timeControl_ = controlNames_.getOrDefault(controlName, dict, ocTimeStep);
timeControl_ = controlNames_.getOrDefault(controlName, dict, timeControl_);
switch (timeControl_) switch (timeControl_)
{ {

View File

@ -156,6 +156,9 @@ public:
//- Return the named control enumeration as its 'type' //- Return the named control enumeration as its 'type'
inline const word& type() const; inline const word& type() const;
//- Reset control to 'always' - ie, no intervention
void clear();
//- Return the control enumeration //- Return the control enumeration
inline timeControls control() const; inline timeControls control() const;