From 4e6caf8d61511da230aaa2640a89f74aa39d9e7e Mon Sep 17 00:00:00 2001
From: Mark Olesen <Mark.Olesen@esi-group.com>
Date: Fri, 21 Feb 2020 11:44:29 +0100
Subject: [PATCH] STYLE: return Switch by value, not const-reference

---
 .../cellShapeControl/cellShapeControl.H       |  6 ++--
 .../cellShapeControl/cellShapeControlI.H      |  5 +--
 src/dynamicMesh/attachDetach/attachDetach.C   | 11 +++---
 src/dynamicMesh/attachDetach/attachDetach.H   |  9 ++---
 .../polyMeshFilter/polyMeshFilterSettings.H   |  5 ++-
 .../polyMeshFilter/polyMeshFilterSettingsI.H  |  4 +--
 .../polyMeshModifier/polyMeshModifier.H       |  4 ++-
 .../SRFVelocityFvPatchVectorField.C           |  4 +--
 .../SRFVelocityFvPatchVectorField.H           |  6 ++--
 .../field/fieldValues/fieldValue/fieldValue.C |  8 +++--
 .../field/fieldValues/fieldValue/fieldValue.H |  7 ++--
 .../fieldValues/fieldValue/fieldValueI.H      |  4 +--
 .../HeatTransferModel/HeatTransferModel.C     |  7 ----
 .../HeatTransferModel/HeatTransferModel.H     | 12 ++++---
 .../Templates/SprayParcel/SprayParcel.H       |  2 +-
 .../Templates/SprayParcel/SprayParcelI.H      |  3 +-
 .../BreakupModel/BreakupModel/BreakupModel.H  |  5 +--
 .../layerParameters/layerParameters.C         | 10 +++---
 .../layerParameters/layerParameters.H         | 34 ++++++++++---------
 .../regionModel/regionModel/regionModel.H     |  5 +--
 .../regionModel/regionModel/regionModelI.H    |  4 +--
 .../kinematicSingleLayer.H                    |  5 +--
 .../kinematicSingleLayerI.H                   |  3 +-
 23 files changed, 86 insertions(+), 77 deletions(-)

diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellShapeControl/cellShapeControl/cellShapeControl.H b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellShapeControl/cellShapeControl/cellShapeControl.H
index 27bf7365d64..3846f4036ea 100644
--- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellShapeControl/cellShapeControl/cellShapeControl.H
+++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellShapeControl/cellShapeControl/cellShapeControl.H
@@ -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
diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellShapeControl/cellShapeControl/cellShapeControlI.H b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellShapeControl/cellShapeControl/cellShapeControlI.H
index 2d458abda13..b333052f9a7 100644
--- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellShapeControl/cellShapeControl/cellShapeControlI.H
+++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellShapeControl/cellShapeControl/cellShapeControlI.H
@@ -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_;
 }
diff --git a/src/dynamicMesh/attachDetach/attachDetach.C b/src/dynamicMesh/attachDetach/attachDetach.C
index 66cfb0a676f..eb05ece4de0 100644
--- a/src/dynamicMesh/attachDetach/attachDetach.C
+++ b/src/dynamicMesh/attachDetach/attachDetach.C
@@ -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();
diff --git a/src/dynamicMesh/attachDetach/attachDetach.H b/src/dynamicMesh/attachDetach/attachDetach.H
index 5249142b226..a818ddb8567 100644
--- a/src/dynamicMesh/attachDetach/attachDetach.H
+++ b/src/dynamicMesh/attachDetach/attachDetach.H
@@ -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_;
         }
diff --git a/src/dynamicMesh/polyMeshFilter/polyMeshFilterSettings.H b/src/dynamicMesh/polyMeshFilter/polyMeshFilterSettings.H
index 631bf65c480..7f5ab4212df 100644
--- a/src/dynamicMesh/polyMeshFilter/polyMeshFilterSettings.H
+++ b/src/dynamicMesh/polyMeshFilter/polyMeshFilterSettings.H
@@ -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;
 
diff --git a/src/dynamicMesh/polyMeshFilter/polyMeshFilterSettingsI.H b/src/dynamicMesh/polyMeshFilter/polyMeshFilterSettingsI.H
index d1873ab8aa4..cbf63820669 100644
--- a/src/dynamicMesh/polyMeshFilter/polyMeshFilterSettingsI.H
+++ b/src/dynamicMesh/polyMeshFilter/polyMeshFilterSettingsI.H
@@ -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_;
 }
