mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: build dummy runTimePostProcessing if VTK/ParaView are not available
- this allows more use of the runTimePostProcessing functionObject that will fail more gracefully if the proper version could not be built. The dummy functionObject simply emits a message that it is not available.
This commit is contained in:
@ -40,6 +40,7 @@ bool Foam::functionObject::postProcess(false);
|
||||
|
||||
Foam::word Foam::functionObject::outputPrefix("postProcessing");
|
||||
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
Foam::word Foam::functionObject::scopedName(const word& name) const
|
||||
@ -68,10 +69,9 @@ Foam::autoPtr<Foam::functionObject> Foam::functionObject::New
|
||||
{
|
||||
const word functionType(dict.get<word>("type"));
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Info<< "Selecting function " << functionType << endl;
|
||||
}
|
||||
DebugInfo
|
||||
<< "Selecting function " << functionType << endl;
|
||||
|
||||
|
||||
// Load any additional libraries
|
||||
{
|
||||
@ -122,12 +122,6 @@ Foam::autoPtr<Foam::functionObject> Foam::functionObject::New
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::functionObject::~functionObject()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
const Foam::word& Foam::functionObject::name() const
|
||||
@ -179,4 +173,45 @@ void Foam::functionObject::movePoints(const polyMesh&)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * unavailableFunctionObject * * * * * * * * * * * * //
|
||||
|
||||
Foam::functionObject::unavailableFunctionObject::unavailableFunctionObject
|
||||
(
|
||||
const word& name
|
||||
)
|
||||
:
|
||||
functionObject(name)
|
||||
{}
|
||||
|
||||
|
||||
void Foam::functionObject::unavailableFunctionObject::carp(std::string message)
|
||||
{
|
||||
FatalError
|
||||
<< "####" << nl
|
||||
<< " " << type() << " not available" << nl
|
||||
<< "####" << nl;
|
||||
|
||||
if (message.size())
|
||||
{
|
||||
FatalError
|
||||
<< message.c_str() << nl;
|
||||
}
|
||||
|
||||
FatalError
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::functionObject::unavailableFunctionObject::execute()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::functionObject::unavailableFunctionObject::write()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -127,7 +127,7 @@ SourceFiles
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of classes
|
||||
// Forward declarations
|
||||
class Time;
|
||||
class polyMesh;
|
||||
class mapPolyMesh;
|
||||
@ -144,15 +144,6 @@ class functionObject
|
||||
const word name_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- No copy construct
|
||||
functionObject(const functionObject&) = delete;
|
||||
|
||||
//- No copy assignment
|
||||
void operator=(const functionObject&) = delete;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// Protected Member Functions
|
||||
@ -163,6 +154,9 @@ protected:
|
||||
|
||||
public:
|
||||
|
||||
// Forward declarations
|
||||
class unavailableFunctionObject;
|
||||
|
||||
//- Runtime type information
|
||||
virtual const word& type() const = 0;
|
||||
|
||||
@ -209,13 +203,13 @@ public:
|
||||
static autoPtr<functionObject> New
|
||||
(
|
||||
const word& name,
|
||||
const Time&,
|
||||
const dictionary&
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~functionObject();
|
||||
virtual ~functionObject() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
@ -243,7 +237,7 @@ public:
|
||||
virtual bool write() = 0;
|
||||
|
||||
//- Called when Time::run() determines that the time-loop exits.
|
||||
// By default it simply calls execute().
|
||||
// The base implementation is a no-op.
|
||||
virtual bool end();
|
||||
|
||||
//- Called at the end of Time::adjustDeltaT() if adjustTime is true
|
||||
@ -262,6 +256,37 @@ public:
|
||||
};
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class functionObject::unavailableFunctionObject Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
//- Abstract functionObject to report when a real version is unavailable.
|
||||
class functionObject::unavailableFunctionObject
|
||||
:
|
||||
public functionObject
|
||||
{
|
||||
protected:
|
||||
|
||||
//- Construct with name
|
||||
unavailableFunctionObject(const word& name);
|
||||
|
||||
//- Report it is unavailable, emitting a FatalError for try/catch
|
||||
//- in the caller
|
||||
void carp(std::string message = "");
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- No nothing
|
||||
virtual bool execute();
|
||||
|
||||
//- No nothing
|
||||
virtual bool write();
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
Reference in New Issue
Block a user