From ff30e6b61a2de4aea19d3230c41a862fb0aa5e32 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Thu, 20 May 2010 14:17:18 +0200 Subject: [PATCH] STYLE: can use bool instead of Switch version of dictionary::lookupOrDefault - both versions handle the same input words. Only need the version when the destination variable is also a Switch and we need to output the word later. --- .../fluid/readFluidMultiRegionSIMPLEControls.H | 4 ++-- .../fluid/readFluidMultiRegionPIMPLEControls.H | 2 +- .../fluid/readFluidMultiRegionPISOControls.H | 4 ++-- .../solvers/incompressible/pimpleDyMFoam/readControls.H | 4 ++-- .../solvers/multiphase/bubbleFoam/createRASTurbulence.H | 2 +- .../multiphase/compressibleInterDyMFoam/readControls.H | 4 ++-- applications/solvers/multiphase/interDyMFoam/readControls.H | 4 ++-- applications/solvers/multiphase/settlingFoam/createFields.H | 2 +- applications/utilities/surface/surfaceSubset/surfaceSubset.C | 2 +- src/OpenFOAM/global/argList/argList.C | 3 +-- src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGSolver.H | 3 +-- src/OpenFOAM/matrices/solution/solution.C | 2 +- src/OpenFOAM/matrices/solution/solution.H | 3 +-- .../cfdTools/general/include/readPIMPLEControls.H | 4 ++-- src/finiteVolume/cfdTools/general/include/readPISOControls.H | 4 ++-- .../cfdTools/general/include/readSIMPLEControls.H | 4 ++-- src/finiteVolume/cfdTools/general/include/readTimeControls.H | 2 +- .../coordinateRotation/EulerCoordinateRotation.C | 3 +-- .../coordinateRotation/STARCDCoordinateRotation.C | 3 +-- src/meshTools/coordinateSystems/cylindricalCS.C | 3 +-- src/meshTools/coordinateSystems/sphericalCS.C | 3 +-- 21 files changed, 29 insertions(+), 36 deletions(-) diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/readFluidMultiRegionSIMPLEControls.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/readFluidMultiRegionSIMPLEControls.H index e69527a97c..f8a11b7159 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/readFluidMultiRegionSIMPLEControls.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/readFluidMultiRegionSIMPLEControls.H @@ -4,8 +4,8 @@ simple.lookupOrDefault("nNonOrthogonalCorrectors", 0); const bool momentumPredictor = - simple.lookupOrDefault("momentumPredictor", true); + simple.lookupOrDefault("momentumPredictor", true); const bool transonic = - simple.lookupOrDefault("transonic", false); + simple.lookupOrDefault("transonic", false); diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/readFluidMultiRegionPIMPLEControls.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/readFluidMultiRegionPIMPLEControls.H index 0591b36623..71e49a33a8 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/readFluidMultiRegionPIMPLEControls.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/readFluidMultiRegionPIMPLEControls.H @@ -7,5 +7,5 @@ pimple.lookupOrDefault("nNonOrthogonalCorrectors", 0); const bool momentumPredictor = - pimple.lookupOrDefault("momentumPredictor", true); + pimple.lookupOrDefault("momentumPredictor", true); diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/readFluidMultiRegionPISOControls.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/readFluidMultiRegionPISOControls.H index c03366ae7a..1f8cdb82a3 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/readFluidMultiRegionPISOControls.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/readFluidMultiRegionPISOControls.H @@ -10,8 +10,8 @@ piso.lookupOrDefault("nNonOrthogonalCorrectors", 0); const bool momentumPredictor = - piso.lookupOrDefault("momentumPredictor", true); + piso.lookupOrDefault("momentumPredictor", true); const bool transonic = - piso.lookupOrDefault("transonic", false); + piso.lookupOrDefault("transonic", false); diff --git a/applications/solvers/incompressible/pimpleDyMFoam/readControls.H b/applications/solvers/incompressible/pimpleDyMFoam/readControls.H index bee4e4d7b8..8789bd0ab4 100644 --- a/applications/solvers/incompressible/pimpleDyMFoam/readControls.H +++ b/applications/solvers/incompressible/pimpleDyMFoam/readControls.H @@ -2,8 +2,8 @@ #include "readPIMPLEControls.H" const bool correctPhi = - pimple.lookupOrDefault("correctPhi", false); + pimple.lookupOrDefault("correctPhi", false); const bool checkMeshCourantNo = - pimple.lookupOrDefault("checkMeshCourantNo", false); + pimple.lookupOrDefault("checkMeshCourantNo", false); diff --git a/applications/solvers/multiphase/bubbleFoam/createRASTurbulence.H b/applications/solvers/multiphase/bubbleFoam/createRASTurbulence.H index 1ae6219fd6..cec2cc8bb3 100644 --- a/applications/solvers/multiphase/bubbleFoam/createRASTurbulence.H +++ b/applications/solvers/multiphase/bubbleFoam/createRASTurbulence.H @@ -96,7 +96,7 @@ ) ); - if (RASProperties.lookupOrDefault("printCoeffs", false)) + if (RASProperties.lookupOrDefault("printCoeffs", false)) { Info<< "kEpsilonCoeffs" << kEpsilonDict << nl << "wallFunctionCoeffs" << wallFunctionDict << endl; diff --git a/applications/solvers/multiphase/compressibleInterDyMFoam/readControls.H b/applications/solvers/multiphase/compressibleInterDyMFoam/readControls.H index 11c3e8071e..a5a2a183e5 100644 --- a/applications/solvers/multiphase/compressibleInterDyMFoam/readControls.H +++ b/applications/solvers/multiphase/compressibleInterDyMFoam/readControls.H @@ -20,8 +20,8 @@ } const bool correctPhi = - piso.lookupOrDefault("correctPhi", true); + piso.lookupOrDefault("correctPhi", true); const bool checkMeshCourantNo = - piso.lookupOrDefault("checkMeshCourantNo", false); + piso.lookupOrDefault("checkMeshCourantNo", false); diff --git a/applications/solvers/multiphase/interDyMFoam/readControls.H b/applications/solvers/multiphase/interDyMFoam/readControls.H index 8264a051c2..10b09bf8ff 100644 --- a/applications/solvers/multiphase/interDyMFoam/readControls.H +++ b/applications/solvers/multiphase/interDyMFoam/readControls.H @@ -2,8 +2,8 @@ # include "readPISOControls.H" const bool correctPhi = - piso.lookupOrDefault("correctPhi", true); + piso.lookupOrDefault("correctPhi", true); const bool checkMeshCourantNo = - piso.lookupOrDefault("checkMeshCourantNo", false); + piso.lookupOrDefault("checkMeshCourantNo", false); diff --git a/applications/solvers/multiphase/settlingFoam/createFields.H b/applications/solvers/multiphase/settlingFoam/createFields.H index c8e05c4209..598b49bcc6 100644 --- a/applications/solvers/multiphase/settlingFoam/createFields.H +++ b/applications/solvers/multiphase/settlingFoam/createFields.H @@ -276,7 +276,7 @@ ) ); - if (RASProperties.lookupOrDefault("printCoeffs", false)) + if (RASProperties.lookupOrDefault("printCoeffs", false)) { Info<< "kEpsilonCoeffs" << kEpsilonDict << nl << "wallFunctionCoeffs" << wallFunctionDict << endl; diff --git a/applications/utilities/surface/surfaceSubset/surfaceSubset.C b/applications/utilities/surface/surfaceSubset/surfaceSubset.C index 3246358d9b..51255242ef 100644 --- a/applications/utilities/surface/surfaceSubset/surfaceSubset.C +++ b/applications/utilities/surface/surfaceSubset/surfaceSubset.C @@ -102,7 +102,7 @@ int main(int argc, char *argv[]) ); const bool invertSelection = - meshSubsetDict.lookupOrDefault("invertSelection", false); + meshSubsetDict.lookupOrDefault("invertSelection", false); // Mark the cells for the subset diff --git a/src/OpenFOAM/global/argList/argList.C b/src/OpenFOAM/global/argList/argList.C index 82c6ff47c9..6fc06a69cc 100644 --- a/src/OpenFOAM/global/argList/argList.C +++ b/src/OpenFOAM/global/argList/argList.C @@ -28,7 +28,6 @@ License #include "clock.H" #include "IFstream.H" #include "dictionary.H" -#include "Switch.H" #include "IOobject.H" #include "JobInfo.H" #include "labelList.H" @@ -564,7 +563,7 @@ Foam::argList::argList } // distributed data - if (decompDict.lookupOrDefault("distributed", false)) + if (decompDict.lookupOrDefault("distributed", false)) { fileNameList roots; decompDict.lookup("roots") >> roots; diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGSolver.H b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGSolver.H index 54908a720d..d0287653cf 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGSolver.H +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGSolver.H @@ -58,7 +58,6 @@ SourceFiles #include "labelField.H" #include "primitiveFields.H" #include "LUscalarMatrix.H" -#include "Switch.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -75,7 +74,7 @@ class GAMGSolver { // Private data - Switch cacheAgglomeration_; + bool cacheAgglomeration_; //- Number of pre-smoothing sweeps label nPreSweeps_; diff --git a/src/OpenFOAM/matrices/solution/solution.C b/src/OpenFOAM/matrices/solution/solution.C index 5aa40ae572..179641bea0 100644 --- a/src/OpenFOAM/matrices/solution/solution.C +++ b/src/OpenFOAM/matrices/solution/solution.C @@ -255,7 +255,7 @@ bool Foam::solution::read() if (dict.found("cache")) { cache_ = dict.subDict("cache"); - caching_ = cache_.lookupOrDefault("active", true); + caching_ = cache_.lookupOrDefault("active", true); } if (dict.found("relaxationFactors")) diff --git a/src/OpenFOAM/matrices/solution/solution.H b/src/OpenFOAM/matrices/solution/solution.H index a2e06b19de..8a24ca0eb4 100644 --- a/src/OpenFOAM/matrices/solution/solution.H +++ b/src/OpenFOAM/matrices/solution/solution.H @@ -36,7 +36,6 @@ SourceFiles #define solution_H #include "IOdictionary.H" -#include "Switch.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -57,7 +56,7 @@ class solution dictionary cache_; //- Switch for the caching mechanism - Switch caching_; + bool caching_; //- Dictionary of relaxation factors for all the fields dictionary relaxationFactors_; diff --git a/src/finiteVolume/cfdTools/general/include/readPIMPLEControls.H b/src/finiteVolume/cfdTools/general/include/readPIMPLEControls.H index 3d9fd3c7ec..7e88ec410b 100644 --- a/src/finiteVolume/cfdTools/general/include/readPIMPLEControls.H +++ b/src/finiteVolume/cfdTools/general/include/readPIMPLEControls.H @@ -10,8 +10,8 @@ pimple.lookupOrDefault("nNonOrthogonalCorrectors", 0); const bool momentumPredictor = - pimple.lookupOrDefault("momentumPredictor", true); + pimple.lookupOrDefault("momentumPredictor", true); const bool transonic = - pimple.lookupOrDefault("transonic", false); + pimple.lookupOrDefault("transonic", false); diff --git a/src/finiteVolume/cfdTools/general/include/readPISOControls.H b/src/finiteVolume/cfdTools/general/include/readPISOControls.H index 850ee1401d..61cb2f7a8c 100644 --- a/src/finiteVolume/cfdTools/general/include/readPISOControls.H +++ b/src/finiteVolume/cfdTools/general/include/readPISOControls.H @@ -10,8 +10,8 @@ piso.lookupOrDefault("nNonOrthogonalCorrectors", 0); const bool momentumPredictor = - piso.lookupOrDefault("momentumPredictor", true); + piso.lookupOrDefault("momentumPredictor", true); const bool transonic = - piso.lookupOrDefault("transonic", false); + piso.lookupOrDefault("transonic", false); diff --git a/src/finiteVolume/cfdTools/general/include/readSIMPLEControls.H b/src/finiteVolume/cfdTools/general/include/readSIMPLEControls.H index 6019876e11..26575dde41 100644 --- a/src/finiteVolume/cfdTools/general/include/readSIMPLEControls.H +++ b/src/finiteVolume/cfdTools/general/include/readSIMPLEControls.H @@ -4,8 +4,8 @@ simple.lookupOrDefault("nNonOrthogonalCorrectors", 0); const bool momentumPredictor = - simple.lookupOrDefault("momentumPredictor", true); + simple.lookupOrDefault("momentumPredictor", true); const bool transonic = - simple.lookupOrDefault("transonic", false); + simple.lookupOrDefault("transonic", false); diff --git a/src/finiteVolume/cfdTools/general/include/readTimeControls.H b/src/finiteVolume/cfdTools/general/include/readTimeControls.H index 8255c9af4c..60b2e20492 100644 --- a/src/finiteVolume/cfdTools/general/include/readTimeControls.H +++ b/src/finiteVolume/cfdTools/general/include/readTimeControls.H @@ -30,7 +30,7 @@ Description \*---------------------------------------------------------------------------*/ const bool adjustTimeStep = - runTime.controlDict().lookupOrDefault("adjustTimeStep", false); + runTime.controlDict().lookupOrDefault("adjustTimeStep", false); scalar maxCo = runTime.controlDict().lookupOrDefault("maxCo", 1.0); diff --git a/src/meshTools/coordinateSystems/coordinateRotation/EulerCoordinateRotation.C b/src/meshTools/coordinateSystems/coordinateRotation/EulerCoordinateRotation.C index e9f9882c8b..68f3c272bf 100644 --- a/src/meshTools/coordinateSystems/coordinateRotation/EulerCoordinateRotation.C +++ b/src/meshTools/coordinateSystems/coordinateRotation/EulerCoordinateRotation.C @@ -25,7 +25,6 @@ License #include "EulerCoordinateRotation.H" -#include "Switch.H" #include "mathematicalConstants.H" #include "addToRunTimeSelectionTable.H" @@ -137,7 +136,7 @@ Foam::EulerCoordinateRotation::EulerCoordinateRotation rotation.component(vector::X), rotation.component(vector::Y), rotation.component(vector::Z), - dict.lookupOrDefault("degrees", true) + dict.lookupOrDefault("degrees", true) ); } diff --git a/src/meshTools/coordinateSystems/coordinateRotation/STARCDCoordinateRotation.C b/src/meshTools/coordinateSystems/coordinateRotation/STARCDCoordinateRotation.C index c8277b9071..7bea35f466 100644 --- a/src/meshTools/coordinateSystems/coordinateRotation/STARCDCoordinateRotation.C +++ b/src/meshTools/coordinateSystems/coordinateRotation/STARCDCoordinateRotation.C @@ -25,7 +25,6 @@ License #include "STARCDCoordinateRotation.H" -#include "Switch.H" #include "mathematicalConstants.H" #include "addToRunTimeSelectionTable.H" @@ -138,7 +137,7 @@ Foam::STARCDCoordinateRotation::STARCDCoordinateRotation rotation.component(vector::X), rotation.component(vector::Y), rotation.component(vector::Z), - dict.lookupOrDefault("degrees", true) + dict.lookupOrDefault("degrees", true) ); } diff --git a/src/meshTools/coordinateSystems/cylindricalCS.C b/src/meshTools/coordinateSystems/cylindricalCS.C index 588397eeab..372e06cfc7 100644 --- a/src/meshTools/coordinateSystems/cylindricalCS.C +++ b/src/meshTools/coordinateSystems/cylindricalCS.C @@ -26,7 +26,6 @@ License #include "cylindricalCS.H" #include "one.H" -#include "Switch.H" #include "mathematicalConstants.H" #include "addToRunTimeSelectionTable.H" @@ -106,7 +105,7 @@ Foam::cylindricalCS::cylindricalCS ) : coordinateSystem(name, dict), - inDegrees_(dict.lookupOrDefault("degrees", true)) + inDegrees_(dict.lookupOrDefault("degrees", true)) {} diff --git a/src/meshTools/coordinateSystems/sphericalCS.C b/src/meshTools/coordinateSystems/sphericalCS.C index 40cf263088..9aa8343407 100644 --- a/src/meshTools/coordinateSystems/sphericalCS.C +++ b/src/meshTools/coordinateSystems/sphericalCS.C @@ -26,7 +26,6 @@ License #include "sphericalCS.H" #include "one.H" -#include "Switch.H" #include "mathematicalConstants.H" #include "addToRunTimeSelectionTable.H" @@ -106,7 +105,7 @@ Foam::sphericalCS::sphericalCS ) : coordinateSystem(name, dict), - inDegrees_(dict.lookupOrDefault("degrees", true)) + inDegrees_(dict.lookupOrDefault("degrees", true)) {}