functionObjects: Simplified the handling of the post-processing mode

Replaced the 'postProcess' argument to the 'write' and 'execute'
functions with the single static member 'postProcess' in the
functionObject base-class.
This commit is contained in:
Henry Weller
2016-06-13 08:36:03 +01:00
parent 41c2e4bc11
commit b3f4d5855d
102 changed files with 190 additions and 254 deletions

View File

@ -76,7 +76,7 @@ Foam::functionObjects::components::~components()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::functionObjects::components::write(const bool postProcess)
bool Foam::functionObjects::components::write()
{
bool written = true;

View File

@ -107,7 +107,7 @@ public:
// Member Functions
//- Write the component fields
virtual bool write(const bool postProcess = false);
virtual bool write();
//- Clear the component fields from the objectRegistry
virtual bool clear();

View File

@ -322,7 +322,7 @@ bool Foam::functionObjects::fieldAverage::read(const dictionary& dict)
}
bool Foam::functionObjects::fieldAverage::execute(const bool postProcess)
bool Foam::functionObjects::fieldAverage::execute()
{
calcAverages();
@ -330,7 +330,7 @@ bool Foam::functionObjects::fieldAverage::execute(const bool postProcess)
}
bool Foam::functionObjects::fieldAverage::write(const bool postProcess)
bool Foam::functionObjects::fieldAverage::write()
{
writeAverages();
writeAveragingProperties();

View File

@ -296,10 +296,10 @@ public:
virtual bool read(const dictionary&);
//- Calculate the field averages
virtual bool execute(const bool postProcess = false);
virtual bool execute();
//- Write the field averages
virtual bool write(const bool postProcess = false);
virtual bool write();
};

View File

@ -98,10 +98,7 @@ bool Foam::functionObjects::fieldCoordinateSystemTransform::read
}
bool Foam::functionObjects::fieldCoordinateSystemTransform::execute
(
const bool postProcess
)
bool Foam::functionObjects::fieldCoordinateSystemTransform::execute()
{
forAll(fieldSet_, fieldi)
{
@ -116,10 +113,7 @@ bool Foam::functionObjects::fieldCoordinateSystemTransform::execute
}
bool Foam::functionObjects::fieldCoordinateSystemTransform::write
(
const bool postProcess
)
bool Foam::functionObjects::fieldCoordinateSystemTransform::write()
{
forAll(fieldSet_, fieldi)
{

View File

@ -145,10 +145,10 @@ public:
virtual bool read(const dictionary&);
//- Calculate the transformed fields
virtual bool execute(const bool postProcess = false);
virtual bool execute();
//- Write the transformed fields
virtual bool write(const bool postProcess = false);
virtual bool write();
};

View File

@ -116,7 +116,7 @@ bool Foam::functionObjects::fieldExpression::read(const dictionary& dict)
}
bool Foam::functionObjects::fieldExpression::execute(const bool postProcess)
bool Foam::functionObjects::fieldExpression::execute()
{
if (!calc())
{
@ -136,7 +136,7 @@ bool Foam::functionObjects::fieldExpression::execute(const bool postProcess)
}
bool Foam::functionObjects::fieldExpression::write(const bool postProcess)
bool Foam::functionObjects::fieldExpression::write()
{
return writeObject(resultName_);
}

View File

@ -116,10 +116,10 @@ public:
virtual bool read(const dictionary&);
//- Calculate the result field
virtual bool execute(const bool postProcess = false);
virtual bool execute();
//- Write the result field
virtual bool write(const bool postProcess = false);
virtual bool write();
//- Clear the result field from the objectRegistry
virtual bool clear();

View File

@ -140,13 +140,13 @@ bool Foam::functionObjects::fieldMinMax::read(const dictionary& dict)
}
bool Foam::functionObjects::fieldMinMax::execute(const bool postProcess)
bool Foam::functionObjects::fieldMinMax::execute()
{
return true;
}
bool Foam::functionObjects::fieldMinMax::write(const bool postProcess)
bool Foam::functionObjects::fieldMinMax::write()
{
writeFiles::write();

View File

@ -181,10 +181,10 @@ public:
virtual bool read(const dictionary&);
//- Execute, currently does nothing
virtual bool execute(const bool postProcess = false);
virtual bool execute();
//- Write the fieldMinMax
virtual bool write(const bool postProcess = false);
virtual bool write();
};

View File

@ -97,13 +97,13 @@ bool Foam::functionObjects::fieldValue::read(const dictionary& dict)
}
bool Foam::functionObjects::fieldValue::execute(const bool postProcess)
bool Foam::functionObjects::fieldValue::execute()
{
return true;
}
bool Foam::functionObjects::fieldValue::write(const bool postProcess)
bool Foam::functionObjects::fieldValue::write()
{
writeFiles::write();

View File

@ -172,10 +172,10 @@ public:
virtual bool read(const dictionary& dict);
//- Execute
virtual bool execute(const bool postProcess = false);
virtual bool execute();
//- Write to screen/file
virtual bool write(const bool postProcess = false);
virtual bool write();
};

