STYLE: can use bool instead of Switch version of dictionary::lookupOrDefault

- both versions handle the same input words.
  Only need the <Switch> version when the destination variable is
  also a Switch and we need to output the word later.
This commit is contained in:
Mark Olesen
2010-05-20 14:17:18 +02:00
parent 9525d57d71
commit ff30e6b61a
21 changed files with 29 additions and 36 deletions

View File

@ -4,8 +4,8 @@
simple.lookupOrDefault<int>("nNonOrthogonalCorrectors", 0);
const bool momentumPredictor =
simple.lookupOrDefault<bool>("momentumPredictor", true);
simple.lookupOrDefault("momentumPredictor", true);
const bool transonic =
simple.lookupOrDefault<bool>("transonic", false);
simple.lookupOrDefault("transonic", false);

View File

@ -7,5 +7,5 @@
pimple.lookupOrDefault<int>("nNonOrthogonalCorrectors", 0);
const bool momentumPredictor =
pimple.lookupOrDefault<bool>("momentumPredictor", true);
pimple.lookupOrDefault("momentumPredictor", true);

View File

@ -10,8 +10,8 @@
piso.lookupOrDefault<int>("nNonOrthogonalCorrectors", 0);
const bool momentumPredictor =
piso.lookupOrDefault<bool>("momentumPredictor", true);
piso.lookupOrDefault("momentumPredictor", true);
const bool transonic =
piso.lookupOrDefault<bool>("transonic", false);
piso.lookupOrDefault("transonic", false);

View File

@ -2,8 +2,8 @@
#include "readPIMPLEControls.H"
const bool correctPhi =
pimple.lookupOrDefault<bool>("correctPhi", false);
pimple.lookupOrDefault("correctPhi", false);
const bool checkMeshCourantNo =
pimple.lookupOrDefault<bool>("checkMeshCourantNo", false);
pimple.lookupOrDefault("checkMeshCourantNo", false);

View File

@ -96,7 +96,7 @@
)
);
if (RASProperties.lookupOrDefault<Switch>("printCoeffs", false))
if (RASProperties.lookupOrDefault("printCoeffs", false))
{
Info<< "kEpsilonCoeffs" << kEpsilonDict << nl
<< "wallFunctionCoeffs" << wallFunctionDict << endl;

View File

@ -20,8 +20,8 @@
}
const bool correctPhi =
piso.lookupOrDefault<bool>("correctPhi", true);
piso.lookupOrDefault("correctPhi", true);
const bool checkMeshCourantNo =
piso.lookupOrDefault<bool>("checkMeshCourantNo", false);
piso.lookupOrDefault("checkMeshCourantNo", false);

View File

@ -2,8 +2,8 @@
# include "readPISOControls.H"
const bool correctPhi =
piso.lookupOrDefault<bool>("correctPhi", true);
piso.lookupOrDefault("correctPhi", true);
const bool checkMeshCourantNo =
piso.lookupOrDefault<bool>("checkMeshCourantNo", false);
piso.lookupOrDefault("checkMeshCourantNo", false);

View File

@ -276,7 +276,7 @@
)
);
if (RASProperties.lookupOrDefault<Switch>("printCoeffs", false))
if (RASProperties.lookupOrDefault("printCoeffs", false))
{
Info<< "kEpsilonCoeffs" << kEpsilonDict << nl
<< "wallFunctionCoeffs" << wallFunctionDict << endl;

View File

@ -102,7 +102,7 @@ int main(int argc, char *argv[])
);
const bool invertSelection =
meshSubsetDict.lookupOrDefault<bool>("invertSelection", false);
meshSubsetDict.lookupOrDefault("invertSelection", false);
// Mark the cells for the subset

View File

@ -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<Switch>("distributed", false))
if (decompDict.lookupOrDefault("distributed", false))
{
fileNameList roots;
decompDict.lookup("roots") >> roots;

View File

@ -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_;

View File

@ -255,7 +255,7 @@ bool Foam::solution::read()
if (dict.found("cache"))
{
cache_ = dict.subDict("cache");
caching_ = cache_.lookupOrDefault<Switch>("active", true);
caching_ = cache_.lookupOrDefault("active", true);
}
if (dict.found("relaxationFactors"))

View File

@ -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_;

View File

@ -10,8 +10,8 @@
pimple.lookupOrDefault<int>("nNonOrthogonalCorrectors", 0);
const bool momentumPredictor =
pimple.lookupOrDefault<bool>("momentumPredictor", true);
pimple.lookupOrDefault("momentumPredictor", true);
const bool transonic =
pimple.lookupOrDefault<bool>("transonic", false);
pimple.lookupOrDefault("transonic", false);

View File

@ -10,8 +10,8 @@
piso.lookupOrDefault<int>("nNonOrthogonalCorrectors", 0);
const bool momentumPredictor =
piso.lookupOrDefault<bool>("momentumPredictor", true);
piso.lookupOrDefault("momentumPredictor", true);
const bool transonic =
piso.lookupOrDefault<bool>("transonic", false);
piso.lookupOrDefault("transonic", false);

View File

@ -4,8 +4,8 @@
simple.lookupOrDefault<int>("nNonOrthogonalCorrectors", 0);
const bool momentumPredictor =
simple.lookupOrDefault<bool>("momentumPredictor", true);
simple.lookupOrDefault("momentumPredictor", true);
const bool transonic =
simple.lookupOrDefault<bool>("transonic", false);
simple.lookupOrDefault("transonic", false);

View File

@ -30,7 +30,7 @@ Description
\*---------------------------------------------------------------------------*/
const bool adjustTimeStep =
runTime.controlDict().lookupOrDefault<bool>("adjustTimeStep", false);
runTime.controlDict().lookupOrDefault("adjustTimeStep", false);
scalar maxCo =
runTime.controlDict().lookupOrDefault<scalar>("maxCo", 1.0);

View File

@ -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<Switch>("degrees", true)
dict.lookupOrDefault("degrees", true)
);
}

View File

@ -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<Switch>("degrees", true)
dict.lookupOrDefault("degrees", true)
);
}

View File

@ -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<Switch>("degrees", true))
inDegrees_(dict.lookupOrDefault("degrees", true))
{}

View File

@ -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<Switch>("degrees", true))
inDegrees_(dict.lookupOrDefault("degrees", true))
{}