mirror of
https://github.com/OpenFOAM/OpenFOAM-6.git
synced 2025-12-08 06:57:46 +00:00
functionObjects: Moved into the functionObjects namespace and rationalized and simplified failable construction
Rather than requiring each functionObject to handle failed construction internally (using the active_ flag) the static member function "viable" is provided which returns true if construction of the functionObject is likely to be successful. Failed construction is then handled by the wrapper-class which constructs the functionObject, e.g. "OutputFilterFunctionObject".
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -76,6 +76,18 @@ ${typeName}FunctionObject::${typeName}FunctionObject
|
||||
}
|
||||
|
||||
|
||||
bool ${typeName}FunctionObject::viable
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const bool
|
||||
)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
${typeName}FunctionObject::~${typeName}FunctionObject()
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -102,6 +102,16 @@ public:
|
||||
const bool loadFromFilesUnused = false
|
||||
);
|
||||
|
||||
//- Construct for given objectRegistry and dictionary.
|
||||
// Allow the possibility to load fields from files
|
||||
static bool viable
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& unused,
|
||||
const dictionary&,
|
||||
const bool loadFromFilesUnused = false
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~${typeName}FunctionObject();
|
||||
|
||||
@ -71,21 +71,15 @@ void Foam::FUNCTIONOBJECT::read(const dictionary& dict)
|
||||
|
||||
|
||||
void Foam::FUNCTIONOBJECT::execute()
|
||||
{
|
||||
// Do nothing - only valid on write
|
||||
}
|
||||
{}
|
||||
|
||||
|
||||
void Foam::FUNCTIONOBJECT::end()
|
||||
{
|
||||
// Do nothing - only valid on write
|
||||
}
|
||||
{}
|
||||
|
||||
|
||||
void Foam::FUNCTIONOBJECT::timeSet()
|
||||
{
|
||||
// Do nothing - only valid on write
|
||||
}
|
||||
{}
|
||||
|
||||
|
||||
void Foam::FUNCTIONOBJECT::write()
|
||||
|
||||
Reference in New Issue
Block a user