STYLE: used guarded read in runTimeControl

This commit is contained in:
Mark Olesen
2019-01-24 10:03:33 +01:00
parent 1c85c64984
commit 1910ebc0ad
5 changed files with 14 additions and 24 deletions

View File

@ -105,18 +105,12 @@ bool Foam::functionObjects::setTimeStepFunctionObject::read
timeStepPtr_ = Function1<scalar>::New("deltaT", dict);
// Check that adjustTimeStep is active
const dictionary& controlDict = time_.controlDict();
Switch adjust;
if
(
!controlDict.readIfPresent<Switch>("adjustTimeStep", adjust)
|| !adjust
)
// Ensure that adjustTimeStep is active
if (!time_.controlDict().lookupOrDefault<bool>("adjustTimeStep", false))
{
FatalIOErrorInFunction(dict)
<< "Need to set 'adjustTimeStep' true to allow timestep control"
<< nl
<< exit(FatalIOError);
}