View File

@ -164,10 +164,7 @@ bool Foam::functionObjects::fieldValues::fieldValueDelta::read
}
bool Foam::functionObjects::fieldValues::fieldValueDelta::write
(
const bool postProcess
)
bool Foam::functionObjects::fieldValues::fieldValueDelta::write()
{
writeFiles::write();
@ -206,10 +203,7 @@ bool Foam::functionObjects::fieldValues::fieldValueDelta::write
}
bool Foam::functionObjects::fieldValues::fieldValueDelta::execute
(
const bool postProcess
)
bool Foam::functionObjects::fieldValues::fieldValueDelta::execute()
{
return true;
}

View File

@ -171,10 +171,10 @@ public:
virtual bool read(const dictionary&);
//- Do nothing
virtual bool execute(const bool postProcess = false);
virtual bool execute();
//- Calculate and write
virtual bool write(const bool postProcess = false);
virtual bool write();
};

View File

@ -721,10 +721,7 @@ bool Foam::functionObjects::fieldValues::surfaceRegion::read
}
bool Foam::functionObjects::fieldValues::surfaceRegion::write
(
const bool postProcess
)
bool Foam::functionObjects::fieldValues::surfaceRegion::write()
{
fieldValue::write();

View File

@ -402,7 +402,7 @@ public:
virtual bool read(const dictionary&);
//- Calculate and write
virtual bool write(const bool postProcess = false);
virtual bool write();
};

View File

@ -275,10 +275,7 @@ bool Foam::functionObjects::fieldValues::volRegion::read
}
bool Foam::functionObjects::fieldValues::volRegion::write
(
const bool postProcess
)
bool Foam::functionObjects::fieldValues::volRegion::write()
{
fieldValue::write();

View File

@ -279,7 +279,7 @@ public:
virtual bool read(const dictionary&);
//- Calculate and write
virtual bool write(const bool postProcess = false);
virtual bool write();
};

View File

@ -109,13 +109,13 @@ bool Foam::functionObjects::histogram::read(const dictionary& dict)
}
bool Foam::functionObjects::histogram::execute(const bool postProcess)
bool Foam::functionObjects::histogram::execute()
{
return true;
}
bool Foam::functionObjects::histogram::write(const bool postProcess)
bool Foam::functionObjects::histogram::write()
{
Log << type() << " " << name() << " write:" << nl;

View File

@ -148,12 +148,12 @@ public:
virtual bool read(const dictionary&);
//- Execute, currently does nothing
virtual bool execute(const bool postProcess = false);
virtual bool execute();
//- Calculate the histogram and write.
// postProcess overrides the usual writeControl behaviour and
// forces writing always (used in post-processing mode)
virtual bool write(const bool postProcess = false);
virtual bool write();
};

View File

@ -286,7 +286,7 @@ bool Foam::functionObjects::nearWallFields::read(const dictionary& dict)
}
bool Foam::functionObjects::nearWallFields::execute(const bool postProcess)
bool Foam::functionObjects::nearWallFields::execute()
{
DebugInFunction << endl;
@ -327,7 +327,7 @@ bool Foam::functionObjects::nearWallFields::execute(const bool postProcess)
}
bool Foam::functionObjects::nearWallFields::write(const bool postProcess)
bool Foam::functionObjects::nearWallFields::write()
{
DebugInFunction << endl;

View File

@ -196,10 +196,10 @@ public:
virtual bool read(const dictionary&);
//- Calculate the near-wall fields
virtual bool execute(const bool postProcess = false);
virtual bool execute();
//- Write the near-wall fields
virtual bool write(const bool postProcess = false);
virtual bool write();
};

