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,9 +24,9 @@ License
\*---------------------------------------------------------------------------*/
#include "timeActivatedFileUpdate.H"
#include "objectRegistry.H"
#include "Time.H"
#include "dictionary.H"
#include "polyMesh.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -35,6 +35,13 @@ namespace Foam
namespace functionObjects
{
defineTypeNameAndDebug(timeActivatedFileUpdate, 0);
addToRunTimeSelectionTable
(
functionObject,
timeActivatedFileUpdate,
dictionary
);
}
}
@ -47,7 +54,7 @@ void Foam::functionObjects::timeActivatedFileUpdate::updateFile()
while
(
i < timeVsFile_.size()-1
&& timeVsFile_[i+1].first() < obr_.time().value()
&& timeVsFile_[i+1].first() < time_.value()
)
{
i++;
@ -69,13 +76,12 @@ void Foam::functionObjects::timeActivatedFileUpdate::updateFile()
Foam::functionObjects::timeActivatedFileUpdate::timeActivatedFileUpdate
(
const word& name,
const objectRegistry& obr,
const dictionary& dict,
const bool loadFromFiles
const Time& runTime,
const dictionary& dict
)
:
name_(name),
obr_(obr),
functionObject(name),
time_(runTime),
fileToUpdate_(dict.lookup("fileToUpdate")),
timeVsFile_(),
lastIndex_(-1)
@ -92,7 +98,7 @@ Foam::functionObjects::timeActivatedFileUpdate::~timeActivatedFileUpdate()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::functionObjects::timeActivatedFileUpdate::read
bool Foam::functionObjects::timeActivatedFileUpdate::read
(
const dictionary& dict
)
@ -120,27 +126,29 @@ void Foam::functionObjects::timeActivatedFileUpdate::read
Info<< endl;
updateFile();
return true;
}
void Foam::functionObjects::timeActivatedFileUpdate::execute()
bool Foam::functionObjects::timeActivatedFileUpdate::execute
(
const bool postProcess
)
{
updateFile();
return true;
}
void Foam::functionObjects::timeActivatedFileUpdate::end()
bool Foam::functionObjects::timeActivatedFileUpdate::write
(
const bool postProcess
)
{
execute();
return true;
}
void Foam::functionObjects::timeActivatedFileUpdate::timeSet()
{}
void Foam::functionObjects::timeActivatedFileUpdate::write()
{}
// ************************************************************************* //