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:
Henry Weller
2016-05-02 16:28:24 +01:00
parent 09262f5273
commit 0534a225fd
175 changed files with 4667 additions and 4353 deletions

View File

@ -303,7 +303,6 @@ void Foam::meshToMesh0::interpolate
}
case CELL_VOLUME_WEIGHT:
{
// Do nothing
break;
}

View File

@ -202,6 +202,18 @@ Foam::patchProbes::patchProbes
}
bool Foam::patchProbes::viable
(
const word& name,
const objectRegistry& obr,
const dictionary& dict,
const bool loadFromFiles
)
{
return true;
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::patchProbes::~patchProbes()

View File

@ -138,6 +138,16 @@ public:
const bool loadFromFiles = false
);
//- Return true if the construction of this functionObject is viable
// i.e. the prerequisites for construction are available
static bool viable
(
const word& name,
const objectRegistry&,
const dictionary&,
const bool loadFromFiles = false
);
//- Destructor
virtual ~patchProbes();

View File

@ -287,6 +287,18 @@ Foam::probes::probes
}
bool Foam::probes::viable
(
const word& name,
const objectRegistry& obr,
const dictionary& dict,
const bool loadFromFiles
)
{
return true;
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::probes::~probes()
@ -296,21 +308,15 @@ Foam::probes::~probes()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::probes::execute()
{
// Do nothing - only valid on write
}
{}
void Foam::probes::end()
{
// Do nothing - only valid on write
}
{}
void Foam::probes::timeSet()
{
// Do nothing - only valid on write
}
{}
void Foam::probes::write()

View File

@ -210,6 +210,16 @@ public:
const bool loadFromFiles = false
);
//- Return true if the construction of this functionObject is viable
// i.e. the prerequisites for construction are available
static bool viable
(
const word& name,
const objectRegistry&,
const dictionary&,
const bool loadFromFiles = false
);
//- Destructor
virtual ~probes();

View File

@ -162,6 +162,18 @@ Foam::sampledSets::sampledSets
}
bool Foam::sampledSets::viable
(
const word& name,
const objectRegistry& obr,
const dictionary& dict,
const bool loadFromFiles
)
{
return true;
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::sampledSets::~sampledSets()
@ -177,21 +189,15 @@ void Foam::sampledSets::verbose(const bool verbosity)
void Foam::sampledSets::execute()
{
// Do nothing - only valid on write
}
{}
void Foam::sampledSets::end()
{
// Do nothing - only valid on write
}
{}
void Foam::sampledSets::timeSet()
{
// Do nothing - only valid on write
}
{}
void Foam::sampledSets::write()

View File

@ -266,6 +266,16 @@ public:
const bool loadFromFiles = false
);
//- Return true if the construction of this functionObject is viable
// i.e. the prerequisites for construction are available
static bool viable
(
const word& name,
const objectRegistry&,
const dictionary&,
const bool loadFromFiles = false
);
//- Destructor
virtual ~sampledSets();

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -115,6 +115,19 @@ Foam::sampledSurfaces::sampledSurfaces
}
bool Foam::sampledSurfaces::viable
(
const word& name,
const objectRegistry& obr,
const dictionary& dict,
const bool loadFromFiles
)
{
return true;
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::sampledSurfaces::~sampledSurfaces()
@ -130,21 +143,15 @@ void Foam::sampledSurfaces::verbose(const bool verbosity)
void Foam::sampledSurfaces::execute()
{
// Do nothing - only valid on write
}
{}
void Foam::sampledSurfaces::end()
{
// Do nothing - only valid on write
}
{}
void Foam::sampledSurfaces::timeSet()
{
// Do nothing - only valid on write
}
{}
void Foam::sampledSurfaces::write()

View File

@ -186,6 +186,16 @@ public:
const bool loadFromFiles = false
);
//- Return true if the construction of this functionObject is viable
// i.e. the prerequisites for construction are available
static bool viable
(
const word& name,
const objectRegistry&,
const dictionary&,
const bool loadFromFiles = false
);
//- Destructor
virtual ~sampledSurfaces();