functionObjects: Simplified the handling of the post-processing mode

Replaced the 'postProcess' argument to the 'write' and 'execute'
functions with the single static member 'postProcess' in the
functionObject base-class.
This commit is contained in:
Henry Weller
2016-06-13 08:36:03 +01:00
parent 41c2e4bc11
commit b3f4d5855d
102 changed files with 190 additions and 254 deletions

View File

@ -132,7 +132,7 @@ bool Foam::functionObjects::abort::read(const dictionary& dict)
}
bool Foam::functionObjects::abort::execute(const bool postProcess)
bool Foam::functionObjects::abort::execute()
{
bool hasAbort = isFile(abortFile_);
reduce(hasAbort, orOp<bool>());
@ -183,7 +183,7 @@ bool Foam::functionObjects::abort::execute(const bool postProcess)
}
bool Foam::functionObjects::abort::write(const bool postProcess)
bool Foam::functionObjects::abort::write()
{
return true;
}

View File

@ -130,10 +130,10 @@ public:
virtual bool read(const dictionary&);
//- Execute, check existence of abort file and take action
virtual bool execute(const bool postProcess = false);
virtual bool execute();
//- Execute, check existence of abort file and take action
virtual bool write(const bool postProcess = false);
virtual bool write();
//- Execute at the final time-loop, used for cleanup
virtual bool end();

View File

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

View File

@ -169,12 +169,12 @@ public:
//- 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);
virtual bool execute();
//- 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);
virtual bool write();
//- Called when Time::run() determines that the time-loop exits.
// By default it simply calls execute().

View File

@ -85,10 +85,7 @@ bool Foam::functionObjects::removeRegisteredObject::read(const dictionary& dict)
}
bool Foam::functionObjects::removeRegisteredObject::execute
(
const bool postProcess
)
bool Foam::functionObjects::removeRegisteredObject::execute()
{
forAll(objectNames_, i)
{
@ -113,10 +110,7 @@ bool Foam::functionObjects::removeRegisteredObject::execute
}
bool Foam::functionObjects::removeRegisteredObject::write
(
const bool postProcess
)
bool Foam::functionObjects::removeRegisteredObject::write()
{
return true;
}

View File

@ -126,10 +126,10 @@ public:
virtual bool read(const dictionary&);
//- Remove the registered objects
virtual bool execute(const bool postProcess = false);
virtual bool execute();
//- Do nothing
virtual bool write(const bool postProcess = false);
virtual bool write();
};

View File

@ -106,13 +106,13 @@ void Foam::functionObjects::residuals::writeFileHeader(const label i)
}
bool Foam::functionObjects::residuals::execute(const bool postProcess)
bool Foam::functionObjects::residuals::execute()
{
return true;
}
bool Foam::functionObjects::residuals::write(const bool postProcess)
bool Foam::functionObjects::residuals::write()
{
writeFiles::write();

View File

@ -139,10 +139,10 @@ public:
virtual bool read(const dictionary&);
//- Execute, currently does nothing
virtual bool execute(const bool postProcess = false);
virtual bool execute();
//- Write the residuals
virtual bool write(const bool postProcess = false);
virtual bool write();
};

View File

@ -113,19 +113,13 @@ bool Foam::functionObjects::setTimeStepFunctionObject::read
}
bool Foam::functionObjects::setTimeStepFunctionObject::execute
(
const bool postProcess
)
bool Foam::functionObjects::setTimeStepFunctionObject::execute()
{
return true;
}
bool Foam::functionObjects::setTimeStepFunctionObject::write
(
const bool postProcess
)
bool Foam::functionObjects::setTimeStepFunctionObject::write()
{
return true;
}

View File

@ -113,12 +113,12 @@ public:
//- 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);
virtual bool execute();
//- 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);
virtual bool write();
};

View File

@ -105,7 +105,7 @@ bool Foam::functionObjects::systemCall::read(const dictionary& dict)
}
bool Foam::functionObjects::systemCall::execute(const bool postProcess)
bool Foam::functionObjects::systemCall::execute()
{
forAll(executeCalls_, callI)
{
@ -127,7 +127,7 @@ bool Foam::functionObjects::systemCall::end()
}
bool Foam::functionObjects::systemCall::write(const bool postProcess)
bool Foam::functionObjects::systemCall::write()
{
forAll(writeCalls_, callI)
{

View File

@ -156,13 +156,13 @@ public:
virtual bool read(const dictionary&);
//- Execute the "executeCalls" at each time-step
virtual bool execute(const bool postProcess = false);
virtual bool execute();
//- Execute the "endCalls" at the final time-loop
virtual bool end();
//- Write, execute the "writeCalls"
virtual bool write(const bool postProcess = false);
virtual bool write();
};

View File

@ -131,10 +131,7 @@ bool Foam::functionObjects::timeActivatedFileUpdate::read
}
bool Foam::functionObjects::timeActivatedFileUpdate::execute
(
const bool postProcess
)
bool Foam::functionObjects::timeActivatedFileUpdate::execute()
{
updateFile();
@ -142,10 +139,7 @@ bool Foam::functionObjects::timeActivatedFileUpdate::execute
}
bool Foam::functionObjects::timeActivatedFileUpdate::write
(
const bool postProcess
)
bool Foam::functionObjects::timeActivatedFileUpdate::write()
{
return true;
}

View File

@ -135,10 +135,10 @@ public:
virtual bool read(const dictionary&);
//- Execute file updates
virtual bool execute(const bool postProcess = false);
virtual bool execute();
//- Do nothing
virtual bool write(const bool postProcess = false);
virtual bool write();
};

View File

@ -153,13 +153,13 @@ bool Foam::functionObjects::writeDictionary::read(const dictionary& dict)
}
bool Foam::functionObjects::writeDictionary::execute(const bool postProcess)
bool Foam::functionObjects::writeDictionary::execute()
{
return true;
}
bool Foam::functionObjects::writeDictionary::write(const bool postProcess)
bool Foam::functionObjects::writeDictionary::write()
{
bool firstDict = true;
forAll(dictNames_, i)

View File

@ -122,10 +122,10 @@ public:
virtual bool read(const dictionary&);
//- Execute, currently does nothing
virtual bool execute(const bool postProcess = false);
virtual bool execute();
//- Write the selected dictionaries
virtual bool write(const bool postProcess = false);
virtual bool write();
};

View File

@ -100,19 +100,13 @@ bool Foam::functionObjects::writeObjects::read(const dictionary& dict)
}
bool Foam::functionObjects::writeObjects::execute
(
const bool postProcess
)
bool Foam::functionObjects::writeObjects::execute()
{
return true;
}
bool Foam::functionObjects::writeObjects::write
(
const bool postProcess
)
bool Foam::functionObjects::writeObjects::write()
{
Info<< type() << " " << name() << " write:" << nl;

View File

@ -144,10 +144,10 @@ public:
virtual bool read(const dictionary&);
//- Do nothing
virtual bool execute(const bool postProcess = false);
virtual bool execute();
//- Write the registered objects
virtual bool write(const bool postProcess = false);
virtual bool write();
};