Skip to content
Snippets Groups Projects
Commit de673f3b authored by Mark OLESEN's avatar Mark OLESEN Committed by Andrew Heather
Browse files

STYLE: consolidate 'clear' when initialising surfaceFieldValue

parent e6937f60
Branches
Tags
No related merge requests found
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2017-2018 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2017-2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2011-2017 OpenFOAM Foundation
......@@ -434,7 +434,7 @@ combineSurfaceGeometry
Foam::scalar
Foam::functionObjects::fieldValues::surfaceFieldValue::totalArea() const
{
scalar totalArea;
scalar totalArea = 0;
if (regionType_ == stSurface)
{
......@@ -488,37 +488,34 @@ void Foam::functionObjects::fieldValues::surfaceFieldValue::initialise
{
dict.readEntry("name", regionName_);
totalArea_ = 0;
nFaces_ = 0;
faceId_.clear();
facePatchId_.clear();
faceFlip_.clear();
surfacePtr_.clear();
surfaceWriterPtr_.clear();
switch (regionType_)
{
case stFaceZone:
{
setFaceZoneFaces();
surfacePtr_.clear();
break;
}
case stPatch:
{
setPatchFaces();
surfacePtr_.clear();
break;
}
case stSurface:
{
const surfMesh& s = dynamicCast<const surfMesh>(obr());
nFaces_ = returnReduce(s.size(), sumOp<label>());
faceId_.clear();
facePatchId_.clear();
faceFlip_.clear();
surfacePtr_.clear();
break;
}
case stSampledSurface:
{
faceId_.clear();
facePatchId_.clear();
faceFlip_.clear();
surfacePtr_ = sampledSurface::New
(
name(),
......@@ -614,8 +611,6 @@ void Foam::functionObjects::fieldValues::surfaceFieldValue::initialise
fields_.append(orientedFields);
}
surfaceWriterPtr_.clear();
if (writeFields_)
{
const word surfaceFormat(dict.get<word>("surfaceFormat"));
......@@ -916,6 +911,7 @@ Foam::functionObjects::fieldValues::surfaceFieldValue::surfaceFieldValue
)
),
weightFieldName_("none"),
totalArea_(0),
writeArea_(dict.lookupOrDefault("writeArea", false)),
nFaces_(0),
faceId_(),
......@@ -948,6 +944,7 @@ Foam::functionObjects::fieldValues::surfaceFieldValue::surfaceFieldValue
)
),
weightFieldName_("none"),
totalArea_(0),
writeArea_(dict.lookupOrDefault("writeArea", false)),
nFaces_(0),
faceId_(),
......@@ -959,12 +956,6 @@ Foam::functionObjects::fieldValues::surfaceFieldValue::surfaceFieldValue
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::functionObjects::fieldValues::surfaceFieldValue::~surfaceFieldValue()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::functionObjects::fieldValues::surfaceFieldValue::read
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015-2017 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2015-2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2011-2017 OpenFOAM Foundation
......@@ -84,22 +84,22 @@ Usage
log | write data to standard output | no | no
writeFields | Write the region field values | yes |
writeArea | Write the area of the surfaceFieldValue | no |
surfaceFormat | output value format | no |
regionType | face regionType: see below | yes |
name | name of face regionType if required | no |
operation | operation to perform | yes |
postOperation | post-operation to perform | no | none
weightField | name of field to apply weighting | no |
scaleFactor | scale factor | no | 1
fields | list of fields to operate on | yes |
surfaceFormat | Output value format | no |
regionType | Face regionType: see below | yes |
name | Name of face regionType if required | no |
operation | Operation to perform | yes |
postOperation | Post-operation to perform | no | none
weightField | Name of field to apply weighting | no |
scaleFactor | Scale factor | no | 1
fields | List of fields to operate on | yes |
\endtable
Where \c regionType is defined by
\plaintable
faceZone | requires a \b name entry to specify the faceZone
patch | requires a \b name entry to specify the patch
surface | requires a \b name entry to specify the surfMesh
sampledSurface | requires a \b sampledSurfaceDict sub-dictionary
faceZone | Requires a \b name entry to specify the faceZone
patch | Requires a \b name entry to specify the patch
surface | Requires a \b name entry to specify the surfMesh
sampledSurface | Requires a \b sampledSurfaceDict sub-dictionary
\endplaintable
The \c operation is one of:
......@@ -373,7 +373,7 @@ protected:
boolList faceFlip_;
//- Underlying sampledSurface (if operating on sampledSurface)
//- The sampledSurface (if operating on sampledSurface)
autoPtr<sampledSurface> surfacePtr_;
//- Surface writer
......@@ -527,7 +527,7 @@ public:
//- Destructor
virtual ~surfaceFieldValue();
virtual ~surfaceFieldValue() = default;
// Public Member Functions
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment