functionObjects: rewritten to all be derived from 'functionObject'

- Avoids the need for the 'OutputFilterFunctionObject' wrapper
  - Time-control for execution and writing is now provided by the
    'timeControlFunctionObject' which instantiates the processing
    'functionObject' and controls its operation.
  - Alternative time-control functionObjects can now be written and
    selected at run-time without the need to compile wrapped version of
    EVERY existing functionObject which would have been required in the
    old structure.
  - The separation of 'execute' and 'write' functions is now formalized in the
    'functionObject' base-class and all derived classes implement the
    two functions.
  - Unnecessary implementations of functions with appropriate defaults
    in the 'functionObject' base-class have been removed reducing
    clutter and simplifying implementation of new functionObjects.
  - The 'coded' 'functionObject' has also been updated, simplified and tested.
  - Further simplification is now possible by creating some general
    intermediate classes derived from 'functionObject'.
This commit is contained in:
Henry Weller
2016-05-15 16:40:01 +01:00
parent 1441f8cab0
commit 91aba2db2e
230 changed files with 2731 additions and 8756 deletions

View File

@ -24,8 +24,9 @@ License
\*---------------------------------------------------------------------------*/
#include "removeRegisteredObject.H"
#include "dictionary.H"
#include "Time.H"
#include "polyMesh.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -34,6 +35,13 @@ namespace Foam
namespace functionObjects
{
defineTypeNameAndDebug(removeRegisteredObject, 0);
addToRunTimeSelectionTable
(
functionObject,
removeRegisteredObject,
dictionary
);
}
}
@ -43,13 +51,18 @@ namespace functionObjects
Foam::functionObjects::removeRegisteredObject::removeRegisteredObject
(
const word& name,
const objectRegistry& obr,
const dictionary& dict,
const bool loadFromFiles
const Time& runTime,
const dictionary& dict
)
:
name_(name),
obr_(obr),
functionObject(name),
obr_
(
runTime.lookupObject<objectRegistry>
(
dict.lookupOrDefault("region", polyMesh::defaultRegion)
)
),
objectNames_()
{
read(dict);
@ -64,13 +77,18 @@ Foam::functionObjects::removeRegisteredObject::~removeRegisteredObject()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::functionObjects::removeRegisteredObject::read(const dictionary& dict)
bool Foam::functionObjects::removeRegisteredObject::read(const dictionary& dict)
{
dict.lookup("objectNames") >> objectNames_;
return true;
}
void Foam::functionObjects::removeRegisteredObject::execute()
bool Foam::functionObjects::removeRegisteredObject::execute
(
const bool postProcess
)
{
forAll(objectNames_, i)
{
@ -81,7 +99,7 @@ void Foam::functionObjects::removeRegisteredObject::execute()
if (obj.ownedByRegistry())
{
Info<< type() << " " << name_ << " output:" << nl
Info<< type() << " " << name() << " output:" << nl
<< " removing object " << obj.name() << nl
<< endl;
@ -90,21 +108,18 @@ void Foam::functionObjects::removeRegisteredObject::execute()
}
}
}
return true;
}
void Foam::functionObjects::removeRegisteredObject::end()
bool Foam::functionObjects::removeRegisteredObject::write
(
const bool postProcess
)
{
execute();
return true;
}
void Foam::functionObjects::removeRegisteredObject::timeSet()
{}
void Foam::functionObjects::removeRegisteredObject::write()
{}
// ************************************************************************* //