mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
STYLE: consolidate 'clear' when initialising surfaceFieldValue
This commit is contained in:
committed by
Andrew Heather
parent
e6937f60de
commit
de673f3bcf
@ -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) 2017-2018 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2017-2019 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
| Copyright (C) 2011-2017 OpenFOAM Foundation
|
| Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
@ -434,7 +434,7 @@ combineSurfaceGeometry
|
|||||||
Foam::scalar
|
Foam::scalar
|
||||||
Foam::functionObjects::fieldValues::surfaceFieldValue::totalArea() const
|
Foam::functionObjects::fieldValues::surfaceFieldValue::totalArea() const
|
||||||
{
|
{
|
||||||
scalar totalArea;
|
scalar totalArea = 0;
|
||||||
|
|
||||||
if (regionType_ == stSurface)
|
if (regionType_ == stSurface)
|
||||||
{
|
{
|
||||||
@ -488,37 +488,34 @@ void Foam::functionObjects::fieldValues::surfaceFieldValue::initialise
|
|||||||
{
|
{
|
||||||
dict.readEntry("name", regionName_);
|
dict.readEntry("name", regionName_);
|
||||||
|
|
||||||
|
totalArea_ = 0;
|
||||||
|
nFaces_ = 0;
|
||||||
|
faceId_.clear();
|
||||||
|
facePatchId_.clear();
|
||||||
|
faceFlip_.clear();
|
||||||
|
surfacePtr_.clear();
|
||||||
|
surfaceWriterPtr_.clear();
|
||||||
|
|
||||||
switch (regionType_)
|
switch (regionType_)
|
||||||
{
|
{
|
||||||
case stFaceZone:
|
case stFaceZone:
|
||||||
{
|
{
|
||||||
setFaceZoneFaces();
|
setFaceZoneFaces();
|
||||||
surfacePtr_.clear();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case stPatch:
|
case stPatch:
|
||||||
{
|
{
|
||||||
setPatchFaces();
|
setPatchFaces();
|
||||||
surfacePtr_.clear();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case stSurface:
|
case stSurface:
|
||||||
{
|
{
|
||||||
const surfMesh& s = dynamicCast<const surfMesh>(obr());
|
const surfMesh& s = dynamicCast<const surfMesh>(obr());
|
||||||
nFaces_ = returnReduce(s.size(), sumOp<label>());
|
nFaces_ = returnReduce(s.size(), sumOp<label>());
|
||||||
|
|
||||||
faceId_.clear();
|
|
||||||
facePatchId_.clear();
|
|
||||||
faceFlip_.clear();
|
|
||||||
surfacePtr_.clear();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case stSampledSurface:
|
case stSampledSurface:
|
||||||
{
|
{
|
||||||
faceId_.clear();
|
|
||||||
facePatchId_.clear();
|
|
||||||
faceFlip_.clear();
|
|
||||||
|
|
||||||
surfacePtr_ = sampledSurface::New
|
surfacePtr_ = sampledSurface::New
|
||||||
(
|
(
|
||||||
name(),
|
name(),
|
||||||
@ -614,8 +611,6 @@ void Foam::functionObjects::fieldValues::surfaceFieldValue::initialise
|
|||||||
fields_.append(orientedFields);
|
fields_.append(orientedFields);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
surfaceWriterPtr_.clear();
|
|
||||||
if (writeFields_)
|
if (writeFields_)
|
||||||
{
|
{
|
||||||
const word surfaceFormat(dict.get<word>("surfaceFormat"));
|
const word surfaceFormat(dict.get<word>("surfaceFormat"));
|
||||||
@ -916,6 +911,7 @@ Foam::functionObjects::fieldValues::surfaceFieldValue::surfaceFieldValue
|
|||||||
)
|
)
|
||||||
),
|
),
|
||||||
weightFieldName_("none"),
|
weightFieldName_("none"),
|
||||||
|
totalArea_(0),
|
||||||
writeArea_(dict.lookupOrDefault("writeArea", false)),
|
writeArea_(dict.lookupOrDefault("writeArea", false)),
|
||||||
nFaces_(0),
|
nFaces_(0),
|
||||||
faceId_(),
|
faceId_(),
|
||||||
@ -948,6 +944,7 @@ Foam::functionObjects::fieldValues::surfaceFieldValue::surfaceFieldValue
|
|||||||
)
|
)
|
||||||
),
|
),
|
||||||
weightFieldName_("none"),
|
weightFieldName_("none"),
|
||||||
|
totalArea_(0),
|
||||||
writeArea_(dict.lookupOrDefault("writeArea", false)),
|
writeArea_(dict.lookupOrDefault("writeArea", false)),
|
||||||
nFaces_(0),
|
nFaces_(0),
|
||||||
faceId_(),
|
faceId_(),
|
||||||
@ -959,12 +956,6 @@ Foam::functionObjects::fieldValues::surfaceFieldValue::surfaceFieldValue
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
Foam::functionObjects::fieldValues::surfaceFieldValue::~surfaceFieldValue()
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
bool Foam::functionObjects::fieldValues::surfaceFieldValue::read
|
bool Foam::functionObjects::fieldValues::surfaceFieldValue::read
|
||||||
|
|||||||
@ -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) 2015-2017 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2015-2019 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
| Copyright (C) 2011-2017 OpenFOAM Foundation
|
| Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
@ -84,22 +84,22 @@ Usage
|
|||||||
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 surfaceFieldValue | 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 |
|
||||||
operation | operation to perform | yes |
|
operation | Operation to perform | yes |
|
||||||
postOperation | post-operation to perform | no | none
|
postOperation | Post-operation to perform | no | none
|
||||||
weightField | name of field to apply weighting | no |
|
weightField | Name of field to apply weighting | no |
|
||||||
scaleFactor | scale factor | no | 1
|
scaleFactor | Scale factor | no | 1
|
||||||
fields | list of fields to operate on | yes |
|
fields | List of fields to operate on | yes |
|
||||||
\endtable
|
\endtable
|
||||||
|
|
||||||
Where \c regionType is defined by
|
Where \c regionType is defined by
|
||||||
\plaintable
|
\plaintable
|
||||||
faceZone | requires a \b name entry to specify the faceZone
|
faceZone | Requires a \b name entry to specify the faceZone
|
||||||
patch | requires a \b name entry to specify the patch
|
patch | Requires a \b name entry to specify the patch
|
||||||
surface | requires a \b name entry to specify the surfMesh
|
surface | Requires a \b name entry to specify the surfMesh
|
||||||
sampledSurface | requires a \b sampledSurfaceDict sub-dictionary
|
sampledSurface | Requires a \b sampledSurfaceDict sub-dictionary
|
||||||
\endplaintable
|
\endplaintable
|
||||||
|
|
||||||
The \c operation is one of:
|
The \c operation is one of:
|
||||||
@ -373,7 +373,7 @@ protected:
|
|||||||
boolList faceFlip_;
|
boolList faceFlip_;
|
||||||
|
|
||||||
|
|
||||||
//- Underlying sampledSurface (if operating on sampledSurface)
|
//- The sampledSurface (if operating on sampledSurface)
|
||||||
autoPtr<sampledSurface> surfacePtr_;
|
autoPtr<sampledSurface> surfacePtr_;
|
||||||
|
|
||||||
//- Surface writer
|
//- Surface writer
|
||||||
@ -527,7 +527,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
virtual ~surfaceFieldValue();
|
virtual ~surfaceFieldValue() = default;
|
||||||
|
|
||||||
|
|
||||||
// Public Member Functions
|
// Public Member Functions
|
||||||
|
|||||||
Reference in New Issue
Block a user