STYLE: minor adjustments for code formatting and comments

This commit is contained in:
Mark Olesen
2019-02-12 20:18:06 +01:00
committed by Andrew Heather
parent d1bc0d6e56
commit 4bc3b2b9cb
20 changed files with 82 additions and 158 deletions

View File

@ -269,12 +269,12 @@ Foam::functionObjects::fieldAverage::fieldAverage
: :
fvMeshFunctionObject(name, runTime, dict), fvMeshFunctionObject(name, runTime, dict),
prevTimeIndex_(-1), prevTimeIndex_(-1),
initialised_(false),
restartOnRestart_(false), restartOnRestart_(false),
restartOnOutput_(false), restartOnOutput_(false),
periodicRestart_(false), periodicRestart_(false),
restartPeriod_(GREAT), restartPeriod_(GREAT),
restartTime_(GREAT), restartTime_(GREAT),
initialised_(false),
faItems_(), faItems_(),
periodIndex_(1) periodIndex_(1)
{ {
@ -282,12 +282,6 @@ Foam::functionObjects::fieldAverage::fieldAverage
} }
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::functionObjects::fieldAverage::~fieldAverage()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::functionObjects::fieldAverage::read(const dictionary& dict) bool Foam::functionObjects::fieldAverage::read(const dictionary& dict)

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) 2015-2016 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
@ -161,6 +161,9 @@ protected:
//- Time at last call, prevents repeated averaging //- Time at last call, prevents repeated averaging
label prevTimeIndex_; label prevTimeIndex_;
//- Initialised flag
bool initialised_;
//- Restart the averaging process on restart //- Restart the averaging process on restart
Switch restartOnRestart_; Switch restartOnRestart_;
@ -176,9 +179,6 @@ protected:
//- Specific restart time //- Specific restart time
scalar restartTime_; scalar restartTime_;
//- Initialised flag
bool initialised_;
//- List of field average items, describing what averages to be //- List of field average items, describing what averages to be
// calculated and output // calculated and output
List<fieldAverageItem> faItems_; List<fieldAverageItem> faItems_;
@ -301,7 +301,7 @@ public:
//- Destructor //- Destructor
virtual ~fieldAverage(); virtual ~fieldAverage() = default;
// Member Functions // Member Functions

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) 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
@ -77,9 +77,11 @@ void Foam::functionObjects::fieldAverage::addMeanFieldType
meanFieldName, meanFieldName,
obr().time().timeName(obr().time().startTime().value()), obr().time().timeName(obr().time().startTime().value()),
obr(), obr(),
restartOnOutput_ ? (
IOobject::NO_READ restartOnOutput_
: IOobject::READ_IF_PRESENT, ? IOobject::NO_READ
: IOobject::READ_IF_PRESENT
),
IOobject::NO_WRITE IOobject::NO_WRITE
), ),
1*baseField 1*baseField

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 | \\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
| Copyright (C) 2016 OpenFOAM Foundation | Copyright (C) 2016 OpenFOAM Foundation
@ -85,12 +85,6 @@ Foam::functionObjects::fieldExpression::fieldExpression
} }
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::functionObjects::fieldExpression::~fieldExpression()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::functionObjects::fieldExpression::read(const dictionary& dict) bool Foam::functionObjects::fieldExpression::read(const dictionary& dict)
@ -102,10 +96,7 @@ bool Foam::functionObjects::fieldExpression::read(const dictionary& dict)
dict.readEntry("field", fieldName_); dict.readEntry("field", fieldName_);
} }
if (dict.found("result")) dict.readIfPresent("result", resultName_);
{
dict.readEntry("result", resultName_);
}
return true; return true;
} }
@ -124,10 +115,8 @@ bool Foam::functionObjects::fieldExpression::execute()
return false; return false;
} }
else
{ return true;
return true;
}
} }

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 | \\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
| Copyright (C) 2012-2016 OpenFOAM Foundation | Copyright (C) 2012-2016 OpenFOAM Foundation
@ -63,7 +63,7 @@ class fieldExpression
{ {
protected: protected:
// Protected member data // Protected Member Data
//- Name of field to process //- Name of field to process
word fieldName_; word fieldName_;
@ -72,7 +72,7 @@ protected:
word resultName_; word resultName_;
// Protected member functions // Protected Member Functions
virtual bool calc() = 0; virtual bool calc() = 0;
@ -81,11 +81,6 @@ protected:
template<class Type> template<class Type>
bool foundObject(const word& name, const bool verbose = true) const; bool foundObject(const word& name, const bool verbose = true) const;
private:
// Private Member Functions
//- No copy construct //- No copy construct
fieldExpression(const fieldExpression&) = delete; fieldExpression(const fieldExpression&) = delete;
@ -113,13 +108,13 @@ public:
//- Destructor //- Destructor
virtual ~fieldExpression(); virtual ~fieldExpression() = default;
// Member Functions // Member Functions
//- Read the fieldExpression data //- Read the fieldExpression data
virtual bool read(const dictionary&); virtual bool read(const dictionary& dict);
//- Calculate the result field //- Calculate the result field
virtual bool execute(); virtual bool execute();

View File

@ -40,18 +40,16 @@ bool Foam::functionObjects::fieldExpression::foundObject
{ {
return true; return true;
} }
else
{
if (debug || verbose)
{
Warning
<< " functionObjects::" << type() << " " << this->name()
<< " cannot find required object " << name << " of type "
<< Type::typeName << endl;
}
return false; if (debug || verbose)
{
Warning
<< " functionObjects::" << type() << " " << this->name()
<< " cannot find required object " << name << " of type "
<< Type::typeName << endl;
} }
return false;
} }

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 | \\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
| Copyright (C) 2016 OpenFOAM Foundation | Copyright (C) 2016 OpenFOAM Foundation
@ -57,7 +57,7 @@ void Foam::functionObjects::fieldsExpression::setResultName
if (!fieldNames_.empty()) if (!fieldNames_.empty())
{ {
resultName_ = typeName + '(' + fieldNames_[0]; resultName_ = typeName + '(' + fieldNames_[0];
for (label i=1; i<fieldNames_.size(); i++) for (label i=1; i<fieldNames_.size(); ++i)
{ {
resultName_ += ',' + fieldNames_[i]; resultName_ += ',' + fieldNames_[i];
} }
@ -99,12 +99,6 @@ Foam::functionObjects::fieldsExpression::fieldsExpression
} }
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::functionObjects::fieldsExpression::~fieldsExpression()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::functionObjects::fieldsExpression::read(const dictionary& dict) bool Foam::functionObjects::fieldsExpression::read(const dictionary& dict)
@ -116,10 +110,7 @@ bool Foam::functionObjects::fieldsExpression::read(const dictionary& dict)
dict.readEntry("fields", fieldNames_); dict.readEntry("fields", fieldNames_);
} }
if (dict.found("result")) dict.readIfPresent("result", resultName_);
{
dict.readEntry("result", resultName_);
}
return true; return true;
} }
@ -138,10 +129,8 @@ bool Foam::functionObjects::fieldsExpression::execute()
return false; return false;
} }
else
{ return true;
return true;
}
} }

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 | \\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
| Copyright (C) 2012-2016 OpenFOAM Foundation | Copyright (C) 2012-2016 OpenFOAM Foundation
@ -71,7 +71,7 @@ protected:
word resultName_; word resultName_;
// Protected member functions // Protected Member Functions
void setResultName void setResultName
( (
@ -93,13 +93,9 @@ protected:
template<class FOType> template<class FOType>
bool calcAllTypes(FOType& fo); bool calcAllTypes(FOType& fo);
//- Calculate expression
virtual bool calc() = 0; virtual bool calc() = 0;
private:
// Private Member Functions
//- No copy construct //- No copy construct
fieldsExpression(const fieldsExpression&) = delete; fieldsExpression(const fieldsExpression&) = delete;
@ -127,13 +123,13 @@ public:
//- Destructor //- Destructor
virtual ~fieldsExpression(); virtual ~fieldsExpression() = default;
// Member Functions // Member Functions
//- Read the fieldsExpression data //- Read the fieldsExpression data
virtual bool read(const dictionary&); virtual bool read(const dictionary& dict);
//- Calculate the result fields //- Calculate the result fields
virtual bool execute(); virtual bool execute();

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) 2016 OpenCFD Ltd. \\ / A nd | Copyright (C) 2016-2019 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
| Copyright (C) 2016 OpenFOAM Foundation | Copyright (C) 2016 OpenFOAM Foundation
@ -62,10 +62,8 @@ bool Foam::functionObjects::fieldsExpression::calcFieldTypes(FOType& fo)
fo.template calcFieldType<SurfFieldType>() fo.template calcFieldType<SurfFieldType>()
); );
} }
else
{ return false;
return false;
}
} }

