ENH: unify use of dictionary method names

- previously introduced `getOrDefault` as a dictionary _get_ method,
  now complete the transition and use it everywhere instead of
  `lookupOrDefault`. This avoids mixed usage of the two methods that
  are identical in behaviour, makes for shorter names, and promotes
  the distinction between "lookup" access (ie, return a token stream,
  locate and return an entry) and "get" access (ie, the above with
  conversion to concrete types such as scalar, label etc).
This commit is contained in:
Mark Olesen
2020-06-02 16:38:55 +02:00
parent f721b5344f
commit 3e43edf056
624 changed files with 2109 additions and 1954 deletions

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -72,7 +72,7 @@ PDRkEpsilon::PDRkEpsilon
C4_
(
dimensioned<scalar>::lookupOrAddToDict
dimensioned<scalar>::getOrAddToDict
(
"C4",
coeffDict_,

View File

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

View File

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

View File

@ -12,12 +12,12 @@ IOdictionary additionalControlsDict
bool solvePrimaryRegion
(
additionalControlsDict.lookupOrDefault("solvePrimaryRegion", true)
additionalControlsDict.getOrDefault("solvePrimaryRegion", true)
);
bool solvePyrolysisRegion
(
additionalControlsDict.lookupOrDefault("solvePyrolysisRegion", true)
additionalControlsDict.getOrDefault("solvePyrolysisRegion", true)
);
scalar maxDi = pyrolysis.maxDiff();

View File

@ -1,4 +1,4 @@
if (pimple.dict().lookupOrDefault("hydrostaticInitialization", false))
if (pimple.dict().getOrDefault("hydrostaticInitialization", false))
{
volScalarField& ph_rgh = regIOobject::store
(
@ -24,7 +24,7 @@ if (pimple.dict().lookupOrDefault("hydrostaticInitialization", false))
label nCorr
(
pimple.dict().lookupOrDefault<label>("nHydrostaticCorrectors", 5)
pimple.dict().getOrDefault<label>("nHydrostaticCorrectors", 5)
);
for (label i=0; i<nCorr; i++)

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2013-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -34,27 +35,27 @@ License
scalar maxCo(pimpleDict.get<scalar>("maxCo"));
// Maximum time scale
scalar maxDeltaT(pimpleDict.lookupOrDefault<scalar>("maxDeltaT", GREAT));
scalar maxDeltaT(pimpleDict.getOrDefault<scalar>("maxDeltaT", GREAT));
// Smoothing parameter (0-1) when smoothing iterations > 0
scalar rDeltaTSmoothingCoeff
(
pimpleDict.lookupOrDefault<scalar>("rDeltaTSmoothingCoeff", 0.1)
pimpleDict.getOrDefault<scalar>("rDeltaTSmoothingCoeff", 0.1)
);
// Damping coefficient (1-0)
scalar rDeltaTDampingCoeff
(
pimpleDict.lookupOrDefault<scalar>("rDeltaTDampingCoeff", 1.0)
pimpleDict.getOrDefault<scalar>("rDeltaTDampingCoeff", 1.0)
);
// Maximum change in cell temperature per iteration
// (relative to previous value)
scalar alphaTemp(pimpleDict.lookupOrDefault("alphaTemp", 0.05));
scalar alphaTemp(pimpleDict.getOrDefault<scalar>("alphaTemp", 0.05));
// Maximum change in cell concentration per iteration
// (relative to reference value)
scalar alphaY(pimpleDict.lookupOrDefault("alphaY", 1.0));
scalar alphaY(pimpleDict.getOrDefault<scalar>("alphaY", 1.0));
Info<< "Time scales min/max:" << endl;