functionObjects::volRegion: General base-class to handle vol (cell) region processing

Renamed the original volRegion -> volFieldValue to clarify the purpose
of this class to process vol fields on a volRegion.
This commit is contained in:
Henry Weller
2016-08-11 15:11:19 +01:00
parent 225c6777b2
commit 7b788f0922
18 changed files with 539 additions and 126 deletions

View File

@ -6,7 +6,7 @@
| \\/ M anipulation | | | \\/ M anipulation | |
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
type volRegion; type volFieldValue;
libs ("libfieldFunctionObjects.so"); libs ("libfieldFunctionObjects.so");
writeControl timeStep; writeControl timeStep;

View File

@ -91,7 +91,8 @@ $(faceToCell)/extendedFaceToCellStencil.C
$(faceToCell)/extendedCentredFaceToCellStencil.C $(faceToCell)/extendedCentredFaceToCellStencil.C
$(faceToCell)/MeshObjects/centredCFCFaceToCellStencilObject.C $(faceToCell)/MeshObjects/centredCFCFaceToCellStencilObject.C
fvMesh/fvMeshFunctionObject/fvMeshFunctionObject.C functionObjects/fvMeshFunctionObject/fvMeshFunctionObject.C
functionObjects/volRegion/volRegion.C
fvPatchFields = fields/fvPatchFields fvPatchFields = fields/fvPatchFields
$(fvPatchFields)/fvPatchField/fvPatchFields.C $(fvPatchFields)/fvPatchField/fvPatchFields.C

View File

