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

@ -29,12 +29,21 @@ License
#include "mappedPatchBase.H"
#include "treeBoundBox.H"
#include "treeDataFace.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(patchProbes, 0);
addToRunTimeSelectionTable
(
functionObject,
patchProbes,
dictionary
);
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
@ -181,6 +190,26 @@ void Foam::patchProbes::findElements(const fvMesh& mesh)
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::patchProbes::patchProbes
(
const word& name,
const Time& t,
const dictionary& dict
)
:
probes(name, t, dict)
{
// When constructing probes above it will have called the
// probes::findElements (since the virtual mechanism not yet operating).
// Not easy to workaround (apart from feeding through flag into constructor)
// so clear out any cells found for now.
elementList_.clear();
faceList_.clear();
read(dict);
}
Foam::patchProbes::patchProbes
(
const word& name,
@ -189,7 +218,7 @@ Foam::patchProbes::patchProbes
const bool loadFromFiles
)
:
probes(name, obr, dict, loadFromFiles)
probes(name, obr, dict)
{
// When constructing probes above it will have called the
// probes::findElements (since the virtual mechanism not yet operating).
@ -208,7 +237,7 @@ Foam::patchProbes::~patchProbes()
{}
void Foam::patchProbes::write()
bool Foam::patchProbes::write()
{
if (this->size() && prepare())
{
@ -224,12 +253,15 @@ void Foam::patchProbes::write()
sampleAndWriteSurfaceFields(surfaceSymmTensorFields_);
sampleAndWriteSurfaceFields(surfaceTensorFields_);
}
return true;
}
void Foam::patchProbes::read(const dictionary& dict)
bool Foam::patchProbes::read(const dictionary& dict)
{
dict.lookup("patchName") >> patchName_;
probes::read(dict);
return probes::read(dict);
}