functionObjects: Simply functionObjects requiring access to the fvMesh using fvMeshFunctionObject
This commit is contained in:
@ -48,25 +48,10 @@ Foam::functionObjects::processorField::processorField
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
functionObject(name),
|
||||
obr_
|
||||
(
|
||||
runTime.lookupObject<objectRegistry>
|
||||
(
|
||||
dict.lookupOrDefault("region", polyMesh::defaultRegion)
|
||||
)
|
||||
)
|
||||
fvMeshFunctionObject(name, runTime, dict)
|
||||
{
|
||||
if (!isA<fvMesh>(obr_))
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
||||
}
|
||||
|
||||
read(dict);
|
||||
|
||||
const fvMesh& mesh = refCast<const fvMesh>(obr_);
|
||||
|
||||
volScalarField* procFieldPtr
|
||||
(
|
||||
new volScalarField
|
||||
@ -74,17 +59,17 @@ Foam::functionObjects::processorField::processorField
|
||||
IOobject
|
||||
(
|
||||
"processorID",
|
||||
mesh.time().timeName(),
|
||||
mesh,
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh,
|
||||
mesh_,
|
||||
dimensionedScalar("0", dimless, 0.0)
|
||||
)
|
||||
);
|
||||
|
||||
mesh.objectRegistry::store(procFieldPtr);
|
||||
mesh_.objectRegistry::store(procFieldPtr);
|
||||
}
|
||||
|
||||
|
||||
@ -105,7 +90,7 @@ bool Foam::functionObjects::processorField::read(const dictionary& dict)
|
||||
bool Foam::functionObjects::processorField::execute(const bool postProcess)
|
||||
{
|
||||
const volScalarField& procField =
|
||||
obr_.lookupObject<volScalarField>("processorID");
|
||||
mesh_.lookupObject<volScalarField>("processorID");
|
||||
|
||||
const_cast<volScalarField&>(procField) ==
|
||||
dimensionedScalar("proci", dimless, Pstream::myProcNo());
|
||||
@ -117,7 +102,7 @@ bool Foam::functionObjects::processorField::execute(const bool postProcess)
|
||||
bool Foam::functionObjects::processorField::write(const bool postProcess)
|
||||
{
|
||||
const volScalarField& procField =
|
||||
obr_.lookupObject<volScalarField>("processorID");
|
||||
mesh_.lookupObject<volScalarField>("processorID");
|
||||
|
||||
procField.write();
|
||||
|
||||
|
||||
@ -48,7 +48,7 @@ Description
|
||||
\endtable
|
||||
|
||||
SeeAlso
|
||||
Foam::functionObject
|
||||
Foam::functionObjects::fvMeshFunctionObject
|
||||
|
||||
SourceFiles
|
||||
processorField.C
|
||||
@ -58,16 +58,12 @@ SourceFiles
|
||||
#ifndef functionObjects_processorField_H
|
||||
#define functionObjects_processorField_H
|
||||
|
||||
#include "functionObject.H"
|
||||
#include "fvMeshFunctionObject.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of classes
|
||||
class objectRegistry;
|
||||
|
||||
namespace functionObjects
|
||||
{
|
||||
|
||||
@ -77,18 +73,8 @@ namespace functionObjects
|
||||
|
||||
class processorField
|
||||
:
|
||||
public functionObject
|
||||
public fvMeshFunctionObject
|
||||
{
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Reference to the objectRegistry
|
||||
const objectRegistry& obr_;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
// Private member functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
|
||||
Reference in New Issue
Block a user