ENH: support writeControl 'none' (#1448)

- for special cases when normal writing is to be completely disabled
  and replaced with alternate means (eg, via a function object).

- support "adjustable" as "adjustableRunTime" alias to reduce typing
  for writeControl or outputControl
This commit is contained in:
Mark Olesen
2019-09-27 15:46:26 +02:00
committed by Andrew Heather
parent 0840bfdcb8
commit 4cc7bf1468
3 changed files with 14 additions and 5 deletions

View File

@ -53,8 +53,7 @@ Foam::Time::stopAtControlNames
{ stopAtControls::saNoWriteNow, "noWriteNow" },
{ stopAtControls::saWriteNow, "writeNow" },
{ stopAtControls::saNextWrite, "nextWrite" },
// NOTE: stopAtControls::saUnknown is left untabulated here so that it can
// be used as fallback value to flag unknown settings
// Leave saUnknown untabulated - fallback to flag unknown settings
});
@ -64,11 +63,14 @@ const Foam::Enum
>
Foam::Time::writeControlNames
({
{ writeControls::wcNone, "none" },
{ writeControls::wcTimeStep, "timeStep" },
{ writeControls::wcRunTime, "runTime" },
{ writeControls::wcAdjustableRunTime, "adjustable" },
{ writeControls::wcAdjustableRunTime, "adjustableRunTime" },
{ writeControls::wcClockTime, "clockTime" },
{ writeControls::wcCpuTime, "cpuTime" },
// Leave wcUnknown untabulated - fallback to flag unknown settings
});
@ -1170,6 +1172,10 @@ Foam::Time& Foam::Time::operator++()
switch (writeControl_)
{
case wcNone:
case wcUnknown:
break;
case wcTimeStep:
writeTime_ = !(timeIndex_ % label(writeInterval_));
break;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016-2018 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2016-2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2011-2017 OpenFOAM Foundation
@ -83,11 +83,13 @@ public:
//- Write control options
enum writeControls
{
wcNone, //!< "none"
wcTimeStep, //!< "timeStep"
wcRunTime, //!< "runTime"
wcAdjustableRunTime, //!< "adjustableRunTime"
wcAdjustableRunTime, //!< "adjustable" / "adjustableRunTime"
wcClockTime, //!< "clockTime"
wcCpuTime //!< "cpuTime"
wcCpuTime, //!< "cpuTime"
wcUnknown //!< Dummy no-op
};
//- Stop-run control options, which are primarily used when

View File

@ -39,6 +39,7 @@ Foam::timeControl::timeControlNames_
{ timeControl::ocTimeStep, "timeStep" },
{ timeControl::ocWriteTime, "writeTime" },
{ timeControl::ocOutputTime, "outputTime" },
{ timeControl::ocAdjustableRunTime, "adjustable" },
{ timeControl::ocAdjustableRunTime, "adjustableRunTime" },
{ timeControl::ocRunTime, "runTime" },
{ timeControl::ocClockTime, "clockTime" },