STYLE: return Switch by value, not const-reference

This commit is contained in:
Mark Olesen 2020-02-21 11:44:29 +01:00
parent 86fe2b7bc9
commit 4e6caf8d61
23 changed files with 87 additions and 78 deletions

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2012-2015 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -57,7 +58,6 @@ SourceFiles
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class cellShapeControl Declaration
\*---------------------------------------------------------------------------*/
@ -121,7 +121,7 @@ public:
// Access
inline const scalar& defaultCellSize() const;
inline scalar defaultCellSize() const;
inline cellShapeControlMesh& shapeControlMesh();
@ -131,7 +131,7 @@ public:
inline const cellSizeAndAlignmentControls& sizeAndAlignment() const;
inline const scalar& minimumCellSize() const;
inline scalar minimumCellSize() const;
// Query

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2012-2015 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -41,7 +42,7 @@ Foam::cellShapeControl::shapeControlMesh() const
}
inline const Foam::scalar& Foam::cellShapeControl::defaultCellSize() const
inline Foam::scalar Foam::cellShapeControl::defaultCellSize() const
{
return defaultCellSize_;
}
@ -61,7 +62,7 @@ Foam::cellShapeControl::sizeAndAlignment() const
}
inline const Foam::scalar& Foam::cellShapeControl::minimumCellSize() const
inline Foam::scalar Foam::cellShapeControl::minimumCellSize() const
{
return minimumCellSize_;
}

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -212,7 +213,7 @@ void Foam::attachDetach::checkDefinition()
if
(
!triggersOK
|| (triggerTimes_.empty() && !manualTrigger())
|| (triggerTimes_.empty() && !manualTrigger_)
)
{
FatalErrorInFunction
@ -249,9 +250,9 @@ Foam::attachDetach::attachDetach
masterPatchID_(masterPatchName, mme.mesh().boundaryMesh()),
slavePatchID_(slavePatchName, mme.mesh().boundaryMesh()),
triggerTimes_(triggerTimes),
manualTrigger_(manualTrigger),
triggerIndex_(0),
state_(UNKNOWN),
manualTrigger_(manualTrigger),
trigger_(false),
pointMatchMapPtr_(nullptr)
{
@ -285,9 +286,9 @@ Foam::attachDetach::attachDetach
mme.mesh().boundaryMesh()
),
triggerTimes_(dict.lookup("triggerTimes")),
manualTrigger_(dict.lookup("manualTrigger")),
triggerIndex_(0),
state_(UNKNOWN),
manualTrigger_(dict.get<bool>("manualTrigger")),
trigger_(false),
pointMatchMapPtr_(nullptr)
{
@ -337,7 +338,7 @@ bool Foam::attachDetach::setDetach() const
bool Foam::attachDetach::changeTopology() const
{
if (manualTrigger())
if (manualTrigger_)
{
if (debug)
{
@ -473,7 +474,7 @@ void Foam::attachDetach::writeDict(Ostream& os) const
os.writeEntry("masterPatchName", masterPatchID_.name());
os.writeEntry("slavePatchName", slavePatchID_.name());
os.writeEntry("triggerTimes", triggerTimes_);
os.writeEntry("manualTrigger", manualTrigger());
os.writeEntry("manualTrigger", Switch::name(manualTrigger_));
os.writeEntry("active", active());
os.endBlock();

View File

@ -88,15 +88,15 @@ class attachDetach
//- List of trigger times
scalarField triggerTimes_;
//- Use manual trigger
Switch manualTrigger_;
//- Trigger time index
mutable label triggerIndex_;
//- State of the modifier
mutable modifierState state_;
//- Use manual trigger
bool manualTrigger_;
//- Attach/detach trigger
mutable bool trigger_;
@ -197,7 +197,8 @@ public:
return state_ == ATTACHED;
}
const Switch& manualTrigger() const
//- Is manually triggered?
bool manualTrigger() const
{
return manualTrigger_;
}

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2013 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -126,9 +127,7 @@ public:
inline const dictionary& meshQualityCoeffDict() const;
inline const Switch& controlMeshQuality() const;
inline Switch controlMeshQuality() const;
inline const scalar& minLen() const;

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2013 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -46,8 +47,7 @@ Foam::polyMeshFilterSettings::meshQualityCoeffDict() const
}
inline const Foam::Switch&
Foam::polyMeshFilterSettings::controlMeshQuality() const
inline Foam::Switch Foam::polyMeshFilterSettings::controlMeshQuality() const
{
return controlMeshQuality_;
}

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -180,7 +181,8 @@ public:
// Activation and deactivation
const Switch& active() const
//- If modifier activate?
Switch active() const
{
return active_;
}

View File

@ -40,7 +40,7 @@ Foam::SRFVelocityFvPatchVectorField::SRFVelocityFvPatchVectorField
)
:
fixedValueFvPatchVectorField(p, iF),
relative_(0),
relative_(false),
inletValue_(p.size(), Zero)
{}
@ -67,7 +67,7 @@ Foam::SRFVelocityFvPatchVectorField::SRFVelocityFvPatchVectorField
)
:
fixedValueFvPatchVectorField(p, iF, dict),
relative_(dict.lookup("relative")),
relative_(dict.get<Switch>("relative")),
inletValue_("inletValue", dict, p.size())
{}

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -59,7 +60,6 @@ Description
U_{p,srf} | SRF velocity
\endvartable
Usage
\table
Property | Description | Required | Default value
@ -187,8 +187,8 @@ public:
// Access
//- Return const access to the relative flag
const Switch& relative() const
//- Is supplied inlet value relative to the SRF?
bool relative() const
{
return relative_;
}

View File

@ -56,7 +56,9 @@ Foam::functionObjects::fieldValue::fieldValue
writeFile(obr_, name, valueType, dict),
scaleFactor_(1.0),
dict_(dict),
regionName_(word::null)
regionName_(word::null),
fields_(),
writeFields_(false)
{
read(dict);
}
@ -74,7 +76,9 @@ Foam::functionObjects::fieldValue::fieldValue
writeFile(obr_, name, valueType, dict),
scaleFactor_(1.0),
dict_(dict),
regionName_(word::null)
regionName_(word::null),
fields_(),
writeFields_(false)
{
read(dict);
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2016 OpenCFD Ltd.
Copyright (C) 2016-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -48,7 +48,6 @@ SourceFiles
#include "fvMeshFunctionObject.H"
#include "writeFile.H"
#include "Switch.H"
#include "Field.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -86,7 +85,7 @@ protected:
wordList fields_;
//- Output field values flag
Switch writeFields_;
bool writeFields_;
// Protected Member Functions
@ -167,7 +166,7 @@ public:
inline const wordList& fields() const;
//- Return the output field values flag
inline const Switch& writeFields() const;
inline bool writeFields() const;
//- Read from dictionary
virtual bool read(const dictionary& dict);

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -45,8 +46,7 @@ inline const Foam::wordList& Foam::functionObjects::fieldValue::fields() const
}
inline const Foam::Switch&
Foam::functionObjects::fieldValue::writeFields() const
inline bool Foam::functionObjects::fieldValue::writeFields() const
{
return writeFields_;
}

View File

@ -70,13 +70,6 @@ Foam::HeatTransferModel<CloudType>::~HeatTransferModel()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
const Foam::Switch& Foam::HeatTransferModel<CloudType>::BirdCorrection() const
{
return BirdCorrection_;
}
template<class CloudType>
Foam::scalar Foam::HeatTransferModel<CloudType>::htc
(

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -60,7 +61,7 @@ class HeatTransferModel
:
public CloudSubModelBase<CloudType>
{
// Private data
// Private Data
//- Apply Bird's correction to the htc
const Switch BirdCorrection_;
@ -119,10 +120,11 @@ public:
// Member Functions
// Access
//- Return the Bird htc correction flag
const Switch& BirdCorrection() const;
//- The Bird HTC correction flag
bool BirdCorrection() const
{
return BirdCorrection_;
}
// Evaluation

View File

@ -108,7 +108,7 @@ public:
const scalar f0,
const scalar Pr,
const scalar pMin,
const Switch& constantVolume,
const bool constantVolume,
const scalar sigma0,
const scalar mu0
);

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -77,7 +78,7 @@ inline Foam::SprayParcel<ParcelType>::constantProperties::constantProperties
const scalar f0,
const scalar Pr,
const scalar pMin,
const Switch& constantVolume,
const bool constantVolume,
const scalar sigma0,
const scalar mu0
)

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -64,7 +65,7 @@ protected:
// Protected data
Switch solveOscillationEq_;
bool solveOscillationEq_;
scalar y0_;
scalar yDot0_;
@ -128,7 +129,7 @@ public:
// Access
inline const Switch& solveOscillationEq() const
inline bool solveOscillationEq() const
{
return solveOscillationEq_;
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2015 OpenFOAM Foundation
Copyright (C) 2018 OpenCFD Ltd.
Copyright (C) 2018-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -104,9 +104,11 @@ Foam::layerParameters::layerParameters
)
:
dict_(dict),
numLayers_(boundaryMesh.size(), -1),
dryRun_(dryRun),
relativeSizes_(meshRefinement::get<bool>(dict, "relativeSizes", dryRun)),
additionalReporting_(dict.getOrDefault("additionalReporting", false)),
layerSpec_(ILLEGAL),
numLayers_(boundaryMesh.size(), -1),
firstLayerThickness_(boundaryMesh.size(), -123),
finalLayerThickness_(boundaryMesh.size(), -123),
thickness_(boundaryMesh.size(), -123),
@ -140,7 +142,6 @@ Foam::layerParameters::layerParameters
),
nLayerIter_(meshRefinement::get<label>(dict, "nLayerIter", dryRun)),
nRelaxedIter_(labelMax),
additionalReporting_(dict.lookupOrDefault("additionalReporting", false)),
meshShrinker_
(
dict.lookupOrDefault
@ -148,8 +149,7 @@ Foam::layerParameters::layerParameters
"meshShrinker",
medialAxisMeshMover::typeName
)
),
dryRun_(dryRun)
)
{
// Detect layer specification mode

View File

@ -86,22 +86,28 @@ private:
static const scalar defaultConcaveAngle;
// Private data
// Private Data
const dictionary dict_;
//- In dry-run mode?
const bool dryRun_;
//- Are sizes relative to local cell size
bool relativeSizes_;
//- Any additional reporting
bool additionalReporting_;
// Per patch (not region!) information
//- How many layers to add.
labelList numLayers_;
//- Are sizes relative to local cell size
Switch relativeSizes_;
//- How thickness is specified.
layerSpecification layerSpec_;
//- How many layers to add.
labelList numLayers_;
scalarField firstLayerThickness_;
scalarField finalLayerThickness_;
@ -130,13 +136,8 @@ private:
label nRelaxedIter_;
Switch additionalReporting_;
word meshShrinker_;
//- In dry-run mode?
const bool dryRun_;
// Private Member Functions
@ -195,6 +196,12 @@ public:
return relativeSizes_;
}
//- Any additional reporting requested?
bool additionalReporting() const
{
return additionalReporting_;
}
// Expansion factor for layer mesh
const scalarField& expansionRatio() const
{
@ -289,11 +296,6 @@ public:
return nBufferCellsNoExtrude_;
}
const Switch& additionalReporting() const
{
return additionalReporting_;
}
//- Type of mesh shrinker
const word& meshShrinker() const
{

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -198,10 +199,10 @@ public:
inline const Time& time() const;
//- Return the active flag
inline const Switch& active() const;
inline Switch active() const;
//- Return the information flag
inline const Switch& infoOutput() const;
inline Switch infoOutput() const;
//- Return the model name
inline const word& modelName() const;

View File

@ -42,13 +42,13 @@ inline const Foam::Time& Foam::regionModels::regionModel::time() const
}
inline const Foam::Switch& Foam::regionModels::regionModel::active() const
inline Foam::Switch Foam::regionModels::regionModel::active() const
{
return active_;
}
inline const Foam::Switch& Foam::regionModels::regionModel::infoOutput() const
inline Foam::Switch Foam::regionModels::regionModel::infoOutput() const
{
return infoOutput_;
}

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -57,7 +58,7 @@ namespace regionModels
namespace surfaceFilmModels
{
// Forward class declarations
// Forward Declarations
class filmThermoModel;
/*---------------------------------------------------------------------------*\
@ -326,7 +327,7 @@ public:
virtual scalar CourantNumber() const;
//- Return the momentum predictor
inline const Switch& momentumPredictor() const;
inline Switch momentumPredictor() const;
//- Return the number of outer correctors
inline label nOuterCorr() const;

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -40,7 +41,7 @@ namespace surfaceFilmModels
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
inline const Switch& kinematicSingleLayer::momentumPredictor() const
inline Switch kinematicSingleLayer::momentumPredictor() const
{
return momentumPredictor_;
}