mirror of
https://github.com/OpenFOAM/OpenFOAM-6.git
synced 2025-12-08 06:57:46 +00:00
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:
@ -24,11 +24,9 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "partialWrite.H"
|
||||
#include "dictionary.H"
|
||||
#include "Time.H"
|
||||
#include "IOobjectList.H"
|
||||
#include "polyMesh.H"
|
||||
#include "cloud.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -37,6 +35,13 @@ namespace Foam
|
||||
namespace functionObjects
|
||||
{
|
||||
defineTypeNameAndDebug(partialWrite, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
functionObject,
|
||||
partialWrite,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -46,13 +51,18 @@ namespace functionObjects
|
||||
Foam::functionObjects::partialWrite::partialWrite
|
||||
(
|
||||
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)
|
||||
)
|
||||
)
|
||||
{
|
||||
read(dict);
|
||||
}
|
||||
@ -66,7 +76,7 @@ Foam::functionObjects::partialWrite::~partialWrite()
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::functionObjects::partialWrite::read(const dictionary& dict)
|
||||
bool Foam::functionObjects::partialWrite::read(const dictionary& dict)
|
||||
{
|
||||
dict.lookup("objectNames") >> objectNames_;
|
||||
dict.lookup("writeInterval") >> writeInterval_;
|
||||
@ -110,18 +120,18 @@ void Foam::functionObjects::partialWrite::read(const dictionary& dict)
|
||||
loadField<symmTensor>(iter.key(), vSymmtf_, sSymmtf_);
|
||||
loadField<tensor>(iter.key(), vtf_, stf_);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::partialWrite::execute()
|
||||
{}
|
||||
bool Foam::functionObjects::partialWrite::execute(const bool postProcess)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::partialWrite::end()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::functionObjects::partialWrite::timeSet()
|
||||
bool Foam::functionObjects::partialWrite::timeSet()
|
||||
{
|
||||
if (obr_.time().writeTime())
|
||||
{
|
||||
@ -168,12 +178,14 @@ void Foam::functionObjects::partialWrite::timeSet()
|
||||
changeWriteOptions<tensor>(vtf_, stf_, IOobject::NO_WRITE);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::partialWrite::write()
|
||||
bool Foam::functionObjects::partialWrite::write(const bool postProcess)
|
||||
{
|
||||
// Fields are written in the standard manner
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user