@ -0,0 +1,189 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "volRegion.H"
#include "volMesh.H"
#include "globalMeshData.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace functionObjects
{
defineTypeNameAndDebug(volRegion, 0);
}
}
template<>
const char*
Foam::NamedEnum
<
Foam::functionObjects::volRegion::regionTypes,
2
>::names[] = {"cellZone", "all"};
const Foam::NamedEnum
<
Foam::functionObjects::volRegion::regionTypes,
2
> Foam::functionObjects::volRegion::regionTypeNames_;
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
void Foam::functionObjects::volRegion::writeFileHeader
(
const writeFile& wf,
Ostream& file
)
{
wf.writeCommented(file, "Region : ");
file << regionTypeNames_[regionType_] << " " << regionName_ << endl;
wf.writeHeaderValue(file, "Cells", nCells());
wf.writeHeaderValue(file, "Volume", V());
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::functionObjects::volRegion::volRegion
(
const fvMesh& mesh,
const dictionary& dict
)
:
mesh_(mesh),
regionType_
(
dict.found("regionType")
? regionTypeNames_.read(dict.lookup("regionType"))
: vrtAll
),
regionID_(-1)
{
read(dict);
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::functionObjects::volRegion::~volRegion()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::functionObjects::volRegion::read
(
const dictionary& dict
)
{
switch (regionType_)
{
case vrtCellZone:
{
dict.lookup("name") >> regionName_;
regionID_ = mesh_.cellZones().findZoneID(regionName_);
if (regionID_ < 0)
{
FatalIOErrorInFunction(dict)
<< "Unknown cell zone name: " << regionName_
<< ". Valid cell zones are: " << mesh_.cellZones().names()
<< exit(FatalIOError);
}
if (nCells() == 0)
{
FatalIOErrorInFunction(dict)
<< regionTypeNames_[regionType_]
<< "(" << regionName_ << "):" << nl
<< " Region has no cells"
<< exit(FatalIOError);
}
break;
}
case vrtAll:
{
break;
}
default:
{
FatalIOErrorInFunction(dict)
<< "Unknown region type. Valid region types are:"
<< regionTypeNames_
<< exit(FatalIOError);
}
}
return true;
}
const Foam::labelList& Foam::functionObjects::volRegion::cellIDs() const
{
if (regionType_ == vrtAll)
{
return labelList::null();
}
else
{
return mesh_.cellZones()[regionID_];
}
}
Foam::label Foam::functionObjects::volRegion::nCells() const
{
if (regionType_ == vrtAll)
{
return mesh_.globalData().nTotalCells();
}
else
{
return returnReduce(cellIDs().size(), sumOp<label>());
}
}
Foam::scalar Foam::functionObjects::volRegion::V() const
{
if (regionType_ == vrtAll)
{
return gSum(mesh_.V());
}
else
{
return gSum(scalarField(mesh_.V(), cellIDs()));
}
}
// ************************************************************************* //

View File

@ -0,0 +1,185 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::functionObjects::volRegion
Group
grpFieldFunctionObjects
Description
Volume (cell) region selection class.
Examples of function object specification:
\verbatim
volRegion0
{
.
.
regionType cellZone;
name c0;
.
.
}
volRegionAll
{
.
.
regionType all;
.
.
}
\endverbatim
Usage
\table
Property | Description | Required | Default value
regionType | cellZone or all | no | all
name | Name of cellZone if required | no |
\endtable
See also
Foam::functionObject
SourceFiles
volRegion.C
\*---------------------------------------------------------------------------*/
#ifndef functionObjects_volRegion_H
#define functionObjects_volRegion_H
#include "writeFile.H"
#include "NamedEnum.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
class fvMesh;
namespace functionObjects
{
/*---------------------------------------------------------------------------*\
Class volRegion Declaration
\*---------------------------------------------------------------------------*/
class volRegion
{
// Private member data
const fvMesh& mesh_;
public:
// Public data types
//- Region type enumeration
enum regionTypes
{
vrtCellZone,
vrtAll
};
//- Region type names
static const NamedEnum<regionTypes, 2> regionTypeNames_;
protected:
// Protected data
//- Region type
regionTypes regionType_;
//- Region name (patch, zone, etc.)
word regionName_;
//- Region ID (patch ID, zone ID, etc.)
label regionID_;
// Protected Member Functions
//- Output file header information
void writeFileHeader(const writeFile& wf, Ostream& file);
public:
//- Run-time type information
TypeName("volRegion");
// Constructors
//- Construct from fvMesh and dictionary
volRegion
(
const fvMesh& mesh,
const dictionary& dict
);
//- Destructor
virtual ~volRegion();
// Public Member Functions
//- Read from dictionary
bool read(const dictionary&);
//- Return the region type
inline const regionTypes& regionType() const;
//- Return the local list of cell IDs
const labelList& cellIDs() const;
//- Return the number of cells in the region
label nCells() const;
//- Return total volume of the region
scalar V() const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace functionObjects
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "volRegionI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -23,22 +23,12 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "volRegion.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
inline const Foam::functionObjects::fieldValues::volRegion::regionTypes& inline const Foam::functionObjects::volRegion::regionTypes&
Foam::functionObjects::fieldValues::volRegion::regionType() const Foam::functionObjects::volRegion::regionType() const
{ {
return regionType_; return regionType_;
} }
inline const Foam::labelList&
Foam::functionObjects::fieldValues::volRegion::cellId() const
{
return cellId_;
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -8,8 +8,8 @@ fieldMinMax/fieldMinMax.C
fieldValues/fieldValue/fieldValue.C fieldValues/fieldValue/fieldValue.C
fieldValues/fieldValue/fieldValueNew.C fieldValues/fieldValue/fieldValueNew.C
fieldValues/fieldValueDelta/fieldValueDelta.C fieldValues/fieldValueDelta/fieldValueDelta.C
fieldValues/volRegion/volRegion.C fieldValues/volFieldValue/volFieldValue.C
fieldValues/surfaceRegion/surfaceRegion.C fieldValues/surfaceFieldValue/surfaceFieldValue.C
nearWallFields/nearWallFields.C nearWallFields/nearWallFields.C
nearWallFields/findCellParticle.C nearWallFields/findCellParticle.C

View File

@ -178,7 +178,7 @@ public:
//- Execute //- Execute
virtual bool execute(); virtual bool execute();
//- Write to screen/file //- Write
virtual bool write(); virtual bool write();
}; };

View File

@ -23,7 +23,7 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "surfaceRegion.H" #include "surfaceFieldValue.H"
#include "fvMesh.H" #include "fvMesh.H"
#include "cyclicPolyPatch.H" #include "cyclicPolyPatch.H"
#include "emptyPolyPatch.H" #include "emptyPolyPatch.H"
@ -42,9 +42,9 @@ namespace functionObjects
{ {
namespace fieldValues namespace fieldValues
{ {
defineTypeNameAndDebug(surfaceRegion, 0); defineTypeNameAndDebug(surfaceFieldValue, 0);
addToRunTimeSelectionTable(fieldValue, surfaceRegion, dictionary); addToRunTimeSelectionTable(fieldValue, surfaceFieldValue, dictionary);
addToRunTimeSelectionTable(functionObject, surfaceRegion, dictionary); addToRunTimeSelectionTable(functionObject, surfaceFieldValue, dictionary);
} }
} }
} }
@ -52,7 +52,7 @@ namespace fieldValues
template<> template<>
const char* Foam::NamedEnum const char* Foam::NamedEnum
< <
Foam::functionObjects::fieldValues::surfaceRegion::regionTypes, Foam::functionObjects::fieldValues::surfaceFieldValue::regionTypes,
3 3
>::names[] = >::names[] =
{ {
@ -64,7 +64,7 @@ const char* Foam::NamedEnum
template<> template<>
const char* Foam::NamedEnum const char* Foam::NamedEnum
< <
Foam::functionObjects::fieldValues::surfaceRegion::operationType, Foam::functionObjects::fieldValues::surfaceFieldValue::operationType,
15 15
>::names[] = >::names[] =
{ {
@ -87,20 +87,20 @@ const char* Foam::NamedEnum
const Foam::NamedEnum const Foam::NamedEnum
< <
Foam::functionObjects::fieldValues::surfaceRegion::regionTypes, Foam::functionObjects::fieldValues::surfaceFieldValue::regionTypes,
3 3
> Foam::functionObjects::fieldValues::surfaceRegion::regionTypeNames_; > Foam::functionObjects::fieldValues::surfaceFieldValue::regionTypeNames_;
const Foam::NamedEnum const Foam::NamedEnum
< <
Foam::functionObjects::fieldValues::surfaceRegion::operationType, Foam::functionObjects::fieldValues::surfaceFieldValue::operationType,
15 15
> Foam::functionObjects::fieldValues::surfaceRegion::operationTypeNames_; > Foam::functionObjects::fieldValues::surfaceFieldValue::operationTypeNames_;
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::functionObjects::fieldValues::surfaceRegion::setFaceZoneFaces() void Foam::functionObjects::fieldValues::surfaceFieldValue::setFaceZoneFaces()
{ {
label zoneId = mesh_.faceZones().findZoneID(regionName_); label zoneId = mesh_.faceZones().findZoneID(regionName_);
@ -185,7 +185,7 @@ void Foam::functionObjects::fieldValues::surfaceRegion::setFaceZoneFaces()
} }
void Foam::functionObjects::fieldValues::surfaceRegion::setPatchFaces() void Foam::functionObjects::fieldValues::surfaceFieldValue::setPatchFaces()
{ {
const label patchid = mesh_.boundaryMesh().findPatchID(regionName_); const label patchid = mesh_.boundaryMesh().findPatchID(regionName_);
@ -222,7 +222,7 @@ void Foam::functionObjects::fieldValues::surfaceRegion::setPatchFaces()
} }
void Foam::functionObjects::fieldValues::surfaceRegion::sampledSurfaceFaces void Foam::functionObjects::fieldValues::surfaceFieldValue::sampledSurfaceFaces
( (
const dictionary& dict const dictionary& dict
) )
@ -238,7 +238,7 @@ void Foam::functionObjects::fieldValues::surfaceRegion::sampledSurfaceFaces
} }
void Foam::functionObjects::fieldValues::surfaceRegion::combineMeshGeometry void Foam::functionObjects::fieldValues::surfaceFieldValue::combineMeshGeometry
( (
faceList& faces, faceList& faces,
pointField& points pointField& points
@ -359,7 +359,8 @@ void Foam::functionObjects::fieldValues::surfaceRegion::combineMeshGeometry
} }
void Foam::functionObjects::fieldValues::surfaceRegion::combineSurfaceGeometry void Foam::functionObjects::fieldValues::surfaceFieldValue::
combineSurfaceGeometry
( (
faceList& faces, faceList& faces,
pointField& points pointField& points
@ -399,7 +400,7 @@ void Foam::functionObjects::fieldValues::surfaceRegion::combineSurfaceGeometry
Foam::scalar Foam::scalar
Foam::functionObjects::fieldValues::surfaceRegion::totalArea() const Foam::functionObjects::fieldValues::surfaceFieldValue::totalArea() const
{ {
scalar totalArea; scalar totalArea;
@ -418,7 +419,7 @@ Foam::functionObjects::fieldValues::surfaceRegion::totalArea() const
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
void Foam::functionObjects::fieldValues::surfaceRegion::initialise void Foam::functionObjects::fieldValues::surfaceFieldValue::initialise
( (
const dictionary& dict const dictionary& dict
) )
@ -533,7 +534,7 @@ void Foam::functionObjects::fieldValues::surfaceRegion::initialise
} }
void Foam::functionObjects::fieldValues::surfaceRegion::writeFileHeader void Foam::functionObjects::fieldValues::surfaceFieldValue::writeFileHeader
( (
const label i const label i
) )
@ -566,7 +567,8 @@ void Foam::functionObjects::fieldValues::surfaceRegion::writeFileHeader
template<> template<>
Foam::scalar Foam::functionObjects::fieldValues::surfaceRegion::processValues Foam::scalar Foam::functionObjects::fieldValues::surfaceFieldValue::
processValues
( (
const Field<scalar>& values, const Field<scalar>& values,
const vectorField& Sf, const vectorField& Sf,
@ -597,7 +599,8 @@ Foam::scalar Foam::functionObjects::fieldValues::surfaceRegion::processValues
template<> template<>
Foam::vector Foam::functionObjects::fieldValues::surfaceRegion::processValues Foam::vector Foam::functionObjects::fieldValues::surfaceFieldValue::
processValues
( (
const Field<vector>& values, const Field<vector>& values,
const vectorField& Sf, const vectorField& Sf,
@ -643,7 +646,7 @@ Foam::vector Foam::functionObjects::fieldValues::surfaceRegion::processValues
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::functionObjects::fieldValues::surfaceRegion::surfaceRegion Foam::functionObjects::fieldValues::surfaceFieldValue::surfaceFieldValue
( (
const word& name, const word& name,
const Time& runTime, const Time& runTime,
@ -667,7 +670,7 @@ Foam::functionObjects::fieldValues::surfaceRegion::surfaceRegion
read(dict); read(dict);
} }
Foam::functionObjects::fieldValues::surfaceRegion::surfaceRegion Foam::functionObjects::fieldValues::surfaceFieldValue::surfaceFieldValue
( (
const word& name, const word& name,
const objectRegistry& obr, const objectRegistry& obr,
@ -694,13 +697,13 @@ Foam::functionObjects::fieldValues::surfaceRegion::surfaceRegion
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::functionObjects::fieldValues::surfaceRegion::~surfaceRegion() Foam::functionObjects::fieldValues::surfaceFieldValue::~surfaceFieldValue()
{} {}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::functionObjects::fieldValues::surfaceRegion::read bool Foam::functionObjects::fieldValues::surfaceFieldValue::read
( (
const dictionary& dict const dictionary& dict
) )
@ -712,7 +715,7 @@ bool Foam::functionObjects::fieldValues::surfaceRegion::read
} }
bool Foam::functionObjects::fieldValues::surfaceRegion::write() bool Foam::functionObjects::fieldValues::surfaceFieldValue::write()
{ {
if (operation_ != opNone) if (operation_ != opNone)
{ {

View File

@ -22,7 +22,7 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class Class
Foam::functionObjects::fieldValues::surfaceRegion Foam::functionObjects::fieldValues::surfaceFieldValue
Group Group
grpFieldFunctionObjects grpFieldFunctionObjects
@ -41,7 +41,7 @@ Description
\verbatim \verbatim
movingWallPatch movingWallPatch
{ {
type surfaceRegion; type surfaceFieldValue;
libs ("libfieldFunctionObjects.so"); libs ("libfieldFunctionObjects.so");
log true; log true;
@ -61,9 +61,9 @@ Description
); );
} }
surfaceRegion1 surfaceFieldValue1
{ {
type surfaceRegion; type surfaceFieldValue;
libs ("libfieldFunctionObjects.so"); libs ("libfieldFunctionObjects.so");
log true; log true;
@ -90,10 +90,10 @@ Description
Usage Usage
\table \table
Property | Description | Required | Default value Property | Description | Required | Default value
type | type name: surfaceRegion | yes | type | type name: surfaceFieldValue | yes |
log | write data to standard output | no | no log | write data to standard output | no | no
writeFields | Write the region field values | yes | writeFields | Write the region field values | yes |
writeArea | Write the area of the surfaceRegion | no | writeArea | Write the area of the surfaceFieldValue | no |
surfaceFormat | output value format | no | surfaceFormat | output value format | no |
regionType | face regionType: see below | yes | regionType | face regionType: see below | yes |
name | name of face regionType if required | no | name | name of face regionType if required | no |
@ -155,13 +155,13 @@ See also
Foam::functionObject Foam::functionObject
SourceFiles SourceFiles
surfaceRegion.C surfaceFieldValue.C
surfaceRegionTemplates.C surfaceFieldValueTemplates.C
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef functionObjects_surfaceRegion_H #ifndef functionObjects_surfaceFieldValue_H
#define functionObjects_surfaceRegion_H #define functionObjects_surfaceFieldValue_H
#include "fieldValue.H" #include "fieldValue.H"
#include "NamedEnum.H" #include "NamedEnum.H"
@ -180,10 +180,10 @@ namespace fieldValues
{ {
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class surfaceRegion Declaration Class surfaceFieldValue Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class surfaceRegion class surfaceFieldValue
: :
public fieldValue public fieldValue
{ {
@ -255,7 +255,7 @@ private:
pointField& points pointField& points
) const; ) const;
//- Calculate and return total area of the surfaceRegion: sum(magSf) //- Calculate and return total area of the surfaceFieldValue: sum(magSf)
scalar totalArea() const; scalar totalArea() const;
@ -284,10 +284,10 @@ protected:
//- Scale factor - optional //- Scale factor - optional
scalar scaleFactor_; scalar scaleFactor_;
//- Total area of the surfaceRegion //- Total area of the surfaceFieldValue
scalar totalArea_; scalar totalArea_;
//- Optionally write the area of the surfaceRegion //- Optionally write the area of the surfaceFieldValue
bool writeArea_; bool writeArea_;
//- Global number of faces //- Global number of faces
@ -358,13 +358,13 @@ protected:
public: public:
//- Run-time type information //- Run-time type information
TypeName("surfaceRegion"); TypeName("surfaceFieldValue");
// Constructors // Constructors
//- Construct from name, Time and dictionary //- Construct from name, Time and dictionary
surfaceRegion surfaceFieldValue
( (
const word& name, const word& name,
const Time& runTime, const Time& runTime,
@ -372,7 +372,7 @@ public:
); );
//- Construct from name, objectRegistry and dictionary //- Construct from name, objectRegistry and dictionary
surfaceRegion surfaceFieldValue
( (
const word& name, const word& name,
const objectRegistry& obr, const objectRegistry& obr,
@ -381,7 +381,7 @@ public:
//- Destructor //- Destructor
virtual ~surfaceRegion(); virtual ~surfaceFieldValue();
// Public Member Functions // Public Member Functions
@ -436,7 +436,7 @@ public:
//- Specialisation for scalar //- Specialisation for scalar
template<> template<>
scalar surfaceRegion::processValues scalar surfaceFieldValue::processValues
( (
const Field<scalar>& values, const Field<scalar>& values,
const vectorField& Sf, const vectorField& Sf,
@ -446,7 +446,7 @@ scalar surfaceRegion::processValues
//- Specialisation for vector //- Specialisation for vector
template<> template<>
vector surfaceRegion::processValues vector surfaceFieldValue::processValues
( (
const Field<vector>& values, const Field<vector>& values,
const vectorField& Sf, const vectorField& Sf,
@ -462,12 +462,12 @@ vector surfaceRegion::processValues
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "surfaceRegionI.H" #include "surfaceFieldValueI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository #ifdef NoRepository
#include "surfaceRegionTemplates.C" #include "surfaceFieldValueTemplates.C"
#endif #endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -23,40 +23,40 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "surfaceRegion.H" #include "surfaceFieldValue.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
inline const Foam::functionObjects::fieldValues::surfaceRegion::regionTypes& inline const Foam::functionObjects::fieldValues::surfaceFieldValue::regionTypes&
Foam::functionObjects::fieldValues::surfaceRegion::regionType() const Foam::functionObjects::fieldValues::surfaceFieldValue::regionType() const
{ {
return regionType_; return regionType_;
} }
inline const Foam::labelList& inline const Foam::labelList&
Foam::functionObjects::fieldValues::surfaceRegion::faceId() const Foam::functionObjects::fieldValues::surfaceFieldValue::faceId() const
{ {
return faceId_; return faceId_;
} }
inline const Foam::labelList& inline const Foam::labelList&
Foam::functionObjects::fieldValues::surfaceRegion::facePatch() const Foam::functionObjects::fieldValues::surfaceFieldValue::facePatch() const
{ {
return facePatchId_; return facePatchId_;
} }
inline const Foam::labelList& inline const Foam::labelList&
Foam::functionObjects::fieldValues::surfaceRegion::faceSign() const Foam::functionObjects::fieldValues::surfaceFieldValue::faceSign() const
{ {
return faceSign_; return faceSign_;
} }
inline Foam::fileName inline Foam::fileName
Foam::functionObjects::fieldValues::surfaceRegion::outputDir() const Foam::functionObjects::fieldValues::surfaceFieldValue::outputDir() const
{ {
return baseFileDir()/name()/"surface"/obr_.time().timeName(); return baseFileDir()/name()/"surface"/obr_.time().timeName();
} }

View File

@ -23,7 +23,7 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "surfaceRegion.H" #include "surfaceFieldValue.H"
#include "surfaceFields.H" #include "surfaceFields.H"
#include "volFields.H" #include "volFields.H"
#include "sampledSurface.H" #include "sampledSurface.H"
@ -33,7 +33,7 @@ License
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
template<class Type> template<class Type>
bool Foam::functionObjects::fieldValues::surfaceRegion::validField bool Foam::functionObjects::fieldValues::surfaceFieldValue::validField
( (
const word& fieldName const word& fieldName
) const ) const
@ -56,7 +56,7 @@ bool Foam::functionObjects::fieldValues::surfaceRegion::validField
template<class Type> template<class Type>
Foam::tmp<Foam::Field<Type>> Foam::tmp<Foam::Field<Type>>
Foam::functionObjects::fieldValues::surfaceRegion::getFieldValues Foam::functionObjects::fieldValues::surfaceFieldValue::getFieldValues
( (
const word& fieldName, const word& fieldName,
const bool mustGet, const bool mustGet,
@ -125,7 +125,8 @@ Foam::functionObjects::fieldValues::surfaceRegion::getFieldValues
template<class Type> template<class Type>
Type Foam::functionObjects::fieldValues::surfaceRegion::processSameTypeValues Type Foam::functionObjects::fieldValues::surfaceFieldValue::
processSameTypeValues
( (
const Field<Type>& values, const Field<Type>& values,
const vectorField& Sf, const vectorField& Sf,
@ -254,7 +255,7 @@ Type Foam::functionObjects::fieldValues::surfaceRegion::processSameTypeValues
template<class Type> template<class Type>
Type Foam::functionObjects::fieldValues::surfaceRegion::processValues Type Foam::functionObjects::fieldValues::surfaceFieldValue::processValues
( (
const Field<Type>& values, const Field<Type>& values,
const vectorField& Sf, const vectorField& Sf,
@ -269,7 +270,7 @@ Type Foam::functionObjects::fieldValues::surfaceRegion::processValues
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type> template<class Type>
bool Foam::functionObjects::fieldValues::surfaceRegion::writeValues bool Foam::functionObjects::fieldValues::surfaceFieldValue::writeValues
( (
const word& fieldName, const word& fieldName,
const scalarField& weightField, const scalarField& weightField,
@ -355,7 +356,7 @@ bool Foam::functionObjects::fieldValues::surfaceRegion::writeValues
template<class Type> template<class Type>
Foam::tmp<Foam::Field<Type>> Foam::tmp<Foam::Field<Type>>
Foam::functionObjects::fieldValues::surfaceRegion::filterField Foam::functionObjects::fieldValues::surfaceFieldValue::filterField
( (
const GeometricField<Type, fvPatchField, volMesh>& field, const GeometricField<Type, fvPatchField, volMesh>& field,
const bool applyOrientation const bool applyOrientation
@ -397,7 +398,7 @@ Foam::functionObjects::fieldValues::surfaceRegion::filterField
template<class Type> template<class Type>
Foam::tmp<Foam::Field<Type>> Foam::tmp<Foam::Field<Type>>
Foam::functionObjects::fieldValues::surfaceRegion::filterField Foam::functionObjects::fieldValues::surfaceFieldValue::filterField
( (
const GeometricField<Type, fvsPatchField, surfaceMesh>& field, const GeometricField<Type, fvsPatchField, surfaceMesh>& field,
const bool applyOrientation const bool applyOrientation

View File

@ -23,7 +23,7 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "volRegion.H" #include "volFieldValue.H"
#include "fvMesh.H" #include "fvMesh.H"
#include "volFields.H" #include "volFields.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
@ -36,9 +36,9 @@ namespace functionObjects
{ {
namespace fieldValues namespace fieldValues
{ {
defineTypeNameAndDebug(volRegion, 0); defineTypeNameAndDebug(volFieldValue, 0);
addToRunTimeSelectionTable(fieldValue, volRegion, dictionary); addToRunTimeSelectionTable(fieldValue, volFieldValue, dictionary);
addToRunTimeSelectionTable(functionObject, volRegion, dictionary); addToRunTimeSelectionTable(functionObject, volFieldValue, dictionary);
} }
} }
} }
@ -47,7 +47,7 @@ template<>
const char* const char*
Foam::NamedEnum Foam::NamedEnum
< <
Foam::functionObjects::fieldValues::volRegion::regionTypes, Foam::functionObjects::fieldValues::volFieldValue::regionTypes,
2 2
>::names[] = {"cellZone", "all"}; >::names[] = {"cellZone", "all"};
@ -55,7 +55,7 @@ template<>
const char* const char*
Foam::NamedEnum Foam::NamedEnum
< <
Foam::functionObjects::fieldValues::volRegion::operationType, Foam::functionObjects::fieldValues::volFieldValue::operationType,
11 11
>::names[] = >::names[] =
{ {
@ -74,20 +74,20 @@ Foam::NamedEnum
const Foam::NamedEnum const Foam::NamedEnum
< <
Foam::functionObjects::fieldValues::volRegion::regionTypes, Foam::functionObjects::fieldValues::volFieldValue::regionTypes,
2 2
> Foam::functionObjects::fieldValues::volRegion::regionTypeNames_; > Foam::functionObjects::fieldValues::volFieldValue::regionTypeNames_;
const Foam::NamedEnum const Foam::NamedEnum
< <
Foam::functionObjects::fieldValues::volRegion::operationType, Foam::functionObjects::fieldValues::volFieldValue::operationType,
11 11
> Foam::functionObjects::fieldValues::volRegion::operationTypeNames_; > Foam::functionObjects::fieldValues::volFieldValue::operationTypeNames_;
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::functionObjects::fieldValues::volRegion::setCellZoneCells() void Foam::functionObjects::fieldValues::volFieldValue::setCellZoneCells()
{ {
switch (regionType_) switch (regionType_)
{ {
@ -132,7 +132,7 @@ void Foam::functionObjects::fieldValues::volRegion::setCellZoneCells()
} }
Foam::scalar Foam::functionObjects::fieldValues::volRegion::volume() const Foam::scalar Foam::functionObjects::fieldValues::volFieldValue::volume() const
{ {
return gSum(filterField(mesh_.V())); return gSum(filterField(mesh_.V()));
} }
@ -140,7 +140,7 @@ Foam::scalar Foam::functionObjects::fieldValues::volRegion::volume() const
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
void Foam::functionObjects::fieldValues::volRegion::initialise void Foam::functionObjects::fieldValues::volFieldValue::initialise
( (
const dictionary& dict const dictionary& dict
) )
@ -172,7 +172,7 @@ void Foam::functionObjects::fieldValues::volRegion::initialise
} }
void Foam::functionObjects::fieldValues::volRegion::writeFileHeader void Foam::functionObjects::fieldValues::volFieldValue::writeFileHeader
( (
const label i const label i
) )
@ -203,7 +203,7 @@ void Foam::functionObjects::fieldValues::volRegion::writeFileHeader
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::functionObjects::fieldValues::volRegion::volRegion Foam::functionObjects::fieldValues::volFieldValue::volFieldValue
( (
const word& name, const word& name,
const Time& runTime, const Time& runTime,
@ -222,7 +222,7 @@ Foam::functionObjects::fieldValues::volRegion::volRegion
} }
Foam::functionObjects::fieldValues::volRegion::volRegion Foam::functionObjects::fieldValues::volFieldValue::volFieldValue
( (
const word& name, const word& name,
const objectRegistry& obr, const objectRegistry& obr,
@ -243,13 +243,13 @@ Foam::functionObjects::fieldValues::volRegion::volRegion
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::functionObjects::fieldValues::volRegion::~volRegion() Foam::functionObjects::fieldValues::volFieldValue::~volFieldValue()
{} {}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::functionObjects::fieldValues::volRegion::read bool Foam::functionObjects::fieldValues::volFieldValue::read
( (
const dictionary& dict const dictionary& dict
) )
@ -263,7 +263,7 @@ bool Foam::functionObjects::fieldValues::volRegion::read
} }
bool Foam::functionObjects::fieldValues::volRegion::write() bool Foam::functionObjects::fieldValues::volFieldValue::write()
{ {
fieldValue::write(); fieldValue::write();

View File

@ -22,7 +22,7 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class Class
Foam::functionObjects::fieldValues::volRegion Foam::functionObjects::fieldValues::volFieldValue
Group Group
grpFieldFunctionObjects grpFieldFunctionObjects
@ -37,9 +37,9 @@ Description
Example of function object specification: Example of function object specification:
\verbatim \verbatim
volRegion1 volFieldValue1
{ {
type volRegion; type volFieldValue;
libs ("libfieldFunctionObjects.so"); libs ("libfieldFunctionObjects.so");
log true; log true;
@ -63,10 +63,10 @@ Description
Usage Usage
\table \table
Property | Description | Required | Default value Property | Description | Required | Default value
type | Type name: volRegion | yes | type | Type name: volFieldValue | yes |
log | Write data to standard output | no | no log | Write data to standard output | no | no
writeFields | Write the region field values | yes | writeFields | Write the region field values | yes |
writeVolume | Write the volume of the volRegion | no | writeVolume | Write the volume of the volFieldValue | no |
regionType | cell regionType: see below | yes | regionType | cell regionType: see below | yes |
name | name of cell regionType if required | no | name | name of cell regionType if required | no |
operation | operation to perform | yes | operation | operation to perform | yes |
@ -100,12 +100,12 @@ See also
Foam::functionObject Foam::functionObject
SourceFiles SourceFiles
volRegion.C volFieldValue.C
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef functionObjects_volRegion_H #ifndef functionObjects_volFieldValue_H
#define functionObjects_volRegion_H #define functionObjects_volFieldValue_H
#include "fieldValue.H" #include "fieldValue.H"
#include "NamedEnum.H" #include "NamedEnum.H"
@ -120,10 +120,10 @@ namespace fieldValues
{ {
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class volRegion Declaration Class volFieldValue Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class volRegion class volFieldValue
: :
public fieldValue public fieldValue
{ {
@ -173,7 +173,7 @@ private:
//- Set cells to evaluate based on a patch //- Set cells to evaluate based on a patch
void setPatchCells(); void setPatchCells();
//- Calculate and return volume of the volRegion: sum(V) //- Calculate and return volume of the volFieldValue: sum(V)
scalar volume() const; scalar volume() const;
@ -196,10 +196,10 @@ protected:
//- Weight field name - only used for opWeightedAverage mode //- Weight field name - only used for opWeightedAverage mode
word weightFieldName_; word weightFieldName_;
//- Volume of the volRegion //- Volume of the volFieldValue
scalar volume_; scalar volume_;
//- Optionally write the volume of the volRegion //- Optionally write the volume of the volFieldValue
bool writeVolume_; bool writeVolume_;
@ -236,13 +236,13 @@ protected:
public: public:
//- Run-time type information //- Run-time type information
TypeName("volRegion"); TypeName("volFieldValue");
// Constructors // Constructors
//- Construct from name, Time and dictionary //- Construct from name, Time and dictionary
volRegion volFieldValue
( (
const word& name, const word& name,
const Time& runTime, const Time& runTime,
@ -250,7 +250,7 @@ public:
); );
//- Construct from name, objectRegistry and dictionary //- Construct from name, objectRegistry and dictionary
volRegion volFieldValue
( (
const word& name, const word& name,
const objectRegistry& obr, const objectRegistry& obr,
@ -259,7 +259,7 @@ public:
//- Destructor //- Destructor
virtual ~volRegion(); virtual ~volFieldValue();
// Public Member Functions // Public Member Functions
@ -294,12 +294,12 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "volRegionI.H" #include "volFieldValueI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository #ifdef NoRepository
#include "volRegionTemplates.C" #include "volFieldValueTemplates.C"
#endif #endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -0,0 +1,44 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "volFieldValue.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
inline const Foam::functionObjects::fieldValues::volFieldValue::regionTypes&
Foam::functionObjects::fieldValues::volFieldValue::regionType() const
{
return regionType_;
}
inline const Foam::labelList&
Foam::functionObjects::fieldValues::volFieldValue::cellId() const
{
return cellId_;
}
// ************************************************************************* //

View File

@ -23,13 +23,13 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "volRegion.H" #include "volFieldValue.H"
#include "volFields.H" #include "volFields.H"
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
template<class Type> template<class Type>
bool Foam::functionObjects::fieldValues::volRegion::validField bool Foam::functionObjects::fieldValues::volFieldValue::validField
( (
const word& fieldName const word& fieldName
) const ) const
@ -47,7 +47,7 @@ bool Foam::functionObjects::fieldValues::volRegion::validField
template<class Type> template<class Type>
Foam::tmp<Foam::Field<Type>> Foam::tmp<Foam::Field<Type>>
Foam::functionObjects::fieldValues::volRegion::setFieldValues Foam::functionObjects::fieldValues::volFieldValue::setFieldValues
( (
const word& fieldName, const word& fieldName,
const bool mustGet const bool mustGet
@ -72,7 +72,7 @@ Foam::functionObjects::fieldValues::volRegion::setFieldValues
template<class Type> template<class Type>
Type Foam::functionObjects::fieldValues::volRegion::processValues Type Foam::functionObjects::fieldValues::volFieldValue::processValues
( (
const Field<Type>& values, const Field<Type>& values,
const scalarField& V, const scalarField& V,
@ -155,7 +155,7 @@ Type Foam::functionObjects::fieldValues::volRegion::processValues
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type> template<class Type>
bool Foam::functionObjects::fieldValues::volRegion::writeValues bool Foam::functionObjects::fieldValues::volFieldValue::writeValues
( (
const word& fieldName const word& fieldName
) )
@ -217,7 +217,7 @@ bool Foam::functionObjects::fieldValues::volRegion::writeValues
template<class Type> template<class Type>
Foam::tmp<Foam::Field<Type>> Foam::tmp<Foam::Field<Type>>
Foam::functionObjects::fieldValues::volRegion::filterField Foam::functionObjects::fieldValues::volFieldValue::filterField
( (
const Field<Type>& field const Field<Type>& field
) const ) const

View File

@ -713,7 +713,7 @@ bool Foam::functionObjects::regionSizeDistribution::write()
writeGraph(coords, "count", binCount); writeGraph(coords, "count", binCount);
} }
// Write to screen // Write to log
{ {
Info<< " Bins:" << endl; Info<< " Bins:" << endl;
Info<< " " << token::TAB << "Bin" Info<< " " << token::TAB << "Bin"