From 84b109219a4a6de196ff5dde54d3c054584506fe Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Fri, 1 Jun 2018 20:51:48 +0200 Subject: [PATCH] STYLE: reduced usage of Switch - Since 'bool' and 'Switch' use the _identical_ input mechanism (ie, both accept true/false, on/off, yes/no, none, 1/0), the main reason to prefer one or the other is the output. The output for Switch is as text (eg, "true"), whereas for bool it is label (0 or 1). If the output is required for a dictionary, Switch may be appropriate. If the output is not required, or is only used for Pstream exchange, bool can be more appropriate. --- .../solvers/combustion/PDRFoam/PDRFoam.C | 1 - .../combustion/PDRFoam/PDRFoamAutoRefine.C | 1 - .../dragModels/PDRDragModel/PDRDragModel.C | 6 +- .../dragModels/PDRDragModel/PDRDragModel.H | 2 +- .../dragModels/PDRDragModel/PDRDragModelNew.C | 4 +- .../PDRModels/dragModels/basic/basic.C | 4 +- .../combustion/chemFoam/createControls.H | 5 +- .../combustion/chemFoam/readControls.H | 4 +- .../rhoPorousSimpleFoam/createZones.H | 2 +- .../readGravitationalAcceleration.H | 6 +- .../porousSimpleFoam/createPorousZones.H | 2 +- .../ThermalPhaseChangePhaseSystem.C | 4 +- .../ThermalPhaseChangePhaseSystem.H | 3 +- .../solidDisplacementFoam/createControl.H | 2 +- .../solidDisplacementFoam/createControls.H | 2 +- .../readMechanicalProperties.H | 4 +- .../readSolidDisplacementFoamControls.H | 4 +- .../readThermalProperties.H | 3 +- .../solidDisplacementFoam.C | 1 - .../tractionDisplacementFvPatchVectorField.C | 8 +- .../solidEquilibriumDisplacementFoam.C | 1 - ...DisplacementCorrectionFvPatchVectorField.C | 4 +- .../mesh/advanced/selectCells/edgeStats.C | 4 +- .../snappyRefineMesh/snappyRefineMesh.C | 4 +- .../extrude/extrudeMesh/extrudeMesh.C | 6 +- .../extrudeToRegionMesh/extrudeToRegionMesh.C | 6 +- .../automatic/automatic.C | 17 +- .../automatic/automatic.H | 18 +- .../cvControls/cvControls.C | 165 +++++++----------- .../initialPointsMethod/initialPointsMethod.C | 9 +- .../initialPointsMethod/initialPointsMethod.H | 5 +- .../foamyMesh/foamyQuadMesh/foamyQuadMesh.C | 2 +- .../generation/snappyHexMesh/snappyHexMesh.C | 28 ++- .../createBaffles/createBaffles.C | 20 +-- .../faceSelection/faceSelection.H | 3 +- .../manipulation/createPatch/createPatch.C | 3 +- .../surface/surfaceSubset/surfaceSubset.C | 9 +- .../dynamicRefineFvMesh/dynamicRefineFvMesh.C | 2 +- .../dynamicRefineFvMesh/dynamicRefineFvMesh.H | 3 +- src/dynamicMesh/attachDetach/attachDetach.C | 2 +- .../layerAdditionRemoval.C | 9 +- .../layerAdditionRemoval.H | 2 +- .../meshCut/directions/directions.C | 3 +- .../multiDirRefinement/multiDirRefinement.C | 10 +- src/dynamicMesh/setUpdater/setUpdater.C | 2 +- .../slidingInterface/slidingInterface.C | 2 +- .../finiteArea/faSchemes/faSchemes.C | 4 +- .../finiteVolume/fvSchemes/fvSchemes.C | 4 +- .../basic/InteractionLists/InteractionLists.C | 2 +- .../basic/InteractionLists/InteractionLists.H | 4 +- .../PairCollision/PairCollision.C | 9 +- .../MultiInteraction/MultiInteraction.C | 2 +- .../MultiInteraction/MultiInteraction.H | 2 +- .../mdTools/createAutoCorrelationFunctions.H | 6 +- .../pairPotential/basic/pairPotential.C | 2 +- .../pairPotential/basic/pairPotentialI.H | 1 + .../ORourkeCollision/ORourkeCollision.C | 5 +- .../ORourkeCollision/ORourkeCollision.H | 4 +- .../offsetSurface/offsetSurface.H | 3 +- .../regionModel/regionModel/regionModel.C | 4 +- .../structuredRenumber/structuredRenumber.C | 4 +- .../structuredRenumber/structuredRenumber.H | 9 +- .../distanceSurface/sampledDistanceSurface.H | 2 +- .../isoSurface/sampledIsoSurface.H | 6 +- .../isoSurface/sampledIsoSurfaceCell.H | 4 +- .../sampledCuttingPlane/sampledCuttingPlane.H | 4 +- .../surface/distanceSurface/distanceSurface.C | 4 +- .../surface/distanceSurface/distanceSurface.H | 4 +- src/sampling/surface/isoSurface/isoSurface.H | 2 +- .../chemkinReader/chemkinReader.H | 3 +- .../liquidProperties/liquidProperties.C | 43 +++-- .../solidProperties/solidPropertiesNew.C | 2 +- 72 files changed, 227 insertions(+), 319 deletions(-) diff --git a/applications/solvers/combustion/PDRFoam/PDRFoam.C b/applications/solvers/combustion/PDRFoam/PDRFoam.C index 5f4cac3e6e..d57da07df9 100644 --- a/applications/solvers/combustion/PDRFoam/PDRFoam.C +++ b/applications/solvers/combustion/PDRFoam/PDRFoam.C @@ -78,7 +78,6 @@ Description #include "XiModel.H" #include "PDRDragModel.H" #include "ignition.H" -#include "Switch.H" #include "bound.H" #include "pimpleControl.H" #include "fvOptions.H" diff --git a/applications/solvers/combustion/PDRFoam/PDRFoamAutoRefine.C b/applications/solvers/combustion/PDRFoam/PDRFoamAutoRefine.C index 60618232e0..48a9aaf5c8 100644 --- a/applications/solvers/combustion/PDRFoam/PDRFoamAutoRefine.C +++ b/applications/solvers/combustion/PDRFoam/PDRFoamAutoRefine.C @@ -63,7 +63,6 @@ Description #include "XiModel.H" #include "PDRDragModel.H" #include "ignition.H" -#include "Switch.H" #include "bound.H" #include "dynamicRefineFvMesh.H" #include "pimpleControl.H" diff --git a/applications/solvers/combustion/PDRFoam/PDRModels/dragModels/PDRDragModel/PDRDragModel.C b/applications/solvers/combustion/PDRFoam/PDRModels/dragModels/PDRDragModel/PDRDragModel.C index 2b2cd7c4fd..175c5f4f1c 100644 --- a/applications/solvers/combustion/PDRFoam/PDRModels/dragModels/PDRDragModel/PDRDragModel.C +++ b/applications/solvers/combustion/PDRFoam/PDRModels/dragModels/PDRDragModel/PDRDragModel.C @@ -58,14 +58,14 @@ Foam::PDRDragModel::PDRDragModel ( PDRProperties.subDict ( - word(PDRProperties.lookup("PDRDragModel")) + "Coeffs" + PDRProperties.get("PDRDragModel") + "Coeffs" ) ), turbulence_(turbulence), rho_(rho), U_(U), phi_(phi), - on_(PDRDragModelCoeffs_.lookup("drag")) + on_(PDRDragModelCoeffs_.get("drag")) {} @@ -81,7 +81,7 @@ bool Foam::PDRDragModel::read(const dictionary& PDRProperties) { PDRDragModelCoeffs_ = PDRProperties.optionalSubDict(type() + "Coeffs"); - PDRDragModelCoeffs_.lookup("drag") >> on_; + PDRDragModelCoeffs_.read("drag", on_); return true; } diff --git a/applications/solvers/combustion/PDRFoam/PDRModels/dragModels/PDRDragModel/PDRDragModel.H b/applications/solvers/combustion/PDRFoam/PDRModels/dragModels/PDRDragModel/PDRDragModel.H index 66c1abb44a..c4a52f3f02 100644 --- a/applications/solvers/combustion/PDRFoam/PDRModels/dragModels/PDRDragModel/PDRDragModel.H +++ b/applications/solvers/combustion/PDRFoam/PDRModels/dragModels/PDRDragModel/PDRDragModel.H @@ -67,7 +67,7 @@ protected: const volVectorField& U_; const surfaceScalarField& phi_; - Switch on_; + bool on_; private: diff --git a/applications/solvers/combustion/PDRFoam/PDRModels/dragModels/PDRDragModel/PDRDragModelNew.C b/applications/solvers/combustion/PDRFoam/PDRModels/dragModels/PDRDragModel/PDRDragModelNew.C index 25a4a2098e..0069477bac 100644 --- a/applications/solvers/combustion/PDRFoam/PDRModels/dragModels/PDRDragModel/PDRDragModelNew.C +++ b/applications/solvers/combustion/PDRFoam/PDRModels/dragModels/PDRDragModel/PDRDragModelNew.C @@ -36,9 +36,9 @@ Foam::autoPtr Foam::PDRDragModel::New const surfaceScalarField& phi ) { - const word modelType(PDRProperties.lookup("PDRDragModel")); + const word modelType(PDRProperties.get("PDRDragModel")); - Info<< "Selecting flame-wrinkling model " << modelType << endl; + Info<< "Selecting drag model " << modelType << endl; auto cstrIter = dictionaryConstructorTablePtr_->cfind(modelType); diff --git a/applications/solvers/combustion/PDRFoam/PDRModels/dragModels/basic/basic.C b/applications/solvers/combustion/PDRFoam/PDRModels/dragModels/basic/basic.C index 5f3e6f1bc5..821380fe04 100644 --- a/applications/solvers/combustion/PDRFoam/PDRModels/dragModels/basic/basic.C +++ b/applications/solvers/combustion/PDRFoam/PDRModels/dragModels/basic/basic.C @@ -165,8 +165,8 @@ bool Foam::PDRDragModels::basic::read(const dictionary& PDRProperties) { PDRDragModel::read(PDRProperties); - PDRDragModelCoeffs_.lookup("Csu") >> Csu.value(); - PDRDragModelCoeffs_.lookup("Csk") >> Csk.value(); + PDRDragModelCoeffs_.read("Csu", Csu.value()); + PDRDragModelCoeffs_.read("Csk", Csk.value()); return true; } diff --git a/applications/solvers/combustion/chemFoam/createControls.H b/applications/solvers/combustion/chemFoam/createControls.H index 6aeb2fff15..f06814dc2b 100644 --- a/applications/solvers/combustion/chemFoam/createControls.H +++ b/applications/solvers/combustion/chemFoam/createControls.H @@ -1,2 +1,3 @@ -Switch adjustTimeStep(runTime.controlDict().lookup("adjustTimeStep")); -scalar maxDeltaT(readScalar(runTime.controlDict().lookup("maxDeltaT"))); +bool adjustTimeStep(runTime.controlDict().get("adjustTimeStep")); + +scalar maxDeltaT(runTime.controlDict().get("maxDeltaT")); diff --git a/applications/solvers/combustion/chemFoam/readControls.H b/applications/solvers/combustion/chemFoam/readControls.H index c56206df1a..09937a19a6 100644 --- a/applications/solvers/combustion/chemFoam/readControls.H +++ b/applications/solvers/combustion/chemFoam/readControls.H @@ -1,3 +1,3 @@ -runTime.controlDict().lookup("adjustTimeStep") >> adjustTimeStep; +runTime.controlDict().read("adjustTimeStep", adjustTimeStep); -maxDeltaT = readScalar(runTime.controlDict().lookup("maxDeltaT")); +runTime.controlDict().read("maxDeltaT", maxDeltaT); diff --git a/applications/solvers/compressible/rhoSimpleFoam/rhoPorousSimpleFoam/createZones.H b/applications/solvers/compressible/rhoSimpleFoam/rhoPorousSimpleFoam/createZones.H index fe3d118608..7435c6d555 100644 --- a/applications/solvers/compressible/rhoSimpleFoam/rhoPorousSimpleFoam/createZones.H +++ b/applications/solvers/compressible/rhoSimpleFoam/rhoPorousSimpleFoam/createZones.H @@ -1,5 +1,5 @@ IOporosityModelList pZones(mesh); - Switch pressureImplicitPorosity(false); + bool pressureImplicitPorosity(false); // nUCorrectors used for pressureImplicitPorosity int nUCorr = 0; diff --git a/applications/solvers/incompressible/shallowWaterFoam/readGravitationalAcceleration.H b/applications/solvers/incompressible/shallowWaterFoam/readGravitationalAcceleration.H index d8a8bf8d06..b960a2f640 100644 --- a/applications/solvers/incompressible/shallowWaterFoam/readGravitationalAcceleration.H +++ b/applications/solvers/incompressible/shallowWaterFoam/readGravitationalAcceleration.H @@ -13,9 +13,11 @@ IOdictionary gravitationalProperties ); const dimensionedVector g(gravitationalProperties.lookup("g")); -const Switch rotating(gravitationalProperties.lookup("rotating")); +const bool rotating(gravitationalProperties.get("rotating")); const dimensionedVector Omega = +( rotating ? gravitationalProperties.lookup("Omega") - : dimensionedVector("Omega", -dimTime, vector(0,0,0)); + : dimensionedVector("Omega", -dimTime, vector(0,0,0)) +); const dimensionedScalar magg = mag(g); const dimensionedVector gHat = g/magg; diff --git a/applications/solvers/incompressible/simpleFoam/porousSimpleFoam/createPorousZones.H b/applications/solvers/incompressible/simpleFoam/porousSimpleFoam/createPorousZones.H index 5c6dbea19c..f67c6d7890 100644 --- a/applications/solvers/incompressible/simpleFoam/porousSimpleFoam/createPorousZones.H +++ b/applications/solvers/incompressible/simpleFoam/porousSimpleFoam/createPorousZones.H @@ -1,5 +1,5 @@ IOporosityModelList pZones(mesh); - Switch pressureImplicitPorosity(false); + bool pressureImplicitPorosity(false); // nUCorrectors used for pressureImplicitPorosity int nUCorr = 0; diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/ThermalPhaseChangePhaseSystem/ThermalPhaseChangePhaseSystem.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/ThermalPhaseChangePhaseSystem/ThermalPhaseChangePhaseSystem.C index d63ca7d058..0a2377b2f3 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/ThermalPhaseChangePhaseSystem/ThermalPhaseChangePhaseSystem.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/ThermalPhaseChangePhaseSystem/ThermalPhaseChangePhaseSystem.C @@ -39,7 +39,7 @@ ThermalPhaseChangePhaseSystem HeatAndMassTransferPhaseSystem(mesh), volatile_(this->lookup("volatile")), saturationModel_(saturationModel::New(this->subDict("saturationModel"))), - massTransfer_(this->lookup("massTransfer")) + massTransfer_(this->template get("massTransfer")) { forAllConstIters(this->phasePairs_, phasePairIter) @@ -357,7 +357,7 @@ void Foam::ThermalPhaseChangePhaseSystem::correctThermo() volScalarField iDmdtNew(iDmdt); - if (massTransfer_ ) + if (massTransfer_) { volScalarField H1 ( diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/ThermalPhaseChangePhaseSystem/ThermalPhaseChangePhaseSystem.H b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/ThermalPhaseChangePhaseSystem/ThermalPhaseChangePhaseSystem.H index 611666eddc..7ce10e6c7a 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/ThermalPhaseChangePhaseSystem/ThermalPhaseChangePhaseSystem.H +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/ThermalPhaseChangePhaseSystem/ThermalPhaseChangePhaseSystem.H @@ -43,7 +43,6 @@ SourceFiles #include "HeatAndMassTransferPhaseSystem.H" #include "saturationModel.H" -#include "Switch.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -71,7 +70,7 @@ protected: autoPtr saturationModel_; // Mass transfer enabled - Switch massTransfer_; + bool massTransfer_; //- Interfacial Mass transfer rate HashPtrTable diff --git a/applications/solvers/stressAnalysis/solidDisplacementFoam/createControl.H b/applications/solvers/stressAnalysis/solidDisplacementFoam/createControl.H index edd35297d5..40e35f8c05 100644 --- a/applications/solvers/stressAnalysis/solidDisplacementFoam/createControl.H +++ b/applications/solvers/stressAnalysis/solidDisplacementFoam/createControl.H @@ -1,3 +1,3 @@ const dictionary& stressControl = mesh.solutionDict().subDict("stressAnalysis"); -Switch compactNormalStress(stressControl.lookup("compactNormalStress")); +bool compactNormalStress(stressControl.get("compactNormalStress")); diff --git a/applications/solvers/stressAnalysis/solidDisplacementFoam/createControls.H b/applications/solvers/stressAnalysis/solidDisplacementFoam/createControls.H index dec25226f1..b35e04e26e 100644 --- a/applications/solvers/stressAnalysis/solidDisplacementFoam/createControls.H +++ b/applications/solvers/stressAnalysis/solidDisplacementFoam/createControls.H @@ -2,4 +2,4 @@ int nCorr = stressControl.lookupOrDefault("nCorrectors", 1); -scalar convergenceTolerance(readScalar(stressControl.lookup("D"))); +scalar convergenceTolerance(stressControl.get("D")); diff --git a/applications/solvers/stressAnalysis/solidDisplacementFoam/readMechanicalProperties.H b/applications/solvers/stressAnalysis/solidDisplacementFoam/readMechanicalProperties.H index a912d80e07..a592de04e9 100644 --- a/applications/solvers/stressAnalysis/solidDisplacementFoam/readMechanicalProperties.H +++ b/applications/solvers/stressAnalysis/solidDisplacementFoam/readMechanicalProperties.H @@ -184,9 +184,7 @@ volScalarField lambda(nu*E/((1.0 + nu)*(1.0 - 2.0*nu))); volScalarField threeK(E/(1.0 - 2.0*nu)); - Switch planeStress(mechanicalProperties.lookup("planeStress")); - - if (planeStress) + if (mechanicalProperties.get("planeStress")) { Info<< "Plane Stress\n" << endl; diff --git a/applications/solvers/stressAnalysis/solidDisplacementFoam/readSolidDisplacementFoamControls.H b/applications/solvers/stressAnalysis/solidDisplacementFoam/readSolidDisplacementFoamControls.H index 5ffe09b9e8..78beb0e717 100644 --- a/applications/solvers/stressAnalysis/solidDisplacementFoam/readSolidDisplacementFoamControls.H +++ b/applications/solvers/stressAnalysis/solidDisplacementFoam/readSolidDisplacementFoamControls.H @@ -1,3 +1,3 @@ nCorr = stressControl.lookupOrDefault("nCorrectors", 1); -convergenceTolerance = readScalar(stressControl.lookup("D")); -stressControl.lookup("compactNormalStress") >> compactNormalStress; +convergenceTolerance = stressControl.get("D"); +compactNormalStress = stressControl.get("compactNormalStress"); diff --git a/applications/solvers/stressAnalysis/solidDisplacementFoam/readThermalProperties.H b/applications/solvers/stressAnalysis/solidDisplacementFoam/readThermalProperties.H index ef7a53028c..3c889fc1c8 100644 --- a/applications/solvers/stressAnalysis/solidDisplacementFoam/readThermalProperties.H +++ b/applications/solvers/stressAnalysis/solidDisplacementFoam/readThermalProperties.H @@ -12,7 +12,7 @@ IOdictionary thermalProperties ) ); -Switch thermalStress(thermalProperties.lookup("thermalStress")); +bool thermalStress(thermalProperties.get("thermalStress")); volScalarField threeKalpha ( @@ -46,7 +46,6 @@ volScalarField DT if (thermalStress) { - autoPtr CPtr; IOobject CIO diff --git a/applications/solvers/stressAnalysis/solidDisplacementFoam/solidDisplacementFoam.C b/applications/solvers/stressAnalysis/solidDisplacementFoam/solidDisplacementFoam.C index d02e420ecb..15a1309c92 100644 --- a/applications/solvers/stressAnalysis/solidDisplacementFoam/solidDisplacementFoam.C +++ b/applications/solvers/stressAnalysis/solidDisplacementFoam/solidDisplacementFoam.C @@ -39,7 +39,6 @@ Description \*---------------------------------------------------------------------------*/ #include "fvCFD.H" -#include "Switch.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/solvers/stressAnalysis/solidDisplacementFoam/tractionDisplacement/tractionDisplacementFvPatchVectorField.C b/applications/solvers/stressAnalysis/solidDisplacementFoam/tractionDisplacement/tractionDisplacementFvPatchVectorField.C index 49d62b804e..d4ba300459 100644 --- a/applications/solvers/stressAnalysis/solidDisplacementFoam/tractionDisplacement/tractionDisplacementFvPatchVectorField.C +++ b/applications/solvers/stressAnalysis/solidDisplacementFoam/tractionDisplacement/tractionDisplacementFvPatchVectorField.C @@ -164,9 +164,7 @@ void tractionDisplacementFvPatchVectorField::updateCoeffs() scalarField lambda(nu*E/((1.0 + nu)*(1.0 - 2.0*nu))); scalarField threeK(E/(1.0 - 2.0*nu)); - Switch planeStress(mechanicalProperties.lookup("planeStress")); - - if (planeStress) + if (mechanicalProperties.get("planeStress")) { lambda = nu*E/((1.0 + nu)*(1.0 - nu)); threeK = E/(1.0 - nu); @@ -185,9 +183,7 @@ void tractionDisplacementFvPatchVectorField::updateCoeffs() + twoMuLambda*fvPatchField::snGrad() - (n & sigmaD) )/twoMuLambda; - Switch thermalStress(thermalProperties.lookup("thermalStress")); - - if (thermalStress) + if (thermalProperties.get("thermalStress")) { const fvPatchField& threeKalpha= patch().lookupPatchField("threeKalpha"); diff --git a/applications/solvers/stressAnalysis/solidEquilibriumDisplacementFoam/solidEquilibriumDisplacementFoam.C b/applications/solvers/stressAnalysis/solidEquilibriumDisplacementFoam/solidEquilibriumDisplacementFoam.C index ce297ac89e..83bd903480 100644 --- a/applications/solvers/stressAnalysis/solidEquilibriumDisplacementFoam/solidEquilibriumDisplacementFoam.C +++ b/applications/solvers/stressAnalysis/solidEquilibriumDisplacementFoam/solidEquilibriumDisplacementFoam.C @@ -39,7 +39,6 @@ Description \*---------------------------------------------------------------------------*/ #include "fvCFD.H" -#include "Switch.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/solvers/stressAnalysis/solidEquilibriumDisplacementFoam/tractionDisplacementCorrection/tractionDisplacementCorrectionFvPatchVectorField.C b/applications/solvers/stressAnalysis/solidEquilibriumDisplacementFoam/tractionDisplacementCorrection/tractionDisplacementCorrectionFvPatchVectorField.C index 33c1e8a8c6..2b90cacfdf 100644 --- a/applications/solvers/stressAnalysis/solidEquilibriumDisplacementFoam/tractionDisplacementCorrection/tractionDisplacementCorrectionFvPatchVectorField.C +++ b/applications/solvers/stressAnalysis/solidEquilibriumDisplacementFoam/tractionDisplacementCorrection/tractionDisplacementCorrectionFvPatchVectorField.C @@ -163,9 +163,7 @@ void tractionDisplacementCorrectionFvPatchVectorField::updateCoeffs() scalarField mu(E/(2.0*(1.0 + nu))); scalarField lambda(nu*E/((1.0 + nu)*(1.0 - 2.0*nu))); - Switch planeStress(mechanicalProperties.lookup("planeStress")); - - if (planeStress) + if (mechanicalProperties.get("planeStress")) { lambda = nu*E/((1.0 + nu)*(1.0 - nu)); } diff --git a/applications/utilities/mesh/advanced/selectCells/edgeStats.C b/applications/utilities/mesh/advanced/selectCells/edgeStats.C index 8d2fada35d..c7d7f9aab7 100644 --- a/applications/utilities/mesh/advanced/selectCells/edgeStats.C +++ b/applications/utilities/mesh/advanced/selectCells/edgeStats.C @@ -89,9 +89,7 @@ Foam::edgeStats::edgeStats(const polyMesh& mesh) IOdictionary motionProperties(motionObj); - Switch twoDMotion(motionProperties.lookup("twoDMotion")); - - if (twoDMotion) + if (motionProperties.get("twoDMotion")) { Info<< "Correcting for 2D motion" << endl << endl; diff --git a/applications/utilities/mesh/advanced/snappyRefineMesh/snappyRefineMesh.C b/applications/utilities/mesh/advanced/snappyRefineMesh/snappyRefineMesh.C index 2f268c447a..6cf0973059 100644 --- a/applications/utilities/mesh/advanced/snappyRefineMesh/snappyRefineMesh.C +++ b/applications/utilities/mesh/advanced/snappyRefineMesh/snappyRefineMesh.C @@ -658,9 +658,7 @@ int main(int argc, char *argv[]) IOdictionary motionProperties(motionObj); - Switch twoDMotion(motionProperties.lookup("twoDMotion")); - - if (twoDMotion) + if (motionProperties.get("twoDMotion")) { Info<< "Correcting for 2D motion" << endl << endl; correct2DPtr = new twoDPointCorrector(mesh); diff --git a/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMesh.C b/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMesh.C index 34d5f2b5c6..a5dfafe0ae 100644 --- a/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMesh.C +++ b/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMesh.C @@ -297,7 +297,7 @@ int main(int argc, char *argv[]) autoPtr model(extrudeModel::New(dict)); // Whether to flip normals - const Switch flipNormals(dict.lookup("flipNormals")); + const bool flipNormals(dict.get("flipNormals")); // What to extrude const ExtrudeMode mode = ExtrudeModeNames.lookup @@ -983,8 +983,7 @@ int main(int argc, char *argv[]) // Merging front and back patch faces // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Switch mergeFaces(dict.lookup("mergeFaces")); - if (mergeFaces) + if (dict.get("mergeFaces")) { if (mode == MESH) { @@ -1009,7 +1008,6 @@ int main(int argc, char *argv[]) } - polyTopoChanger stitcher(mesh); stitcher.setSize(1); diff --git a/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C index 3251cc203a..1bf2ee3138 100644 --- a/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C +++ b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C @@ -1536,8 +1536,8 @@ int main(int argc, char *argv[]) mappedPatchBase::sampleMode sampleMode = mappedPatchBase::sampleModeNames_[dict.lookup("sampleMode")]; - const Switch oneD(dict.lookup("oneD")); - Switch oneDNonManifoldEdges(false); + const bool oneD(dict.get("oneD")); + bool oneDNonManifoldEdges(false); word oneDPatchType(emptyPolyPatch::typeName); if (oneD) { @@ -1545,7 +1545,7 @@ int main(int argc, char *argv[]) dict.lookup("oneDPolyPatchType") >> oneDPatchType; } - const Switch adaptMesh(dict.lookup("adaptMesh")); + const bool adaptMesh(dict.get("adaptMesh")); if (hasZones) { diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellSizeControlSurfaces/surfaceCellSizeFunction/cellSizeCalculationType/automatic/automatic.C b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellSizeControlSurfaces/surfaceCellSizeFunction/cellSizeCalculationType/automatic/automatic.C index 302bd61b55..b3b09022b3 100644 --- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellSizeControlSurfaces/surfaceCellSizeFunction/cellSizeCalculationType/automatic/automatic.C +++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellSizeControlSurfaces/surfaceCellSizeFunction/cellSizeCalculationType/automatic/automatic.C @@ -97,7 +97,7 @@ Foam::automatic::automatic ( const dictionary& cellSizeCalcTypeDict, const triSurfaceMesh& surface, - const scalar& defaultCellSize + const scalar defaultCellSize ) : cellSizeCalculationType @@ -109,12 +109,15 @@ Foam::automatic::automatic ), coeffsDict_(cellSizeCalcTypeDict.optionalSubDict(typeName + "Coeffs")), surfaceName_(surface.searchableSurface::name()), - readCurvature_(Switch(coeffsDict_.lookup("curvature"))), - curvatureFile_(coeffsDict_.lookup("curvatureFile")), - readFeatureProximity_(Switch(coeffsDict_.lookup("featureProximity"))), - featureProximityFile_(coeffsDict_.lookup("featureProximityFile")), - readInternalCloseness_(Switch(coeffsDict_.lookup("internalCloseness"))), - internalClosenessFile_(coeffsDict_.lookup("internalClosenessFile")), + + readCurvature_(coeffsDict_.get("curvature")), + readFeatureProximity_(coeffsDict_.get("featureProximity")), + readInternalCloseness_(coeffsDict_.get("internalCloseness")), + + curvatureFile_(coeffsDict_.get("curvatureFile")), + featureProximityFile_(coeffsDict_.get("featureProximityFile")), + internalClosenessFile_(coeffsDict_.get("internalClosenessFile")), + curvatureCellSizeCoeff_ ( readScalar(coeffsDict_.lookup("curvatureCellSizeCoeff")) diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellSizeControlSurfaces/surfaceCellSizeFunction/cellSizeCalculationType/automatic/automatic.H b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellSizeControlSurfaces/surfaceCellSizeFunction/cellSizeCalculationType/automatic/automatic.H index 07f4e9442d..11cf52ff86 100644 --- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellSizeControlSurfaces/surfaceCellSizeFunction/cellSizeCalculationType/automatic/automatic.H +++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellSizeControlSurfaces/surfaceCellSizeFunction/cellSizeCalculationType/automatic/automatic.H @@ -37,7 +37,6 @@ SourceFiles #include "cellSizeCalculationType.H" #include "triSurfaceFields.H" #include "PrimitivePatchInterpolation.H" -#include "Switch.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -54,9 +53,6 @@ class automatic : public cellSizeCalculationType { - -private: - // Private data //- Dictionary of coefficients for automatic cell sizing @@ -65,13 +61,12 @@ private: //- Name of the surface. Used to write the cell size field const fileName surfaceName_; - const Switch readCurvature_; + const bool readCurvature_; + const bool readFeatureProximity_; + const bool readInternalCloseness_; + const word curvatureFile_; - - const Switch readFeatureProximity_; const word featureProximityFile_; - - const Switch readInternalCloseness_; const word internalClosenessFile_; //- The curvature values are multiplied by the inverse of this value to @@ -100,13 +95,12 @@ public: ( const dictionary& cellSizeCalcTypeDict, const triSurfaceMesh& surface, - const scalar& defaultCellSize + const scalar defaultCellSize ); //- Destructor - virtual ~automatic() - {} + virtual ~automatic() = default; // Member Functions diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cvControls/cvControls.C b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cvControls/cvControls.C index 3274c0ad0a..58db69d92e 100644 --- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cvControls/cvControls.C +++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cvControls/cvControls.C @@ -42,43 +42,30 @@ Foam::cvControls::cvControls foamyHexMeshDict_.subDict("surfaceConformation") ); - pointPairDistanceCoeff_ = readScalar - ( - surfDict.lookup("pointPairDistanceCoeff") - ); + pointPairDistanceCoeff_ = + surfDict.get("pointPairDistanceCoeff"); - mixedFeaturePointPPDistanceCoeff_ = readScalar - ( - surfDict.lookup("mixedFeaturePointPPDistanceCoeff") - ); + mixedFeaturePointPPDistanceCoeff_ = + surfDict.get("mixedFeaturePointPPDistanceCoeff"); - featurePointExclusionDistanceCoeff_ = readScalar - ( - surfDict.lookup("featurePointExclusionDistanceCoeff") - ); + featurePointExclusionDistanceCoeff_ = + surfDict.get("featurePointExclusionDistanceCoeff"); - featureEdgeExclusionDistanceCoeff_ = readScalar - ( - surfDict.lookup("featureEdgeExclusionDistanceCoeff") - ); + featureEdgeExclusionDistanceCoeff_ = + surfDict.get("featureEdgeExclusionDistanceCoeff"); + surfaceSearchDistanceCoeff_ = + surfDict.get("surfaceSearchDistanceCoeff"); - surfaceSearchDistanceCoeff_ = readScalar - ( - surfDict.lookup("surfaceSearchDistanceCoeff") - ); + maxSurfaceProtrusionCoeff_ = + surfDict.get("maxSurfaceProtrusionCoeff"); - maxSurfaceProtrusionCoeff_ = readScalar - ( - surfDict.lookup("maxSurfaceProtrusionCoeff") - ); - - maxQuadAngle_ = readScalar(surfDict.lookup("maxQuadAngle")); + maxQuadAngle_ = surfDict.get("maxQuadAngle"); surfaceConformationRebuildFrequency_ = max ( 1, - readLabel(surfDict.lookup("surfaceConformationRebuildFrequency")) + surfDict.get