View File

@ -74,20 +74,7 @@ Foam::functionObjects::fluxSummary::modeTypeNames_
bool Foam::functionObjects::fluxSummary::isSurfaceMode() const bool Foam::functionObjects::fluxSummary::isSurfaceMode() const
{ {
bool isSurf = false; return (mdSurface == mode_ || mdSurfaceAndDirection == mode_);
switch (mode_)
{
case mdSurface:
case mdSurfaceAndDirection:
isSurf = true;
break;
default:
break;
}
return isSurf;
} }
@ -99,8 +86,8 @@ Foam::word Foam::functionObjects::fluxSummary::checkFlowType
{ {
// Surfaces are multipled by their area, so account for that // Surfaces are multipled by their area, so account for that
// in the dimension checking // in the dimension checking
dimensionSet dims = const dimensionSet dims =
fieldDims * (isSurfaceMode() ? dimTime*dimArea : dimTime); (fieldDims * (isSurfaceMode() ? dimTime*dimArea : dimTime));
if (dims == dimVolume) if (dims == dimVolume)
{ {
@ -110,16 +97,14 @@ Foam::word Foam::functionObjects::fluxSummary::checkFlowType
{ {
return "mass"; 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); names.append(surfName);
directions.append(Zero); // dummy value directions.append(Zero); // Dummy value
faceFlip.append(boolList()); // no flip-map faceFlip.append(boolList()); // No flip-map
} }
@ -168,19 +153,19 @@ void Foam::functionObjects::fluxSummary::initialiseSurfaceAndDirection
<< exit(FatalError); << exit(FatalError);
} }
const surfMesh& s = *surfptr; const auto& s = *surfptr;
const vector refDir = dir/(mag(dir) + ROOTVSMALL); const vector refDir = dir/(mag(dir) + ROOTVSMALL);
names.append(surfName); names.append(surfName);
directions.append(refDir); directions.append(refDir);
faceFlip.append(boolList(0)); faceFlip.append(boolList()); // No flip-map
boolList& flips = faceFlip[faceFlip.size()-1]; boolList& flips = faceFlip[faceFlip.size()-1];
flips.setSize(s.size(), false); flips.setSize(s.size(), false);
forAll(s, i) forAll(s, i)
{ {
// orientation set by comparison with reference direction // Orientation set by comparison with reference direction
const vector& n = s.faceNormals()[i]; const vector& n = s.faceNormals()[i];
if ((n & refDir) > tolerance_) if ((n & refDir) > tolerance_)

View File

@ -58,12 +58,12 @@ Usage
Where the entries comprise: Where the entries comprise:
\table \table
Property | Description | Required | Default value Property | Description | Required | Default
type | type name: fluxSummary | yes | type | Type name: fluxSummary | yes |
write | write flux data to file | no | yes write | Write flux data to file | no | yes
log | write flux data to standard output | no | yes log | Write flux data to standard output | no | yes
mode | mode to generate faces to test | yes | mode | Mode to generate faces to test | yes |
scaleFactor | optional factor to scale result | no | 1 scaleFactor | Optional factor to scale result | no | 1
\endtable \endtable
The mode is one of: The mode is one of:
@ -97,6 +97,8 @@ SourceFiles
namespace Foam namespace Foam
{ {
// Forward Declarations
class dimensionSet; class dimensionSet;
namespace functionObjects namespace functionObjects
@ -288,7 +290,7 @@ public:
// Member Functions // Member Functions
//- Read the field fluxSummary data //- Read the field fluxSummary data
virtual bool read(const dictionary&); virtual bool read(const dictionary& dict);
//- Execute, currently does nothing //- Execute, currently does nothing
virtual bool execute(); virtual bool execute();

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 | \\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
| Copyright (C) 2013-2016 OpenFOAM Foundation | Copyright (C) 2013-2016 OpenFOAM Foundation
@ -66,10 +66,4 @@ Foam::functionObjects::grad::grad
{} {}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::functionObjects::grad::~grad()
{}
// ************************************************************************* // // ************************************************************************* //

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 | \\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
| Copyright (C) 2012-2016 OpenFOAM Foundation | Copyright (C) 2012-2016 OpenFOAM Foundation
@ -91,7 +91,7 @@ public:
//- Destructor //- Destructor
virtual ~grad(); virtual ~grad() = default;
}; };

View File

@ -53,10 +53,8 @@ bool Foam::functionObjects::grad::calcGrad()
mesh_.changing() && mesh_.cache(resultName_) mesh_.changing() && mesh_.cache(resultName_)
); );
} }
else
{ return false;
return false;
}
} }

