functionObjects: Separated 'execute' and 'write' functions to simplify support for post-processing

This commit is contained in:
Henry Weller
2016-05-13 09:05:29 +01:00
parent 6164c2f262
commit ded5f35dd6
19 changed files with 599 additions and 64 deletions

View File

@ -168,10 +168,17 @@ Foam::functionObject& Foam::codedFunctionObject::redirectFunctionObject() const
}
bool Foam::codedFunctionObject::execute(const bool forceWrite)
bool Foam::codedFunctionObject::execute(const bool postProcess)
{
updateLibrary(redirectType_);
return redirectFunctionObject().execute(forceWrite);
return redirectFunctionObject().execute(postProcess);
}
bool Foam::codedFunctionObject::write(const bool postProcess)
{
updateLibrary(redirectType_);
return redirectFunctionObject().write(postProcess);
}

View File

@ -171,9 +171,15 @@ public:
//- Dynamically compiled functionObject
functionObject& redirectFunctionObject() const;
//- Called at each ++ or += of the time-loop. forceWrite overrides the
// writeControl behaviour.
virtual bool execute(const bool forceWrite);
//- Called at each ++ or += of the time-loop.
// postProcess overrides the usual executeControl behaviour and
// forces execution (used in post-processing mode)
virtual bool execute(const bool postProcess = false);
//- Called at each ++ or += of the time-loop.
// postProcess overrides the usual writeControl behaviour and
// forces writing always (used in post-processing mode)
virtual bool write(const bool postProcess = false);
//- Called when Time::run() determines that the time-loop exits.
// By default it simply calls execute().

View File

@ -77,7 +77,16 @@ Foam::functionObjects::setTimeStepFunctionObject::time() const
bool Foam::functionObjects::setTimeStepFunctionObject::execute
(
const bool forceWrite
const bool postProcess
)
{
return true;
}
bool Foam::functionObjects::setTimeStepFunctionObject::write
(
const bool postProcess
)
{
return true;

View File

@ -109,8 +109,15 @@ public:
// Function object control
//- Called at each ++ or += of the time-loop
virtual bool execute(const bool forceWrite);
//- Called at each ++ or += of the time-loop.
// postProcess overrides the usual executeControl behaviour and
// forces execution (used in post-processing mode)
virtual bool execute(const bool postProcess = false);
//- Called at each ++ or += of the time-loop.
// postProcess overrides the usual writeControl behaviour and
// forces writing always (used in post-processing mode)
virtual bool write(const bool postProcess = false);
//- Called when Time::run() determines that the time-loop exits
virtual bool end();