Commit 4bc3b2b9 authored by Mark Olesen's avatar Mark Olesen Committed by Andrew Heather
Browse files

STYLE: minor adjustments for code formatting and comments

parent d1bc0d6e
......@@ -269,12 +269,12 @@ Foam::functionObjects::fieldAverage::fieldAverage
:
fvMeshFunctionObject(name, runTime, dict),
prevTimeIndex_(-1),
initialised_(false),
restartOnRestart_(false),
restartOnOutput_(false),
periodicRestart_(false),
restartPeriod_(GREAT),
restartTime_(GREAT),
initialised_(false),
faItems_(),
periodIndex_(1)
{
......@@ -282,12 +282,6 @@ Foam::functionObjects::fieldAverage::fieldAverage
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::functionObjects::fieldAverage::~fieldAverage()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::functionObjects::fieldAverage::read(const dictionary& dict)
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015-2016 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2015-2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2011-2017 OpenFOAM Foundation
......@@ -161,6 +161,9 @@ protected:
//- Time at last call, prevents repeated averaging
label prevTimeIndex_;
//- Initialised flag
bool initialised_;
//- Restart the averaging process on restart
Switch restartOnRestart_;
......@@ -176,9 +179,6 @@ protected:
//- Specific restart time
scalar restartTime_;
//- Initialised flag
bool initialised_;
//- List of field average items, describing what averages to be
// calculated and output
List<fieldAverageItem> faItems_;
......@@ -301,7 +301,7 @@ public:
//- Destructor
virtual ~fieldAverage();
virtual ~fieldAverage() = default;
// Member Functions
......
......@@ -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
......@@ -77,9 +77,11 @@ void Foam::functionObjects::fieldAverage::addMeanFieldType
meanFieldName,
obr().time().timeName(obr().time().startTime().value()),
obr(),
restartOnOutput_ ?
IOobject::NO_READ
: IOobject::READ_IF_PRESENT,
(
restartOnOutput_
? IOobject::NO_READ
: IOobject::READ_IF_PRESENT
),
IOobject::NO_WRITE
),
1*baseField
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd |
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2016 OpenFOAM Foundation
......@@ -85,12 +85,6 @@ Foam::functionObjects::fieldExpression::fieldExpression
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::functionObjects::fieldExpression::~fieldExpression()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::functionObjects::fieldExpression::read(const dictionary& dict)
......@@ -102,10 +96,7 @@ bool Foam::functionObjects::fieldExpression::read(const dictionary& dict)
dict.readEntry("field", fieldName_);
}
if (dict.found("result"))
{
dict.readEntry("result", resultName_);
}
dict.readIfPresent("result", resultName_);
return true;
}
......@@ -124,10 +115,8 @@ bool Foam::functionObjects::fieldExpression::execute()
return false;
}
else
{
return true;
}
return true;
}
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd |
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2012-2016 OpenFOAM Foundation
......@@ -63,7 +63,7 @@ class fieldExpression
{
protected:
// Protected member data
// Protected Member Data
//- Name of field to process
word fieldName_;
......@@ -72,7 +72,7 @@ protected:
word resultName_;
// Protected member functions
// Protected Member Functions
virtual bool calc() = 0;
......@@ -81,11 +81,6 @@ protected:
template<class Type>
bool foundObject(const word& name, const bool verbose = true) const;
private:
// Private Member Functions
//- No copy construct
fieldExpression(const fieldExpression&) = delete;
......@@ -113,13 +108,13 @@ public:
//- Destructor
virtual ~fieldExpression();
virtual ~fieldExpression() = default;
// Member Functions
//- Read the fieldExpression data
virtual bool read(const dictionary&);
virtual bool read(const dictionary& dict);
//- Calculate the result field
virtual bool execute();
......
......@@ -40,18 +40,16 @@ bool Foam::functionObjects::fieldExpression::foundObject
{
return true;
}
else
if (debug || verbose)
{
if (debug || verbose)
{
Warning
<< " functionObjects::" << type() << " " << this->name()
<< " cannot find required object " << name << " of type "
<< Type::typeName << endl;
}
return false;
Warning
<< " functionObjects::" << type() << " " << this->name()
<< " cannot find required object " << name << " of type "
<< Type::typeName << endl;
}
return false;
}
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd |
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2016 OpenFOAM Foundation
......@@ -57,7 +57,7 @@ void Foam::functionObjects::fieldsExpression::setResultName
if (!fieldNames_.empty())
{
resultName_ = typeName + '(' + fieldNames_[0];
for (label i=1; i<fieldNames_.size(); i++)
for (label i=1; i<fieldNames_.size(); ++i)
{
resultName_ += ',' + fieldNames_[i];
}
......@@ -99,12 +99,6 @@ Foam::functionObjects::fieldsExpression::fieldsExpression
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::functionObjects::fieldsExpression::~fieldsExpression()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::functionObjects::fieldsExpression::read(const dictionary& dict)
......@@ -116,10 +110,7 @@ bool Foam::functionObjects::fieldsExpression::read(const dictionary& dict)
dict.readEntry("fields", fieldNames_);
}
if (dict.found("result"))
{
dict.readEntry("result", resultName_);
}
dict.readIfPresent("result", resultName_);
return true;
}
......@@ -138,10 +129,8 @@ bool Foam::functionObjects::fieldsExpression::execute()
return false;
}
else
{
return true;
}
return true;
}
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd |
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2012-2016 OpenFOAM Foundation
......@@ -71,7 +71,7 @@ protected:
word resultName_;
// Protected member functions
// Protected Member Functions
void setResultName
(
......@@ -93,13 +93,9 @@ protected:
template<class FOType>
bool calcAllTypes(FOType& fo);
//- Calculate expression
virtual bool calc() = 0;
private:
// Private Member Functions
//- No copy construct
fieldsExpression(const fieldsExpression&) = delete;
......@@ -127,13 +123,13 @@ public:
//- Destructor
virtual ~fieldsExpression();
virtual ~fieldsExpression() = default;
// Member Functions
//- Read the fieldsExpression data
virtual bool read(const dictionary&);
virtual bool read(const dictionary& dict);
//- Calculate the result fields
virtual bool execute();
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2016-2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2016 OpenFOAM Foundation
......@@ -62,10 +62,8 @@ bool Foam::functionObjects::fieldsExpression::calcFieldTypes(FOType& fo)
fo.template calcFieldType<SurfFieldType>()
);
}
else
{
return false;
}
return false;
}
......
......@@ -74,20 +74,7 @@ Foam::functionObjects::fluxSummary::modeTypeNames_
bool Foam::functionObjects::fluxSummary::isSurfaceMode() const
{
bool isSurf = false;
switch (mode_)
{
case mdSurface:
case mdSurfaceAndDirection:
isSurf = true;
break;
default:
break;
}
return isSurf;
return (mdSurface == mode_ || mdSurfaceAndDirection == mode_);
}
......@@ -99,8 +86,8 @@ Foam::word Foam::functionObjects::fluxSummary::checkFlowType
{
// Surfaces are multipled by their area, so account for that
// in the dimension checking
dimensionSet dims =
fieldDims * (isSurfaceMode() ? dimTime*dimArea : dimTime);
const dimensionSet dims =
(fieldDims * (isSurfaceMode() ? dimTime*dimArea : dimTime));
if (dims == dimVolume)
{
......@@ -110,16 +97,14 @@ Foam::word Foam::functionObjects::fluxSummary::checkFlowType
{
return "mass";
}
else
{
FatalErrorInFunction
<< "Unsupported flux field " << fieldName << " with dimensions "
<< fieldDims
<< ". Expected either mass flow or volumetric flow rate."
<< abort(FatalError);
return Foam::word::null;
}
FatalErrorInFunction
<< "Unsupported flux field " << fieldName << " with dimensions "
<< fieldDims
<< ". Expected either mass flow or volumetric flow rate."
<< abort(FatalError);
return word::null;
}
......@@ -143,8 +128,8 @@ void Foam::functionObjects::fluxSummary::initialiseSurface
}
names.append(surfName);
directions.append(Zero); // dummy value
faceFlip.append(boolList()); // no flip-map
directions.append(Zero); // Dummy value
faceFlip.append(boolList()); // No flip-map
}
......@@ -168,19 +153,19 @@ void Foam::functionObjects::fluxSummary::initialiseSurfaceAndDirection
<< exit(FatalError);
}
const surfMesh& s = *surfptr;
const auto& s = *surfptr;
const vector refDir = dir/(mag(dir) + ROOTVSMALL);
names.append(surfName);
directions.append(refDir);
faceFlip.append(boolList(0));
faceFlip.append(boolList()); // No flip-map
boolList& flips = faceFlip[faceFlip.size()-1];
flips.setSize(s.size(), false);
forAll(s, i)
{
// orientation set by comparison with reference direction
// Orientation set by comparison with reference direction
const vector& n = s.faceNormals()[i];
if ((n & refDir) > tolerance_)
......
......@@ -58,12 +58,12 @@ Usage
Where the entries comprise:
\table
Property | Description | Required | Default value
type | type name: fluxSummary | yes |
write | write flux data to file | no | yes
log | write flux data to standard output | no | yes
mode | mode to generate faces to test | yes |
scaleFactor | optional factor to scale result | no | 1
Property | Description | Required | Default
type | Type name: fluxSummary | yes |
write | Write flux data to file | no | yes
log | Write flux data to standard output | no | yes
mode | Mode to generate faces to test | yes |
scaleFactor | Optional factor to scale result | no | 1
\endtable
The mode is one of:
......@@ -97,6 +97,8 @@ SourceFiles
namespace Foam
{
// Forward Declarations
class dimensionSet;
namespace functionObjects
......@@ -288,7 +290,7 @@ public:
// Member Functions
//- Read the field fluxSummary data
virtual bool read(const dictionary&);
virtual bool read(const dictionary& dict);
//- Execute, currently does nothing
virtual bool execute();
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd |
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2013-2016 OpenFOAM Foundation
......@@ -66,10 +66,4 @@ Foam::functionObjects::grad::grad
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::functionObjects::grad::~grad()
{}
// ************************************************************************* //
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd |
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2012-2016 OpenFOAM Foundation
......@@ -91,7 +91,7 @@ public:
//- Destructor
virtual ~grad();
virtual ~grad() = default;
};
......
......@@ -53,10 +53,8 @@ bool Foam::functionObjects::grad::calcGrad()
mesh_.changing() && mesh_.cache(resultName_)
);
}
else
{
return false;
}
return false;
}
......
......@@ -69,10 +69,4 @@ Foam::functionObjects::mag::mag
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::functionObjects::mag::~mag()
{}
// ************************************************************************* //
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd |
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2012-2016 OpenFOAM Foundation
......@@ -92,7 +92,7 @@ public:
//- Destructor
virtual ~mag();
virtual ~mag() = default;
};
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2016-2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2012-2016 OpenFOAM Foundation
......@@ -62,10 +62,8 @@ bool Foam::functionObjects::mag::calcMag()
Foam::mag(lookupObject<SurfFieldType>(fieldName_))
);
}
else
{
return false;
}
return false;
}
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd |
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2016 OpenFOAM Foundation
......@@ -69,10 +69,4 @@ Foam::functionObjects::magSqr::magSqr
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::functionObjects::magSqr::~magSqr()
{}
// ************************************************************************* //
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2016-2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2016 OpenFOAM Foundation
......@@ -94,7 +94,7 @@ public:
//- Destructor
virtual ~magSqr();
virtual ~magSqr() = default;
};
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2016-2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2016 OpenFOAM Foundation
......@@ -62,10 +62,8 @@ bool Foam::functionObjects::magSqr::calcMagSqr()
Foam::magSqr(lookupObject<SurfFieldType>(fieldName_))
);