View File

@ -89,7 +89,7 @@ bool Foam::functionObjects::processorField::read(const dictionary& dict)
}
bool Foam::functionObjects::processorField::execute(const bool postProcess)
bool Foam::functionObjects::processorField::execute()
{
const volScalarField& procField =
mesh_.lookupObject<volScalarField>("processorID");
@ -101,7 +101,7 @@ bool Foam::functionObjects::processorField::execute(const bool postProcess)
}
bool Foam::functionObjects::processorField::write(const bool postProcess)
bool Foam::functionObjects::processorField::write()
{
const volScalarField& procField =
mesh_.lookupObject<volScalarField>("processorID");

View File

@ -111,10 +111,10 @@ public:
virtual bool read(const dictionary&);
//- Calculate the processorID field
virtual bool execute(const bool postProcess = false);
virtual bool execute();
//- Write the processorID field
virtual bool write(const bool postProcess = false);
virtual bool write();
};

View File

@ -74,7 +74,7 @@ bool Foam::functionObjects::readFields::read(const dictionary& dict)
}
bool Foam::functionObjects::readFields::execute(const bool postProcess)
bool Foam::functionObjects::readFields::execute()
{
// Clear out any previously loaded fields
vsf_.clear();
@ -105,7 +105,7 @@ bool Foam::functionObjects::readFields::execute(const bool postProcess)
}
bool Foam::functionObjects::readFields::write(const bool postProcess)
bool Foam::functionObjects::readFields::write()
{
return true;
}

View File

@ -154,10 +154,10 @@ public:
virtual bool read(const dictionary&);
//- Read the fields
virtual bool execute(const bool postProcess = false);
virtual bool execute();
//- Do nothing
virtual bool write(const bool postProcess = false);
virtual bool write();
};

View File

@ -378,19 +378,13 @@ bool Foam::functionObjects::regionSizeDistribution::read(const dictionary& dict)
}
bool Foam::functionObjects::regionSizeDistribution::execute
(
const bool postProcess
)
bool Foam::functionObjects::regionSizeDistribution::execute()
{
return true;
}
bool Foam::functionObjects::regionSizeDistribution::write
(
const bool postProcess
)
bool Foam::functionObjects::regionSizeDistribution::write()
{
Info<< type() << " " << name() << " write:" << nl;

View File

@ -256,10 +256,10 @@ public:
virtual bool read(const dictionary&);
//- Do nothing
virtual bool execute(const bool postProcess = false);
virtual bool execute();
//- Calculate the regionSizeDistribution and write
virtual bool write(const bool postProcess = false);
virtual bool write();
};

View File

@ -423,13 +423,13 @@ bool Foam::functionObjects::streamLine::read(const dictionary& dict)
}
bool Foam::functionObjects::streamLine::execute(const bool postProcess)
bool Foam::functionObjects::streamLine::execute()
{
return true;
}
bool Foam::functionObjects::streamLine::write(const bool postProcess)
bool Foam::functionObjects::streamLine::write()
{
Info<< type() << " " << name() << " write:" << nl;

View File

@ -243,10 +243,10 @@ public:
virtual bool read(const dictionary&);
//- Do nothing
virtual bool execute(const bool postProcess = false);
virtual bool execute();
//- Calculate and write the steamlines
virtual bool write(const bool postProcess = false);
virtual bool write();
//- Update for changes of mesh
virtual void updateMesh(const mapPolyMesh&);

View File

@ -80,10 +80,7 @@ bool Foam::functionObjects::surfaceInterpolate::read
}
bool Foam::functionObjects::surfaceInterpolate::execute
(
const bool postProcess
)
bool Foam::functionObjects::surfaceInterpolate::execute()
{
Info<< type() << " " << name() << " write:" << nl;
@ -106,10 +103,7 @@ bool Foam::functionObjects::surfaceInterpolate::execute
}
bool Foam::functionObjects::surfaceInterpolate::write
(
const bool postProcess
)
bool Foam::functionObjects::surfaceInterpolate::write()
{
Info<< type() << " " << name() << " write:" << nl;

View File

@ -157,10 +157,10 @@ public:
virtual bool read(const dictionary&);
//- Calculate the interpolated fields
virtual bool execute(const bool postProcess = false);
virtual bool execute();
//- Write the interpolated fields
virtual bool write(const bool postProcess = false);
virtual bool write();
};