diff --git a/src/dynamicMesh/polyTopoChange/polyMeshModifier/polyMeshModifier.H b/src/dynamicMesh/polyTopoChange/polyMeshModifier/polyMeshModifier.H
index 69aafaff6d9..3a28da946b9 100644
--- a/src/dynamicMesh/polyTopoChange/polyMeshModifier/polyMeshModifier.H
+++ b/src/dynamicMesh/polyTopoChange/polyMeshModifier/polyMeshModifier.H
@@ -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_;
             }
diff --git a/src/finiteVolume/cfdTools/general/SRF/derivedFvPatchFields/SRFVelocityFvPatchVectorField/SRFVelocityFvPatchVectorField.C b/src/finiteVolume/cfdTools/general/SRF/derivedFvPatchFields/SRFVelocityFvPatchVectorField/SRFVelocityFvPatchVectorField.C
index 3148c821782..d9fd52e7d97 100644
--- a/src/finiteVolume/cfdTools/general/SRF/derivedFvPatchFields/SRFVelocityFvPatchVectorField/SRFVelocityFvPatchVectorField.C
+++ b/src/finiteVolume/cfdTools/general/SRF/derivedFvPatchFields/SRFVelocityFvPatchVectorField/SRFVelocityFvPatchVectorField.C
@@ -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())
 {}
 
diff --git a/src/finiteVolume/cfdTools/general/SRF/derivedFvPatchFields/SRFVelocityFvPatchVectorField/SRFVelocityFvPatchVectorField.H b/src/finiteVolume/cfdTools/general/SRF/derivedFvPatchFields/SRFVelocityFvPatchVectorField/SRFVelocityFvPatchVectorField.H
index fb8c00e819a..4b998a3fcad 100644
--- a/src/finiteVolume/cfdTools/general/SRF/derivedFvPatchFields/SRFVelocityFvPatchVectorField/SRFVelocityFvPatchVectorField.H
+++ b/src/finiteVolume/cfdTools/general/SRF/derivedFvPatchFields/SRFVelocityFvPatchVectorField/SRFVelocityFvPatchVectorField.H
@@ -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_;
             }
diff --git a/src/functionObjects/field/fieldValues/fieldValue/fieldValue.C b/src/functionObjects/field/fieldValues/fieldValue/fieldValue.C
index 005fff0792d..b713b8e9dfd 100644
--- a/src/functionObjects/field/fieldValues/fieldValue/fieldValue.C
+++ b/src/functionObjects/field/fieldValues/fieldValue/fieldValue.C
@@ -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);
 }
diff --git a/src/functionObjects/field/fieldValues/fieldValue/fieldValue.H b/src/functionObjects/field/fieldValues/fieldValue/fieldValue.H
index 55f2da62ef4..db8fa31a06f 100644
--- a/src/functionObjects/field/fieldValues/fieldValue/fieldValue.H
+++ b/src/functionObjects/field/fieldValues/fieldValue/fieldValue.H
@@ -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);
diff --git a/src/functionObjects/field/fieldValues/fieldValue/fieldValueI.H b/src/functionObjects/field/fieldValues/fieldValue/fieldValueI.H
index 2835975780d..f667fe087fc 100644
--- a/src/functionObjects/field/fieldValues/fieldValue/fieldValueI.H
+++ b/src/functionObjects/field/fieldValues/fieldValue/fieldValueI.H
@@ -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_;
 }