View File

@ -69,10 +69,4 @@ Foam::functionObjects::mag::mag
{} {}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::functionObjects::mag::~mag()
{}
// ************************************************************************* // // ************************************************************************* //

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 | \\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
| Copyright (C) 2012-2016 OpenFOAM Foundation | Copyright (C) 2012-2016 OpenFOAM Foundation
@ -92,7 +92,7 @@ public:
//- Destructor //- Destructor
virtual ~mag(); virtual ~mag() = default;
}; };

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) 2016 OpenCFD Ltd. \\ / A nd | Copyright (C) 2016-2019 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
| Copyright (C) 2012-2016 OpenFOAM Foundation | Copyright (C) 2012-2016 OpenFOAM Foundation
@ -62,10 +62,8 @@ bool Foam::functionObjects::mag::calcMag()
Foam::mag(lookupObject<SurfFieldType>(fieldName_)) Foam::mag(lookupObject<SurfFieldType>(fieldName_))
); );
} }
else
{ return false;
return false;
}
} }

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 | \\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
| Copyright (C) 2016 OpenFOAM Foundation | Copyright (C) 2016 OpenFOAM Foundation
@ -69,10 +69,4 @@ Foam::functionObjects::magSqr::magSqr
{} {}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::functionObjects::magSqr::~magSqr()
{}
// ************************************************************************* // // ************************************************************************* //

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) 2016 OpenCFD Ltd. \\ / A nd | Copyright (C) 2016-2019 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
| Copyright (C) 2016 OpenFOAM Foundation | Copyright (C) 2016 OpenFOAM Foundation
@ -94,7 +94,7 @@ public:
//- Destructor //- Destructor
virtual ~magSqr(); virtual ~magSqr() = default;
}; };

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) 2016 OpenCFD Ltd. \\ / A nd | Copyright (C) 2016-2019 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
| Copyright (C) 2016 OpenFOAM Foundation | Copyright (C) 2016 OpenFOAM Foundation
@ -62,10 +62,8 @@ bool Foam::functionObjects::magSqr::calcMagSqr()
Foam::magSqr(lookupObject<SurfFieldType>(fieldName_)) Foam::magSqr(lookupObject<SurfFieldType>(fieldName_))
); );
} }
else
{ return false;
return false;
}
} }