STYLE: consistent lookupOrDefault template parameters

- in many cases can just use lookupOrDefault("key", bool) instead of
  lookupOrDefault<bool> or lookupOrDefault<Switch> since reading a
  bool from an Istream uses the Switch(Istream&) anyhow

STYLE: relocated Switch string names into file-local scope
This commit is contained in:
Mark Olesen
2018-03-26 09:09:09 +02:00
parent 568fbf727d
commit 36719bf55b
75 changed files with 161 additions and 163 deletions

View File

@ -2,10 +2,10 @@
bool correctPhi
(
pimple.dict().lookupOrDefault<Switch>("correctPhi", true)
pimple.dict().lookupOrDefault("correctPhi", true)
);
bool checkMeshCourantNo
(
pimple.dict().lookupOrDefault<Switch>("checkMeshCourantNo", false)
pimple.dict().lookupOrDefault("checkMeshCourantNo", false)
);

View File

@ -1,6 +1,6 @@
#include "readTimeControls.H"
correctPhi = pimple.dict().lookupOrDefault<Switch>("correctPhi", true);
correctPhi = pimple.dict().lookupOrDefault("correctPhi", true);
checkMeshCourantNo =
pimple.dict().lookupOrDefault<Switch>("checkMeshCourantNo", false);
pimple.dict().lookupOrDefault("checkMeshCourantNo", false);

View File

@ -121,14 +121,14 @@ IOdictionary additionalControlsDict
)
);
Switch solvePrimaryRegion
bool solvePrimaryRegion
(
additionalControlsDict.lookup("solvePrimaryRegion")
additionalControlsDict.lookupOrDefault("solvePrimaryRegion", true)
);
Switch solvePyrolysisRegion
bool solvePyrolysisRegion
(
additionalControlsDict.lookupOrDefault<bool>("solvePyrolysisRegion", true)
additionalControlsDict.lookupOrDefault("solvePyrolysisRegion", true)
);
volScalarField Qdot

View File