diff --git a/src/lagrangian/intermediate/submodels/Thermodynamic/HeatTransferModel/HeatTransferModel/HeatTransferModel.C b/src/lagrangian/intermediate/submodels/Thermodynamic/HeatTransferModel/HeatTransferModel/HeatTransferModel.C
index fbed5b4f31c..4d7d74323a6 100644
--- a/src/lagrangian/intermediate/submodels/Thermodynamic/HeatTransferModel/HeatTransferModel/HeatTransferModel.C
+++ b/src/lagrangian/intermediate/submodels/Thermodynamic/HeatTransferModel/HeatTransferModel/HeatTransferModel.C
@@ -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
 (
diff --git a/src/lagrangian/intermediate/submodels/Thermodynamic/HeatTransferModel/HeatTransferModel/HeatTransferModel.H b/src/lagrangian/intermediate/submodels/Thermodynamic/HeatTransferModel/HeatTransferModel/HeatTransferModel.H
index b875ce894dc..b9eb0ee48d0 100644
--- a/src/lagrangian/intermediate/submodels/Thermodynamic/HeatTransferModel/HeatTransferModel/HeatTransferModel.H
+++ b/src/lagrangian/intermediate/submodels/Thermodynamic/HeatTransferModel/HeatTransferModel/HeatTransferModel.H
@@ -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
diff --git a/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcel.H b/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcel.H
index 530921c21e9..f77c4b2955a 100644
--- a/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcel.H
+++ b/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcel.H
@@ -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
             );
diff --git a/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcelI.H b/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcelI.H
index 7cd64d57817..696be5b3944 100644
--- a/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcelI.H
+++ b/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcelI.H
@@ -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
 )
diff --git a/src/lagrangian/spray/submodels/BreakupModel/BreakupModel/BreakupModel.H b/src/lagrangian/spray/submodels/BreakupModel/BreakupModel/BreakupModel.H
index f8186691b37..9956ca9a5e1 100644
--- a/src/lagrangian/spray/submodels/BreakupModel/BreakupModel/BreakupModel.H
+++ b/src/lagrangian/spray/submodels/BreakupModel/BreakupModel/BreakupModel.H
@@ -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_;
         }
diff --git a/src/mesh/snappyHexMesh/snappyHexMeshDriver/layerParameters/layerParameters.C b/src/mesh/snappyHexMesh/snappyHexMeshDriver/layerParameters/layerParameters.C
index 8a0544920f9..b4953b9c54a 100644
--- a/src/mesh/snappyHexMesh/snappyHexMeshDriver/layerParameters/layerParameters.C
+++ b/src/mesh/snappyHexMesh/snappyHexMeshDriver/layerParameters/layerParameters.C
@@ -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
 
diff --git a/src/mesh/snappyHexMesh/snappyHexMeshDriver/layerParameters/layerParameters.H b/src/mesh/snappyHexMesh/snappyHexMeshDriver/layerParameters/layerParameters.H
index 901810b1ca3..4bc2f1622fc 100644
--- a/src/mesh/snappyHexMesh/snappyHexMeshDriver/layerParameters/layerParameters.H
+++ b/src/mesh/snappyHexMesh/snappyHexMeshDriver/layerParameters/layerParameters.H
@@ -86,22 +86,28 @@ private:
         static const scalar defaultConcaveAngle;
 
 
-    // Private data
+    // Private Data
 
         const dictionary dict_;
 
+        //- In dry-run mode?
+        const bool dryRun_;
 
-        // Per patch (not region!) information
+        //- Are sizes relative to local cell size
+        bool relativeSizes_;
 
-            //- How many layers to add.
-            labelList numLayers_;
+        //- Any additional reporting
+        bool additionalReporting_;
 
-            //- Are sizes relative to local cell size
-            Switch relativeSizes_;
+
+        // Per patch (not region!) information
 
             //- 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
             {
diff --git a/src/regionModels/regionModel/regionModel/regionModel.H b/src/regionModels/regionModel/regionModel/regionModel.H
index 40c05ef3b98..5d846dc42ff 100644
--- a/src/regionModels/regionModel/regionModel/regionModel.H
+++ b/src/regionModels/regionModel/regionModel/regionModel.H
@@ -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;
diff --git a/src/regionModels/regionModel/regionModel/regionModelI.H b/src/regionModels/regionModel/regionModel/regionModelI.H
index e33ac78d5ae..afa1189f8dd 100644
--- a/src/regionModels/regionModel/regionModel/regionModelI.H
+++ b/src/regionModels/regionModel/regionModel/regionModelI.H
@@ -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_;
 }
diff --git a/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.H b/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.H
index a14f69aedac..f4b38253f85 100644
--- a/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.H
+++ b/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.H
@@ -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;
diff --git a/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayerI.H b/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayerI.H
index f1a8900eafe..f3cd4b31dd1 100644
--- a/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayerI.H
+++ b/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayerI.H
@@ -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_;
 }
-- 
GitLab