View File

@ -174,7 +174,7 @@ bool Foam::functionObjects::turbulenceFields::read(const dictionary& dict)
}
bool Foam::functionObjects::turbulenceFields::execute(const bool postProcess)
bool Foam::functionObjects::turbulenceFields::execute()
{
bool comp = compressible();
@ -299,7 +299,7 @@ bool Foam::functionObjects::turbulenceFields::execute(const bool postProcess)
}
bool Foam::functionObjects::turbulenceFields::write(const bool postProcess)
bool Foam::functionObjects::turbulenceFields::write()
{
forAllConstIter(wordHashSet, fieldSet_, iter)
{

View File

@ -203,11 +203,11 @@ public:
virtual bool read(const dictionary&);
//- Calculate turbulence fields
virtual bool execute(const bool postProcess = false);
virtual bool execute();
//- Do nothing.
// The turbulence fields are registered and written automatically
virtual bool write(const bool postProcess = false);
virtual bool write();
};

View File

@ -588,16 +588,13 @@ bool Foam::functionObjects::wallBoundedStreamLine::read(const dictionary& dict)
}
bool Foam::functionObjects::wallBoundedStreamLine::execute
(
const bool postProcess
)
bool Foam::functionObjects::wallBoundedStreamLine::execute()
{
return true;
}
bool Foam::functionObjects::wallBoundedStreamLine::write(const bool postProcess)
bool Foam::functionObjects::wallBoundedStreamLine::write()
{
const Time& runTime = obr_.time();
const fvMesh& mesh = dynamic_cast<const fvMesh&>(obr_);

View File

@ -249,10 +249,10 @@ public:
virtual bool read(const dictionary&);
//- Do nothing
virtual bool execute(const bool postProcess = false);
virtual bool execute();
//- Calculate and write the wall-bounded streamlines
virtual bool write(const bool postProcess = false);
virtual bool write();
//- Update for changes of mesh
virtual void updateMesh(const mapPolyMesh&);

View File

@ -191,7 +191,7 @@ bool Foam::functionObjects::wallShearStress::read(const dictionary& dict)
}
bool Foam::functionObjects::wallShearStress::execute(const bool postProcess)
bool Foam::functionObjects::wallShearStress::execute()
{
typedef compressible::turbulenceModel cmpModel;
typedef incompressible::turbulenceModel icoModel;
@ -232,7 +232,7 @@ bool Foam::functionObjects::wallShearStress::execute(const bool postProcess)
}
bool Foam::functionObjects::wallShearStress::write(const bool postProcess)
bool Foam::functionObjects::wallShearStress::write()
{
writeFiles::write();

View File

@ -161,10 +161,10 @@ public:
virtual bool read(const dictionary&);
//- Calculate the wall shear-stress
virtual bool execute(const bool postProcess = false);
virtual bool execute();
//- Write the wall shear-stress
virtual bool write(const bool postProcess = false);
virtual bool write();
};

View File

@ -170,7 +170,7 @@ bool Foam::functionObjects::yPlus::read(const dictionary& dict)
}
bool Foam::functionObjects::yPlus::execute(const bool postProcess)
bool Foam::functionObjects::yPlus::execute()
{
const fvMesh& mesh = refCast<const fvMesh>(obr_);
@ -198,7 +198,7 @@ bool Foam::functionObjects::yPlus::execute(const bool postProcess)
}
bool Foam::functionObjects::yPlus::write(const bool postProcess)
bool Foam::functionObjects::yPlus::write()
{
const volScalarField& yPlus =
obr_.lookupObject<volScalarField>(type());

View File

@ -114,10 +114,10 @@ public:
virtual bool read(const dictionary&);
//- Calculate the yPlus field
virtual bool execute(const bool postProcess = false);
virtual bool execute();
//- Write the yPlus field
virtual bool write(const bool postProcess = false);
virtual bool write();
};