@ -1,4 +1,4 @@
if (pimple.dict().lookupOrDefault<bool>("hydrostaticInitialization", false))
if (pimple.dict().lookupOrDefault("hydrostaticInitialization", false))
{
volScalarField& ph_rgh = regIOobject::store
(

View File

@ -17,7 +17,7 @@
const dictionary& eosDict = thermoDict.subDict("equationOfState");
bool local = eosDict.lookupOrDefault<bool>("local", false);
bool local = eosDict.lookupOrDefault("local", false);
// Evolve T as:
//

View File

@ -2,10 +2,10 @@
bool correctPhi
(
pimple.dict().lookupOrDefault<Switch>("correctPhi", true)
pimple.dict().lookupOrDefault("correctPhi", true)
);
bool checkMeshCourantNo
(
pimple.dict().lookupOrDefault<Switch>("checkMeshCourantNo", false)
pimple.dict().lookupOrDefault("checkMeshCourantNo", false)
);

View File

@ -1,6 +1,6 @@
#include "readTimeControls.H"
correctPhi = pimple.dict().lookupOrDefault<Switch>("correctPhi", true);
correctPhi = pimple.dict().lookupOrDefault("correctPhi", true);
checkMeshCourantNo =
pimple.dict().lookupOrDefault<Switch>("checkMeshCourantNo", false);
pimple.dict().lookupOrDefault("checkMeshCourantNo", false);

View File

@ -2,10 +2,10 @@
bool correctPhi
(
pimple.dict().lookupOrDefault<Switch>("correctPhi", true)
pimple.dict().lookupOrDefault("correctPhi", true)
);
bool checkMeshCourantNo
(
pimple.dict().lookupOrDefault<Switch>("checkMeshCourantNo", false)
pimple.dict().lookupOrDefault("checkMeshCourantNo", false)
);

View File

@ -1,6 +1,6 @@
#include "readTimeControls.H"
correctPhi = pimple.dict().lookupOrDefault<Switch>("correctPhi", true);
correctPhi = pimple.dict().lookupOrDefault("correctPhi", true);
checkMeshCourantNo =
pimple.dict().lookupOrDefault<Switch>("checkMeshCourantNo", false);
pimple.dict().lookupOrDefault("checkMeshCourantNo", false);

View File

@ -105,9 +105,9 @@ forAll(Y, i)
}
fields.add(thermo.he());
Switch solvePrimaryRegion
bool solvePrimaryRegion
(
pimple.dict().lookupOrDefault<Switch>("solvePrimaryRegion", true)
pimple.dict().lookupOrDefault("solvePrimaryRegion", true)
);
volScalarField Qdot

View File

@ -1,11 +1,11 @@
#include "createTimeControls.H"
bool correctPhi
(
pimple.dict().lookupOrDefault("correctPhi", true)
);
scalar maxAcousticCo
(
readScalar(runTime.controlDict().lookup("maxAcousticCo"))
);
bool correctPhi
(
pimple.dict().lookupOrDefault<Switch>("correctPhi", true)
);

View File

@ -1,4 +1,4 @@
#include "readTimeControls.H"
correctPhi = pimple.dict().lookupOrDefault("correctPhi", true);
maxAcousticCo = readScalar(runTime.controlDict().lookup("maxAcousticCo"));
correctPhi = pimple.dict().lookupOrDefault<Switch>("correctPhi", true);

View File

@ -2,15 +2,15 @@
bool correctPhi
(
pimple.dict().lookupOrDefault<Switch>("correctPhi", true)
pimple.dict().lookupOrDefault("correctPhi", true)
);
bool checkMeshCourantNo
(
pimple.dict().lookupOrDefault<Switch>("checkMeshCourantNo", false)
pimple.dict().lookupOrDefault("checkMeshCourantNo", false)
);
bool moveMeshOuterCorrectors
(
pimple.dict().lookupOrDefault<Switch>("moveMeshOuterCorrectors", false)
pimple.dict().lookupOrDefault("moveMeshOuterCorrectors", false)
);

View File

@ -1,9 +1,9 @@
#include "readTimeControls.H"
correctPhi = pimple.dict().lookupOrDefault<Switch>("correctPhi", true);
correctPhi = pimple.dict().lookupOrDefault("correctPhi", true);
checkMeshCourantNo =
pimple.dict().lookupOrDefault<Switch>("checkMeshCourantNo", false);
pimple.dict().lookupOrDefault("checkMeshCourantNo", false);
moveMeshOuterCorrectors =
pimple.dict().lookupOrDefault<Switch>("moveMeshOuterCorrectors", false);
pimple.dict().lookupOrDefault("moveMeshOuterCorrectors", false);

View File

@ -4,12 +4,12 @@ label nAlphaCorr(readLabel(alphaControls.lookup("nAlphaCorr")));
label nAlphaSubCycles(readLabel(alphaControls.lookup("nAlphaSubCycles")));
bool MULESCorr(alphaControls.lookupOrDefault<Switch>("MULESCorr", false));
bool MULESCorr(alphaControls.lookupOrDefault("MULESCorr", false));
// Apply the compression correction from the previous iteration
// Improves efficiency for steady-simulations but can only be applied
// once the alpha field is reasonably steady, i.e. fully developed
bool alphaApplyPrevCorr
(
alphaControls.lookupOrDefault<Switch>("alphaApplyPrevCorr", false)
alphaControls.lookupOrDefault("alphaApplyPrevCorr", false)
);

View File

@ -1,14 +1,14 @@
bool correctPhi
(
pimple.dict().lookupOrDefault<Switch>("correctPhi", true)
pimple.dict().lookupOrDefault("correctPhi", true)
);
bool checkMeshCourantNo
(
pimple.dict().lookupOrDefault<Switch>("checkMeshCourantNo", false)
pimple.dict().lookupOrDefault("checkMeshCourantNo", false)
);
bool moveMeshOuterCorrectors
(
pimple.dict().lookupOrDefault<Switch>("moveMeshOuterCorrectors", false)
pimple.dict().lookupOrDefault("moveMeshOuterCorrectors", false)
);

View File

@ -1,9 +1,9 @@
#include "readTimeControls.H"
correctPhi = pimple.dict().lookupOrDefault<Switch>("correctPhi", true);
correctPhi = pimple.dict().lookupOrDefault("correctPhi", true);
checkMeshCourantNo =
pimple.dict().lookupOrDefault<Switch>("checkMeshCourantNo", false);
pimple.dict().lookupOrDefault("checkMeshCourantNo", false);
moveMeshOuterCorrectors =
pimple.dict().lookupOrDefault<Switch>("moveMeshOuterCorrectors", false);
pimple.dict().lookupOrDefault("moveMeshOuterCorrectors", false);

View File

@ -1,16 +1,16 @@
bool correctPhi
(
pimple.dict().lookupOrDefault<Switch>("correctPhi", true)
pimple.dict().lookupOrDefault("correctPhi", true)
);
bool checkMeshCourantNo
(
pimple.dict().lookupOrDefault<Switch>("checkMeshCourantNo", false)
pimple.dict().lookupOrDefault("checkMeshCourantNo", false)
);
bool moveMeshOuterCorrectors
(
pimple.dict().lookupOrDefault<Switch>("moveMeshOuterCorrectors", false)
pimple.dict().lookupOrDefault("moveMeshOuterCorrectors", false)
);

View File

@ -1,12 +1,12 @@
#include "readTimeControls.H"
correctPhi = pimple.dict().lookupOrDefault<Switch>("correctPhi", false);
correctPhi = pimple.dict().lookupOrDefault("correctPhi", false);
checkMeshCourantNo =
pimple.dict().lookupOrDefault<Switch>("checkMeshCourantNo", false);
pimple.dict().lookupOrDefault("checkMeshCourantNo", false);
moveMeshOuterCorrectors =
pimple.dict().lookupOrDefault<Switch>("moveMeshOuterCorrectors", false);
pimple.dict().lookupOrDefault("moveMeshOuterCorrectors", false);
massFluxInterpolation =
pimple.dict().lookupOrDefault("massFluxInterpolation", false);

View File

@ -4,14 +4,14 @@ label nAlphaCorr(readLabel(alphaControls.lookup("nAlphaCorr")));
label nAlphaSubCycles(readLabel(alphaControls.lookup("nAlphaSubCycles")));
bool MULESCorr(alphaControls.lookupOrDefault<Switch>("MULESCorr", false));
bool MULESCorr(alphaControls.lookupOrDefault("MULESCorr", false));
// Apply the compression correction from the previous iteration
// Improves efficiency for steady-simulations but can only be applied
// once the alpha field is reasonably steady, i.e. fully developed
//bool alphaApplyPrevCorr
//(
// alphaControls.lookupOrDefault<Switch>("alphaApplyPrevCorr", false)
// alphaControls.lookupOrDefault("alphaApplyPrevCorr", false)
//);
// Isotropic compression coefficient

View File

@ -62,14 +62,14 @@ int main(int argc, char *argv[])
#include "setInitialDeltaT.H"
}
// Switch faceMomentum
// bool faceMomentum
// (
// pimple.dict().lookupOrDefault<Switch>("faceMomentum", false)
// pimple.dict().lookupOrDefault("faceMomentum", false)
// );
// Switch implicitPhasePressure
// bool implicitPhasePressure
// (
// mesh.solverDict(alpha1.name()).lookupOrDefault<Switch>
// mesh.solverDict(alpha1.name()).lookupOrDefault
// (
// "implicitPhasePressure", false
// )

