mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: added timeFunctionObject virtual class in inheritance hierarchy
- simply a functionObject with an additional Time reference, which is a combination frequently used by concrete functionObjects
This commit is contained in:
@ -138,8 +138,7 @@ Foam::functionObjects::abort::abort
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
functionObject(name),
|
||||
time_(runTime),
|
||||
timeFunctionObject(name, runTime),
|
||||
file_(),
|
||||
defaultAction_(Time::stopAtControls::saUnknown),
|
||||
triggered_(false)
|
||||
|
||||
@ -86,7 +86,7 @@ SourceFiles
|
||||
#ifndef functionObjects_abort_H
|
||||
#define functionObjects_abort_H
|
||||
|
||||
#include "functionObject.H"
|
||||
#include "timeFunctionObject.H"
|
||||
#include "Time.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -102,13 +102,10 @@ namespace functionObjects
|
||||
|
||||
class abort
|
||||
:
|
||||
public functionObject
|
||||
public functionObjects::timeFunctionObject
|
||||
{
|
||||
// Private Data
|
||||
|
||||
//- Reference to the Time
|
||||
const Time& time_;
|
||||
|
||||
//- The fully-qualified name of the trigger file
|
||||
fileName file_;
|
||||
|
||||
|
||||
@ -124,13 +124,12 @@ Foam::functionObjects::codedFunctionObject::codeDict() const
|
||||
Foam::functionObjects::codedFunctionObject::codedFunctionObject
|
||||
(
|
||||
const word& name,
|
||||
const Time& time,
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
functionObject(name),
|
||||
timeFunctionObject(name, runTime),
|
||||
codedBase(),
|
||||
time_(time),
|
||||
dict_(dict)
|
||||
{
|
||||
read(dict_);
|
||||
@ -140,12 +139,6 @@ Foam::functionObjects::codedFunctionObject::codedFunctionObject
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::functionObjects::codedFunctionObject::~codedFunctionObject()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
Foam::functionObject&
|
||||
|
||||
@ -75,7 +75,7 @@ SourceFiles
|
||||
#ifndef functionObjects_codedFunctionObject_H
|
||||
#define functionObjects_codedFunctionObject_H
|
||||
|
||||
#include "functionObject.H"
|
||||
#include "timeFunctionObject.H"
|
||||
#include "codedBase.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -91,16 +91,13 @@ namespace functionObjects
|
||||
|
||||
class codedFunctionObject
|
||||
:
|
||||
public functionObject,
|
||||
public functionObjects::timeFunctionObject,
|
||||
public codedBase
|
||||
{
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Reference to the time database
|
||||
const Time& time_;
|
||||
|
||||
//- Input dictionary
|
||||
dictionary dict_;
|
||||
|
||||
@ -153,13 +150,13 @@ public:
|
||||
codedFunctionObject
|
||||
(
|
||||
const word& name,
|
||||
const Time& time,
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~codedFunctionObject();
|
||||
virtual ~codedFunctionObject() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
@ -53,28 +53,14 @@ Foam::functionObjects::setTimeStepFunctionObject::setTimeStepFunctionObject
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
functionObject(name),
|
||||
time_(runTime)
|
||||
timeFunctionObject(name, runTime)
|
||||
{
|
||||
read(dict);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::functionObjects::setTimeStepFunctionObject::~setTimeStepFunctionObject()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
const Foam::Time&
|
||||
Foam::functionObjects::setTimeStepFunctionObject::time() const
|
||||
{
|
||||
return time_;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::functionObjects::setTimeStepFunctionObject::adjustTimeStep()
|
||||
{
|
||||
// Wanted timestep
|
||||
|
||||
@ -69,7 +69,7 @@ SourceFiles
|
||||
#ifndef functionObjects_setTimeStepFunctionObject_H
|
||||
#define functionObjects_setTimeStepFunctionObject_H
|
||||
|
||||
#include "functionObject.H"
|
||||
#include "timeFunctionObject.H"
|
||||
#include "Function1.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -80,23 +80,20 @@ namespace functionObjects
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class setTimeStepFunctionObject Declaration
|
||||
Class functionObjects::setTimeStepFunctionObject Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class setTimeStepFunctionObject
|
||||
:
|
||||
public functionObject
|
||||
public functionObjects::timeFunctionObject
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Reference to the time database
|
||||
const Time& time_;
|
||||
// Private Member Data
|
||||
|
||||
//- Time step function/table
|
||||
autoPtr<Function1<scalar>> timeStepPtr_;
|
||||
|
||||
|
||||
// Private member functions
|
||||
// Private Member Functions
|
||||
|
||||
//- No copy construct
|
||||
setTimeStepFunctionObject(const setTimeStepFunctionObject&) = delete;
|
||||
@ -123,14 +120,11 @@ public:
|
||||
|
||||
|
||||
// Destructor
|
||||
virtual ~setTimeStepFunctionObject();
|
||||
virtual ~setTimeStepFunctionObject() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return time database
|
||||
const Time& time() const;
|
||||
|
||||
//- Called at the end of Time::adjustDeltaT() if adjustTime is true
|
||||
virtual bool adjustTimeStep();
|
||||
|
||||
|
||||
@ -89,8 +89,7 @@ Foam::functionObjects::timeActivatedFileUpdate::timeActivatedFileUpdate
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
functionObject(name),
|
||||
time_(runTime),
|
||||
timeFunctionObject(name, runTime),
|
||||
fileToUpdate_("unknown-fileToUpdate"),
|
||||
timeVsFile_(),
|
||||
lastIndex_(-1),
|
||||
@ -100,12 +99,6 @@ Foam::functionObjects::timeActivatedFileUpdate::timeActivatedFileUpdate
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::functionObjects::timeActivatedFileUpdate::~timeActivatedFileUpdate()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::functionObjects::timeActivatedFileUpdate::read
|
||||
|
||||
@ -69,7 +69,7 @@ SourceFiles
|
||||
#ifndef functionObjects_timeActivatedFileUpdate_H
|
||||
#define functionObjects_timeActivatedFileUpdate_H
|
||||
|
||||
#include "functionObject.H"
|
||||
#include "timeFunctionObject.H"
|
||||
#include "Tuple2.H"
|
||||
#include "Switch.H"
|
||||
|
||||
@ -85,17 +85,14 @@ namespace functionObjects
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class timeActivatedFileUpdate Declaration
|
||||
Class functionObjects::timeActivatedFileUpdate Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class timeActivatedFileUpdate
|
||||
:
|
||||
public functionObject
|
||||
public functionObjects::timeFunctionObject
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Reference to Time
|
||||
const Time& time_;
|
||||
// Private Member Data
|
||||
|
||||
//- Name of file to update
|
||||
fileName fileToUpdate_;
|
||||
@ -140,7 +137,7 @@ public:
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~timeActivatedFileUpdate();
|
||||
virtual ~timeActivatedFileUpdate() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
@ -122,8 +122,7 @@ Foam::functionObjects::vtkWrite::vtkWrite
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
functionObject(name),
|
||||
time_(runTime),
|
||||
timeFunctionObject(name, runTime),
|
||||
outputDir_(),
|
||||
printf_(),
|
||||
writeOpts_(vtk::formatType::INLINE_BASE64),
|
||||
|
||||
@ -132,7 +132,7 @@ SourceFiles
|
||||
#ifndef functionObjects_vtkWrite_H
|
||||
#define functionObjects_vtkWrite_H
|
||||
|
||||
#include "functionObject.H"
|
||||
#include "timeFunctionObject.H"
|
||||
#include "foamVtkInternalWriter.H"
|
||||
#include "foamVtkPatchWriter.H"
|
||||
#include "foamVtkSeriesWriter.H"
|
||||
@ -152,13 +152,10 @@ namespace functionObjects
|
||||
|
||||
class vtkWrite
|
||||
:
|
||||
public functionObject
|
||||
public functionObjects::timeFunctionObject
|
||||
{
|
||||
// Private Data
|
||||
|
||||
//- Reference to the time database
|
||||
const Time& time_;
|
||||
|
||||
//- The output directory
|
||||
fileName outputDir_;
|
||||
|
||||
|
||||
@ -99,7 +99,7 @@ namespace functionObjects
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class writeObjects Declaration
|
||||
Class functionObjects::writeObjects Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class writeObjects
|
||||
@ -125,7 +125,7 @@ private:
|
||||
|
||||
// Private data
|
||||
|
||||
//- Reference to Db
|
||||
//- Reference to registry
|
||||
const objectRegistry& obr_;
|
||||
|
||||
//- To only write objects of defined writeOption
|
||||
|
||||
Reference in New Issue
Block a user