mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
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:
@ -1,9 +1,9 @@
|
||||
#include "readTimeControls.H"
|
||||
|
||||
correctPhi = pimple.dict().lookupOrDefault("correctPhi", false);
|
||||
correctPhi = pimple.dict().getOrDefault("correctPhi", false);
|
||||
|
||||
checkMeshCourantNo =
|
||||
pimple.dict().lookupOrDefault("checkMeshCourantNo", false);
|
||||
pimple.dict().getOrDefault("checkMeshCourantNo", false);
|
||||
|
||||
|
||||
ddtCorr = pimple.dict().lookupOrDefault("ddtCorr", true);
|
||||
ddtCorr = pimple.dict().getOrDefault("ddtCorr", true);
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
const dictionary& simple = fluidRegions[i].solutionDict().subDict("SIMPLE");
|
||||
|
||||
const int nNonOrthCorr =
|
||||
simple.lookupOrDefault<int>("nNonOrthogonalCorrectors", 0);
|
||||
simple.getOrDefault<int>("nNonOrthogonalCorrectors", 0);
|
||||
|
||||
const bool momentumPredictor =
|
||||
simple.lookupOrDefault("momentumPredictor", true);
|
||||
simple.getOrDefault("momentumPredictor", true);
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
const dictionary& simple = mesh.solutionDict().subDict("SIMPLE");
|
||||
|
||||
const int nNonOrthCorr =
|
||||
simple.lookupOrDefault<int>("nNonOrthogonalCorrectors", 0);
|
||||
simple.getOrDefault<int>("nNonOrthogonalCorrectors", 0);
|
||||
|
||||
@ -227,11 +227,11 @@ turbulentTemperatureTwoPhaseRadCoupledMixedFvPatchScalarField
|
||||
mixedFvPatchScalarField(p, iF),
|
||||
regionType_(regionTypeNames_.get("region", dict)),
|
||||
method_(KMethodTypeNames_.get("kappaMethod", dict)),
|
||||
kappaName_(dict.lookupOrDefault<word>("kappa", "none")),
|
||||
kappaName_(dict.getOrDefault<word>("kappa", "none")),
|
||||
otherPhaseName_(dict.get<word>("otherPhase")),
|
||||
TnbrName_(dict.lookupOrDefault<word>("Tnbr", "T")),
|
||||
qrNbrName_(dict.lookupOrDefault<word>("qrNbr", "none")),
|
||||
qrName_(dict.lookupOrDefault<word>("qr", "none"))
|
||||
TnbrName_(dict.getOrDefault<word>("Tnbr", "T")),
|
||||
qrNbrName_(dict.getOrDefault<word>("qrNbr", "none")),
|
||||
qrName_(dict.getOrDefault<word>("qr", "none"))
|
||||
{
|
||||
if (!isA<mappedPatchBase>(this->patch().patch()))
|
||||
{
|
||||
|
||||
@ -2,10 +2,10 @@
|
||||
|
||||
Switch faceMomentum
|
||||
(
|
||||
pimpleDict.lookupOrDefault<Switch>("faceMomentum", false)
|
||||
pimpleDict.getOrDefault<Switch>("faceMomentum", false)
|
||||
);
|
||||
|
||||
int nEnergyCorrectors
|
||||
(
|
||||
pimpleDict.lookupOrDefault<int>("nEnergyCorrectors", 1)
|
||||
pimpleDict.getOrDefault<int>("nEnergyCorrectors", 1)
|
||||
);
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
const dictionary& pimple = mesh.solutionDict().subDict("PIMPLE");
|
||||
|
||||
const int nCorr =
|
||||
pimple.lookupOrDefault<int>("nCorrectors", 1);
|
||||
pimple.getOrDefault<int>("nCorrectors", 1);
|
||||
|
||||
const int nNonOrthCorr =
|
||||
pimple.lookupOrDefault<int>("nNonOrthogonalCorrectors", 0);
|
||||
pimple.getOrDefault<int>("nNonOrthogonalCorrectors", 0);
|
||||
|
||||
const bool momentumPredictor =
|
||||
pimple.lookupOrDefault("momentumPredictor", true);
|
||||
pimple.getOrDefault("momentumPredictor", true);
|
||||
|
||||
@ -5,4 +5,4 @@
|
||||
const dictionary& pimple = solutionDict.subDict("PIMPLE");
|
||||
|
||||
const int nOuterCorr =
|
||||
pimple.lookupOrDefault<int>("nOuterCorrectors", 1);
|
||||
pimple.getOrDefault<int>("nOuterCorrectors", 1);
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
const dictionary& pimple = mesh.solutionDict().subDict("PIMPLE");
|
||||
|
||||
int nNonOrthCorr =
|
||||
pimple.lookupOrDefault<int>("nNonOrthogonalCorrectors", 0);
|
||||
pimple.getOrDefault<int>("nNonOrthogonalCorrectors", 0);
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011 OpenFOAM Foundation
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -31,6 +32,6 @@ Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
scalar maxDi = runTime.controlDict().lookupOrDefault<scalar>("maxDi", 10.0);
|
||||
scalar maxDi = runTime.controlDict().getOrDefault<scalar>("maxDi", 10);
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
Reference in New Issue
Block a user