View File

@ -91,14 +91,14 @@ int main(int argc, char *argv[])
#include "setInitialDeltaT.H"
}
Switch faceMomentum
bool faceMomentum
(
pimple.dict().lookupOrDefault<Switch>("faceMomentum", false)
pimple.dict().lookupOrDefault("faceMomentum", false)
);
Switch implicitPhasePressure
bool implicitPhasePressure
(
mesh.solverDict(alpha1.name()).lookupOrDefault<Switch>
mesh.solverDict(alpha1.name()).lookupOrDefault
(
"implicitPhasePressure", false
)

View File

@ -57,14 +57,14 @@ int main(int argc, char *argv[])
#include "CourantNos.H"
#include "setInitialDeltaT.H"
Switch faceMomentum
bool faceMomentum
(
pimple.dict().lookupOrDefault<Switch>("faceMomentum", false)
pimple.dict().lookupOrDefault("faceMomentum", false)
);
Switch implicitPhasePressure
bool implicitPhasePressure
(
mesh.solverDict(alpha1.name()).lookupOrDefault<Switch>
mesh.solverDict(alpha1.name()).lookupOrDefault
(
"implicitPhasePressure", false
)

View File

@ -183,7 +183,7 @@ int main(int argc, char *argv[])
bool moveMeshOuterCorrectors
(
pimple.dict().lookupOrDefault<Switch>("moveMeshOuterCorrectors", false)
pimple.dict().lookupOrDefault("moveMeshOuterCorrectors", false)
);
while (runTime.loop())

View File

@ -282,10 +282,10 @@ int main(int argc, char *argv[])
const word viewFactorWall("viewFactorWall");
const bool writeViewFactors =
viewFactorDict.lookupOrDefault<bool>("writeViewFactorMatrix", false);
viewFactorDict.lookupOrDefault("writeViewFactorMatrix", false);
const bool dumpRays =
viewFactorDict.lookupOrDefault<bool>("dumpRays", false);
viewFactorDict.lookupOrDefault("dumpRays", false);
const label debug = viewFactorDict.lookupOrDefault<label>("debug", 0);

View File

@ -463,7 +463,7 @@ int main(int argc, char *argv[])
}
// Suboption: "nonManifoldEdges" (false: remove non-manifold edges)
if (!subsetDict.lookupOrDefault<bool>("nonManifoldEdges", true))
if (!subsetDict.lookupOrDefault("nonManifoldEdges", true))
{
Info<< "Removing all non-manifold edges"
<< " (edges with > 2 connected faces) unless they"
@ -478,7 +478,7 @@ int main(int argc, char *argv[])
}
// Suboption: "openEdges" (false: remove open edges)
if (!subsetDict.lookupOrDefault<bool>("openEdges", true))
if (!subsetDict.lookupOrDefault("openEdges", true))
{
Info<< "Removing all open edges"
<< " (edges with 1 connected face)" << endl;
@ -650,7 +650,7 @@ int main(int argc, char *argv[])
}
// Option: "closeness"
if (surfaceDict.lookupOrDefault<bool>("closeness", false))
if (surfaceDict.lookupOrDefault("closeness", false))
{
Pair<tmp<scalarField>> tcloseness =
triSurfaceTools::writeCloseness
@ -697,7 +697,7 @@ int main(int argc, char *argv[])
}
// Option: "curvature"
if (surfaceDict.lookupOrDefault<bool>("curvature", false))
if (surfaceDict.lookupOrDefault("curvature", false))
{
tmp<scalarField> tcurvatureField =
triSurfaceTools::writeCurvature
@ -727,7 +727,7 @@ int main(int argc, char *argv[])
}
// Option: "featureProximity"
if (surfaceDict.lookupOrDefault<bool>("featureProximity", false))
if (surfaceDict.lookupOrDefault("featureProximity", false))
{
tmp<scalarField> tproximity =
edgeMeshTools::writeFeatureProximity

View File

@ -269,7 +269,7 @@ void Foam::Time::setControls()
// Read and set the deltaT only if time-step adjustment is active
// otherwise use the deltaT from the controlDict
if (controlDict_.lookupOrDefault<Switch>("adjustTimeStep", false))
if (controlDict_.lookupOrDefault("adjustTimeStep", false))
{
if (timeDict.readIfPresent("deltaT", deltaT_))
{
@ -358,7 +358,7 @@ void Foam::Time::setMonitoring(const bool forceProfiling)
else if
(
profilingDict
&& profilingDict->lookupOrDefault<bool>("active", true)
&& profilingDict->lookupOrDefault("active", true)
)
{
profiling::initialize

View File

@ -270,17 +270,17 @@ Foam::profiling::profiling
timers_(),
sysInfo_
(
dict.lookupOrDefault<bool>("sysInfo", false)
dict.lookupOrDefault("sysInfo", false)
? new profilingSysInfo() : nullptr
),
cpuInfo_
(
dict.lookupOrDefault<bool>("cpuInfo", false)
dict.lookupOrDefault("cpuInfo", false)
? new cpuInfo() : nullptr
),
memInfo_
(
dict.lookupOrDefault<bool>("memInfo", false)
dict.lookupOrDefault("memInfo", false)
? new memInfo() : nullptr
)
{}

View File

@ -30,7 +30,17 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
const char* Foam::Switch::names[9] =
namespace
{
static_assert
(
Foam::Switch::INVALID+1 == 9,
"Switch::switchType does not have 9 entries"
);
//- The names corresponding to the Switch::switchType enumeration.
// Includes extra entries for "invalid".
static const char* names[9] =
{
"false", "true",
"no", "yes",
@ -39,6 +49,7 @@ const char* Foam::Switch::names[9] =
"invalid"
};
} // End anonymous namespace
// * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * //

View File

@ -92,15 +92,12 @@ private:
//- The logic and enumerated text representation stored in a byte
unsigned char switch_;
//- The set of names corresponding to the switchType enumeration.
// Includes extra entries for "invalid".
static const char* names[9];
// Static Member Functions
//- Return enum value for input string
static switchType parse(const std::string& str, bool allowBad);
public:
// Constructors

View File

@ -139,7 +139,7 @@ const Foam::dictionary& Foam::subModelBase::properties() const
bool Foam::subModelBase::defaultCoeffs(const bool printMsg) const
{
bool def = coeffDict_.lookupOrDefault<bool>("defaultCoeffs", false);
bool def = coeffDict_.lookupOrDefault("defaultCoeffs", false);
if (printMsg && def)
{
Info<< incrIndent;

View File

@ -95,7 +95,7 @@ thermalBaffle1DFvPatchScalarField
mappedPatchBase(p.patch(), NEARESTPATCHFACE, dict),
mixedFvPatchScalarField(p, iF),
TName_("T"),
baffleActivated_(dict.lookupOrDefault<bool>("baffleActivated", true)),
baffleActivated_(dict.lookupOrDefault("baffleActivated", true)),
thickness_(),
qs_(p.size(), 0),
solidDict_(dict),

View File

@ -1225,7 +1225,7 @@ Foam::edgeCollapser::edgeCollapser
),
allowEarlyCollapseToPoint_
(
dict.lookupOrDefault<Switch>("allowEarlyCollapseToPoint", true)
dict.lookupOrDefault("allowEarlyCollapseToPoint", true)
),
allowEarlyCollapseCoeff_
(

View File

@ -93,7 +93,7 @@ private:
//- Allow a face to be collapsed to a point early, before the test
// to collapse to an edge
const Switch allowEarlyCollapseToPoint_;
const bool allowEarlyCollapseToPoint_;
//- Fraction of maxCollapseFaceToPointSideLengthCoeff_ to use when
// allowEarlyCollapseToPoint_ is on

View File

@ -153,7 +153,7 @@ bool Foam::externalFileCoupler::readDict(const dictionary& dict)
dict.lookup("commsDir") >> commsDir_;
commsDir_.expand();
commsDir_.clean();
slaveFirst_ = dict.lookupOrDefault<bool>("initByExternal", false);
slaveFirst_ = dict.lookupOrDefault("initByExternal", false);
Info<< type() << ": initialize" << nl
<< " directory: " << commsDir_ << nl
@ -169,7 +169,7 @@ bool Foam::externalFileCoupler::readDict(const dictionary& dict)
timeOut_ = dict.lookupOrDefault("timeOut", 100*waitInterval_);
log = dict.lookupOrDefault<bool>("log", false);
log = dict.lookupOrDefault("log", false);
return true;
}

View File

@ -4,14 +4,14 @@ label nAlphaCorr(readLabel(alphaControls.lookup("nAlphaCorr")));
label nAlphaSubCycles(readLabel(alphaControls.lookup("nAlphaSubCycles")));
bool MULESCorr(alphaControls.lookupOrDefault<Switch>("MULESCorr", false));
bool MULESCorr(alphaControls.lookupOrDefault("MULESCorr", false));
// Apply the compression correction from the previous iteration
// Improves efficiency for steady-simulations but can only be applied
// once the alpha field is reasonably steady, i.e. fully developed
bool alphaApplyPrevCorr
(
alphaControls.lookupOrDefault<Switch>("alphaApplyPrevCorr", false)
alphaControls.lookupOrDefault("alphaApplyPrevCorr", false)
);
// Isotropic compression coefficient

View File

@ -67,8 +67,8 @@ Foam::fanFvPatchField<Type>::fanFvPatchField
uniformJumpFvPatchField<Type>(p, iF, dict),
phiName_(dict.lookupOrDefault<word>("phi", "phi")),
rhoName_(dict.lookupOrDefault<word>("rho", "rho")),
uniformJump_(dict.lookupOrDefault<bool>("uniformJump", false)),
nonDimensional_(dict.lookupOrDefault<Switch>("nonDimensional", false)),
uniformJump_(dict.lookupOrDefault("uniformJump", false)),
nonDimensional_(dict.lookupOrDefault("nonDimensional", false)),
rpm_(dict.lookupOrDefault<scalar>("rpm", 0.0)),
dm_(dict.lookupOrDefault<scalar>("dm", 0.0))
{

View File

@ -136,7 +136,7 @@ class fanFvPatchField
bool uniformJump_;
//- Swtich for using non-dimensional curve
Switch nonDimensional_;
bool nonDimensional_;
// Parameters for non-dimensional table

View File

@ -96,8 +96,8 @@ Foam::fanFvPatchField<Foam::scalar>::fanFvPatchField
uniformJumpFvPatchField<scalar>(p, iF),
phiName_(dict.lookupOrDefault<word>("phi", "phi")),
rhoName_(dict.lookupOrDefault<word>("rho", "rho")),
uniformJump_(dict.lookupOrDefault<bool>("uniformJump", false)),
nonDimensional_(dict.lookupOrDefault<Switch>("nonDimensional", false)),
uniformJump_(dict.lookupOrDefault("uniformJump", false)),
nonDimensional_(dict.lookupOrDefault("nonDimensional", false)),
rpm_(dict.lookupOrDefault<scalar>("rpm", 0.0)),
dm_(dict.lookupOrDefault<scalar>("dm", 0.0))
{

View File

@ -66,7 +66,7 @@ flowRateOutletVelocityFvPatchVectorField
{
volumetric_ = false;
flowRate_ = Function1<scalar>::New("massFlowRate", dict);
rhoName_ = word(dict.lookupOrDefault<word>("rho", "rho"));
rhoName_ = dict.lookupOrDefault<word>("rho", "rho");
}
else
{

View File

@ -62,7 +62,7 @@ matchedFlowRateOutletVelocityFvPatchVectorField
}
else
{
rhoName_ = word(dict.lookupOrDefault<word>("rho", "rho"));
rhoName_ = dict.lookupOrDefault<word>("rho", "rho");
}
// Value field require if mass based

View File

@ -153,7 +153,7 @@ Foam::swirlFanVelocityFvPatchField::swirlFanVelocityFvPatchField
rpm_(dict.lookupOrDefault<scalar>("rpm", 0.0)),
rEff_(dict.lookupOrDefault<scalar>("rEff", 0.0)),
fanEff_(dict.lookupOrDefault<scalar>("fanEff", 1.0)),
useRealRadius_(dict.lookupOrDefault<Switch>("useRealRadius", false)),
useRealRadius_(dict.lookupOrDefault("useRealRadius", false)),
rInner_(dict.lookupOrDefault<scalar>("rInner", 0.0)),
rOuter_(dict.lookupOrDefault<scalar>("rOuter", 0.0))
{}

View File

@ -140,7 +140,7 @@ class swirlFanVelocityFvPatchField
scalar fanEff_;
//- Switch to use effective radius or inner and outer radius
Switch useRealRadius_;
bool useRealRadius_;
//- Inner radius
scalar rInner_;

View File

@ -856,7 +856,7 @@ turbulentDFSEMInletFvPatchVectorField
curTimeIndex_(-1),
patchBounds_(boundBox::invertedBox),
singleProc_(false),
writeEddies_(dict.lookupOrDefault<bool>("writeEddies", false))
writeEddies_(dict.lookupOrDefault("writeEddies", false))
{
eddy::debug = debug;

View File

@ -82,14 +82,8 @@ Foam::isoAdvection::isoAdvection
nAlphaBounds_(dict_.lookupOrDefault<label>("nAlphaBounds", 3)),
isoFaceTol_(dict_.lookupOrDefault<scalar>("isoFaceTol", 1e-8)),
surfCellTol_(dict_.lookupOrDefault<scalar>("surfCellTol", 1e-8)),
gradAlphaBasedNormal_
(
dict_.lookupOrDefault<bool>("gradAlphaNormal", false)
),
writeIsoFacesToFile_
(
dict_.lookupOrDefault<bool>("writeIsoFaces", false)
),
gradAlphaBasedNormal_(dict_.lookupOrDefault("gradAlphaNormal", false)),
writeIsoFacesToFile_(dict_.lookupOrDefault("writeIsoFaces", false)),
// Cell cutting data
surfCells_(label(0.2*mesh_.nCells())),
@ -1021,8 +1015,7 @@ void Foam::isoAdvection::applyBruteForceBounding()
alpha1Changed = true;
}
bool clip = dict_.lookupOrDefault<bool>("clip", true);
if (clip)
if (dict_.lookupOrDefault("clip", true))
{
alpha1_ = min(scalar(1.0), max(scalar(0.0), alpha1_));
alpha1Changed = true;
@ -1037,7 +1030,7 @@ void Foam::isoAdvection::applyBruteForceBounding()
void Foam::isoAdvection::writeSurfaceCells() const
{
if (dict_.lookupOrDefault<bool>("writeSurfCells", false))
if (dict_.lookupOrDefault("writeSurfCells", false))
{
cellSet cSet
(
@ -1059,7 +1052,7 @@ void Foam::isoAdvection::writeSurfaceCells() const
void Foam::isoAdvection::writeBoundedCells() const
{
if (dict_.lookupOrDefault<bool>("writeBoundedCells", false))
if (dict_.lookupOrDefault("writeBoundedCells", false))
{
cellSet cSet
(

View File

@ -53,7 +53,7 @@ Foam::patchDistMethods::meshWave::meshWave
)
:
patchDistMethod(mesh, patchIDs),
correctWalls_(dict.lookupOrDefault<Switch>("correctWalls", true)),
correctWalls_(dict.lookupOrDefault("correctWalls", true)),
nUnset_(0)
{}

View File

@ -106,7 +106,7 @@ Foam::wallDist::wallDist
dimensionedScalar("y" & patchTypeName_, dimLength, SMALL),
patchDistMethod::patchTypes<scalar>(mesh, patchIDs_)
),
nRequired_(dict_.lookupOrDefault<Switch>("nRequired", false)),
nRequired_(dict_.lookupOrDefault("nRequired", false)),
n_(volVectorField::null()),
updateInterval_(dict_.lookupOrDefault<label>("updateInterval", 1)),
requireUpdate_(true)
@ -160,7 +160,7 @@ Foam::wallDist::wallDist
dimensionedScalar("y" & patchTypeName_, dimLength, SMALL),
patchDistMethod::patchTypes<scalar>(mesh, patchIDs_)
),
nRequired_(dict_.lookupOrDefault<Switch>("nRequired", false)),
nRequired_(dict_.lookupOrDefault("nRequired", false)),
n_(volVectorField::null()),
updateInterval_(dict_.lookupOrDefault<label>("updateInterval", 1)),
requireUpdate_(true)

View File

@ -136,7 +136,7 @@ bool Foam::functionObjects::fieldMinMax::read(const dictionary& dict)
fvMeshFunctionObject::read(dict);
writeFile::read(dict);
location_ = dict.lookupOrDefault<Switch>("location", true);
location_ = dict.lookupOrDefault("location", true);
mode_ = modeTypeNames_.lookupOrDefault("mode", dict, modeType::mdMag);

View File

@ -118,8 +118,8 @@ protected:
//- Mode type names
static const Enum<modeType> modeTypeNames_;
//- Switch to write location of min/max values
Switch location_;
//- Write location of min/max values?
bool location_;
//- Mode for min/max - only applicable for ranks > 0
modeType mode_;

View File

@ -319,7 +319,7 @@ Foam::functionObjects::regionSizeDistribution::regionSizeDistribution
writeFile(obr_, name),
alphaName_(dict.lookup("field")),
patchNames_(dict.lookup("patches")),
isoPlanes_(dict.lookupOrDefault<bool>("isoPlanes", false))
isoPlanes_(dict.lookupOrDefault("isoPlanes", false))
{
read(dict);
}

View File

@ -89,7 +89,7 @@ Foam::functionObjects::runTimePostPro::functionObjectBase::functionObjectBase
fieldVisualisationBase(dict, colours),
state_(state),
functionObjectName_(""),
clearObjects_(dict.lookupOrDefault<bool>("clearObjects", false))
clearObjects_(dict.lookupOrDefault("clearObjects", false))
{
dict.lookup("functionObject") >> functionObjectName_;
}

View File

@ -49,7 +49,7 @@ Foam::functionObjects::runTimePostPro::text::text
size_(readScalar(dict.lookup("size"))),
colour_(nullptr),
bold_(readBool(dict.lookup("bold"))),
timeStamp_(dict.lookupOrDefault<bool>("timeStamp", false))
timeStamp_(dict.lookupOrDefault("timeStamp", false))
{
if (dict.found("colour"))
{

View File

@ -209,7 +209,7 @@ Foam::functionObjects::scalarTransport::scalarTransport
resetOnStartUp_(false),
schemesField_("unknown-schemesField"),
fvOptions_(mesh_),
bounded01_(dict.lookupOrDefault<Switch>("bounded01", true))
bounded01_(dict.lookupOrDefault("bounded01", true))
{
read(dict);

View File

@ -82,7 +82,7 @@ Foam::functionObjects::runTimeControls::runTimeCondition::runTimeCondition
name_(name),
obr_(obr),
state_(state),
active_(dict.lookupOrDefault<bool>("active", true)),
active_(dict.lookupOrDefault("active", true)),
conditionDict_(setConditionDict()),
log_(dict.lookupOrDefault("log", true)),
groupID_(dict.lookupOrDefault("groupID", -1))

View File

@ -70,7 +70,7 @@ bool Foam::functionObjects::vtkWrite::read(const dictionary& dict)
// writer options - default is xml base64
//
writeOpts_ = vtk::formatType::INLINE_BASE64;
if (dict.lookupOrDefault<bool>("legacy", false))
if (dict.lookupOrDefault("legacy", false))
{
writeOpts_.legacy(true);
}
@ -99,7 +99,7 @@ bool Foam::functionObjects::vtkWrite::read(const dictionary& dict)
//
dict.readIfPresent("directory", dirName_);
writeIds_ = dict.lookupOrDefault<bool>("writeIds", false);
writeIds_ = dict.lookupOrDefault("writeIds", false);
//

View File

@ -102,7 +102,7 @@ Foam::fv::interRegionOption::interRegionOption
dict,
mesh
),
master_(coeffs_.lookupOrDefault<bool>("master", true)),
master_(coeffs_.lookupOrDefault("master", true)),
nbrRegionName_(coeffs_.lookup("nbrRegion")),
meshInterpPtr_()
{

View File

@ -224,7 +224,7 @@ void Foam::targetCoeffTrim::read(const dictionary& dict)
trimModel::read(dict);
const dictionary& targetDict(coeffs_.subDict("target"));
useCoeffs_ = targetDict.lookupOrDefault<bool>("useCoeffs", true);
useCoeffs_ = targetDict.lookupOrDefault("useCoeffs", true);
word ext = "";
if (useCoeffs_)
{

View File

@ -140,7 +140,7 @@ Foam::CloudToVTK<CloudType>::CloudToVTK
)
:
CloudFunctionObject<CloudType>(dict, owner, modelName, typeName),
binary_(dict.lookupOrDefault<bool>("binary", true))
binary_(dict.lookupOrDefault("binary", true))
{}

View File

@ -39,7 +39,7 @@ namespace Foam
Foam::blockMesh::blockMesh(const IOdictionary& dict, const word& regionName)
:
meshDict_(dict),
verboseOutput(meshDict_.lookupOrDefault<Switch>("verbose", true)),
verboseOutput(meshDict_.lookupOrDefault("verbose", true)),
geometry_
(
IOobject
@ -65,9 +65,7 @@ Foam::blockMesh::blockMesh(const IOdictionary& dict, const word& regionName)
vertices_(Foam::vertices(blockVertices_)),
topologyPtr_(createTopology(meshDict_, regionName))
{
Switch fastMerge(meshDict_.lookupOrDefault<Switch>("fastMerge", false));
if (fastMerge)
if (meshDict_.lookupOrDefault("fastMerge", false))
{
calcMergeInfoFast();
}

View File

@ -58,7 +58,7 @@ Foam::refinementParameters::refinementParameters(const dictionary& dict)
allowFreeStandingZoneFaces_(dict.lookup("allowFreeStandingZoneFaces")),
useTopologicalSnapDetection_
(
dict.lookupOrDefault<bool>("useTopologicalSnapDetection", true)
dict.lookupOrDefault("useTopologicalSnapDetection", true)
),
maxLoadUnbalance_(dict.lookupOrDefault<scalar>("maxLoadUnbalance", 0)),
handleSnapProblems_

View File

@ -538,7 +538,7 @@ Foam::cyclicAMIPolyPatch::cyclicAMIPolyPatch
)
)
),
AMIReverse_(dict.lookupOrDefault<bool>("flipNormals", false)),
AMIReverse_(dict.lookupOrDefault("flipNormals", false)),
AMIRequireMatch_(true),
AMILowWeightCorrection_(dict.lookupOrDefault("lowWeightCorrection", -1.0)),
surfPtr_(nullptr),

View File

@ -1037,7 +1037,7 @@ Foam::mappedPatchBase::mappedPatchBase
sameRegion_(sampleRegion_ == patch_.boundaryMesh().mesh().name()),
mapPtr_(nullptr),
AMIPtr_(nullptr),
AMIReverse_(dict.lookupOrDefault<bool>("flipNormals", false)),
AMIReverse_(dict.lookupOrDefault("flipNormals", false)),
surfPtr_(nullptr),
surfDict_(dict.subOrEmptyDict("surface"))
{
@ -1119,7 +1119,7 @@ Foam::mappedPatchBase::mappedPatchBase
sameRegion_(sampleRegion_ == patch_.boundaryMesh().mesh().name()),
mapPtr_(nullptr),
AMIPtr_(nullptr),
AMIReverse_(dict.lookupOrDefault<bool>("flipNormals", false)),
AMIReverse_(dict.lookupOrDefault("flipNormals", false)),
surfPtr_(nullptr),
surfDict_(dict.subOrEmptyDict("surface"))
{

View File

@ -151,7 +151,7 @@ Foam::regionCoupledBase::regionCoupledBase
nbrRegionName_(dict.lookup("neighbourRegion")),
sameRegion_(nbrRegionName_ == patch_.boundaryMesh().mesh().name()),
AMIPtr_(nullptr),
AMIReverse_(dict.lookupOrDefault<bool>("flipNormals", false)),
AMIReverse_(dict.lookupOrDefault("flipNormals", false)),
surfPtr_(nullptr),
surfDict_(dict.subOrEmptyDict("surface"))
{}

View File

@ -431,7 +431,7 @@ Foam::surfaceToCell::surfaceToCell
includeOutside_(readBool(dict.lookup("includeOutside"))),
useSurfaceOrientation_
(
dict.lookupOrDefault<bool>("useSurfaceOrientation", false)
dict.lookupOrDefault("useSurfaceOrientation", false)
),
nearDist_(readScalar(dict.lookup("nearDistance"))),
curvature_(readScalar(dict.lookup("curvature"))),

View File

@ -55,10 +55,10 @@ void reactingOneDim::readReactingOneDimControls()
solution.lookup("nNonOrthCorr") >> nNonOrthCorr_;
time().controlDict().lookup("maxDi") >> maxDiff_;
coeffs().lookup("minimumDelta") >> minimumDelta_;
gasHSource_ = coeffs().lookupOrDefault<bool>("gasHSource", false);
gasHSource_ = coeffs().lookupOrDefault("gasHSource", false);
coeffs().lookup("qrHSource") >> qrHSource_;
useChemistrySolvers_ =
coeffs().lookupOrDefault<bool>("useChemistrySolvers", true);
coeffs().lookupOrDefault("useChemistrySolvers", true);
}

View File

@ -50,9 +50,9 @@ BrunDrippingInjection::BrunDrippingInjection
)
:
injectionModel(type(), film, dict),
ubarStar_(coeffDict_.lookupOrDefault("ubarStar", 1.62208)),
dCoeff_(coeffDict_.lookupOrDefault("dCoeff", 3.3)),
deltaStable_(coeffDict_.lookupOrDefault("deltaStable", scalar(0))),
ubarStar_(coeffDict_.lookupOrDefault<scalar>("ubarStar", 1.62208)),
dCoeff_(coeffDict_.lookupOrDefault<scalar>("dCoeff", 3.3)),
deltaStable_(coeffDict_.lookupOrDefault<scalar>("deltaStable", 0)),
diameter_(film.regionMesh().nCells(), -1.0)
{}

View File

@ -201,7 +201,7 @@ thermalBaffleModel::thermalBaffleModel
thickness_(),
delta_("delta", dimLength, 0.0),
oneD_(false),
constantThickness_(dict.lookupOrDefault<bool>("constantThickness", true))
constantThickness_(dict.lookupOrDefault("constantThickness", true))
{
init();
}
@ -217,7 +217,7 @@ thermalBaffleModel::thermalBaffleModel
thickness_(),
delta_("delta", dimLength, 0.0),
oneD_(false),
constantThickness_(lookupOrDefault<bool>("constantThickness", true))
constantThickness_(lookupOrDefault("constantThickness", true))
{
init();
}

View File

@ -95,7 +95,7 @@ Foam::SloanRenumber::SloanRenumber(const dictionary& renumberDict)
renumberDict.optionalSubDict
(
typeName + "Coeffs"
).lookupOrDefault<Switch>("reverse", false)
).lookupOrDefault("reverse", false)
)
{}

View File

@ -53,7 +53,7 @@ class SloanRenumber
{
// Private data
const Switch reverse_;
const bool reverse_;
// Private Member Functions
@ -76,8 +76,7 @@ public:
//- Destructor
virtual ~SloanRenumber()
{}
virtual ~SloanRenumber() = default;
// Member Functions

View File

@ -53,7 +53,7 @@ Foam::CuthillMcKeeRenumber::CuthillMcKeeRenumber(const dictionary& renumberDict)
renumberDict.optionalSubDict
(
typeName + "Coeffs"
).lookupOrDefault<Switch>("reverse", false)
).lookupOrDefault("reverse", false)
)
{}

View File

@ -51,7 +51,7 @@ class CuthillMcKeeRenumber
{
// Private data
const Switch reverse_;
const bool reverse_;
// Private Member Functions

View File

@ -688,7 +688,7 @@ Foam::sampledTriSurfaceMesh::sampledTriSurfaceMesh
),
sampleSource_(samplingSourceNames_.lookup("source", dict)),
needsUpdate_(true),
keepIds_(dict.lookupOrDefault<Switch>("keepIds", false)),
keepIds_(dict.lookupOrDefault("keepIds", false)),
originalIds_(),
zoneIds_(),
sampleElements_(0),

View File

@ -671,7 +671,7 @@ Foam::discreteSurface::discreteSurface
interpolate_
(
allowInterpolate
&& dict.lookupOrDefault<Switch>("interpolate", false)
&& dict.lookupOrDefault("interpolate", false)
),
surface_
(
@ -688,7 +688,7 @@ Foam::discreteSurface::discreteSurface
),
sampleSource_(samplingSourceNames_.lookup("source", dict)),
needsUpdate_(true),
keepIds_(dict.lookupOrDefault<Switch>("keepIds", false)),
keepIds_(dict.lookupOrDefault("keepIds", false)),
originalIds_(),
zoneIds_(),
sampleElements_(0),

View File

@ -79,7 +79,7 @@ greyDiffusiveRadiationMixedFvPatchScalarField
:
mixedFvPatchScalarField(p, iF),
TName_(dict.lookupOrDefault<word>("T", "T")),
solarLoad_(dict.lookupOrDefault<bool>("solarLoad", false))
solarLoad_(dict.lookupOrDefault("solarLoad", false))
{
if (dict.found("refValue"))
{

View File

@ -69,7 +69,7 @@ greyDiffusiveViewFactorFixedValueFvPatchScalarField
:
fixedValueFvPatchScalarField(p, iF, dict, false),
qro_("qro", dict, p.size()),
solarLoad_(dict.lookupOrDefault<bool>("solarLoad", false))
solarLoad_(dict.lookupOrDefault("solarLoad", false))
{
if (dict.found("value"))
{