ENH: avoid readScalar, readLabel etc from dictionary (#762, #1033)

- use the dictionary 'get' methods instead of readScalar for
  additional checking

     Unchecked:  readScalar(dict.lookup("key"));
     Checked:    dict.get<scalar>("key");

- In templated classes that also inherit from a dictionary, an additional
  'template' keyword will be required. Eg,

     this->coeffsDict().template get<scalar>("key");

  For this common use case, the predefined getXXX shortcuts may be
  useful. Eg,

     this->coeffsDict().getScalar("key");
This commit is contained in:
Mark Olesen
2018-10-12 08:14:47 +02:00
parent 990d00d40d
commit 8eddcc072a
335 changed files with 1007 additions and 1127 deletions

View File

@ -49,7 +49,7 @@ Foam::XiGModels::basicSubGrid::basicSubGrid
) )
: :
XiGModel(XiGProperties, thermo, turbulence, Su), XiGModel(XiGProperties, thermo, turbulence, Su),
k1(readScalar(XiGModelCoeffs_.lookup("k1"))), k1(XiGModelCoeffs_.get<scalar>("k1")),
XiGModel_(XiGModel::New(XiGModelCoeffs_, thermo, turbulence, Su)) XiGModel_(XiGModel::New(XiGModelCoeffs_, thermo, turbulence, Su))
{} {}

View File

@ -49,13 +49,10 @@ Foam::XiEqModels::Gulder::Gulder
) )
: :
XiEqModel(XiEqProperties, thermo, turbulence, Su), XiEqModel(XiEqProperties, thermo, turbulence, Su),
XiEqCoef_(readScalar(XiEqModelCoeffs_.lookup("XiEqCoef"))), XiEqCoef_(XiEqModelCoeffs_.get<scalar>("XiEqCoef")),
SuMin_(0.01*Su.average()), SuMin_(0.01*Su.average()),
uPrimeCoef_(readScalar(XiEqModelCoeffs_.lookup("uPrimeCoef"))), uPrimeCoef_(XiEqModelCoeffs_.get<scalar>("uPrimeCoef")),
subGridSchelkin_ subGridSchelkin_(XiEqModelCoeffs_.get<bool>("subGridSchelkin"))
(
readBool(XiEqModelCoeffs_.lookup("subGridSchelkin"))
)
{} {}

View File

@ -49,15 +49,12 @@ Foam::XiEqModels::SCOPEXiEq::SCOPEXiEq
) )
: :
XiEqModel(XiEqProperties, thermo, turbulence, Su), XiEqModel(XiEqProperties, thermo, turbulence, Su),
XiEqCoef_(readScalar(XiEqModelCoeffs_.lookup("XiEqCoef"))), XiEqCoef_(XiEqModelCoeffs_.get<scalar>("XiEqCoef")),
XiEqExp_(readScalar(XiEqModelCoeffs_.lookup("XiEqExp"))), XiEqExp_(XiEqModelCoeffs_.get<scalar>("XiEqExp")),
lCoef_(readScalar(XiEqModelCoeffs_.lookup("lCoef"))), lCoef_(XiEqModelCoeffs_.get<scalar>("lCoef")),
SuMin_(0.01*Su.average()), SuMin_(0.01*Su.average()),
uPrimeCoef_(readScalar(XiEqModelCoeffs_.lookup("uPrimeCoef"))), uPrimeCoef_(XiEqModelCoeffs_.get<scalar>("uPrimeCoef")),
subGridSchelkin_ subGridSchelkin_(XiEqModelCoeffs_.get<bool>("subGridSchelkin")),
(
readBool(XiEqModelCoeffs_.lookup("subGridSchelkin"))
),
MaModel MaModel
( (
Su.mesh().lookupObject<IOdictionary>("combustionProperties"), Su.mesh().lookupObject<IOdictionary>("combustionProperties"),

View File

@ -49,7 +49,7 @@ Foam::XiEqModels::instability::instability
) )
: :
XiEqModel(XiEqProperties, thermo, turbulence, Su), XiEqModel(XiEqProperties, thermo, turbulence, Su),
XiEqIn(readScalar(XiEqModelCoeffs_.lookup("XiEqIn"))), XiEqIn(XiEqModelCoeffs_.get<scalar>("XiEqIn")),
XiEqModel_(XiEqModel::New(XiEqModelCoeffs_, thermo, turbulence, Su)) XiEqModel_(XiEqModel::New(XiEqModelCoeffs_, thermo, turbulence, Su))
{} {}

View File

@ -49,7 +49,7 @@ Foam::XiGModels::KTS::KTS
) )
: :
XiGModel(XiGProperties, thermo, turbulence, Su), XiGModel(XiGProperties, thermo, turbulence, Su),
GEtaCoef_(readScalar(XiGModelCoeffs_.lookup("GEtaCoef"))) GEtaCoef_(XiGModelCoeffs_.get<scalar>("GEtaCoef"))
{} {}

View File

@ -52,7 +52,7 @@ Foam::XiModels::algebraic::algebraic
) )
: :
XiModel(XiProperties, thermo, turbulence, Su, rho, b, phi), XiModel(XiProperties, thermo, turbulence, Su, rho, b, phi),
XiShapeCoef(readScalar(XiModelCoeffs_.lookup("XiShapeCoef"))), XiShapeCoef(XiModelCoeffs_.get<scalar>("XiShapeCoef")),
XiEqModel_(XiEqModel::New(XiProperties, thermo, turbulence, Su)), XiEqModel_(XiEqModel::New(XiProperties, thermo, turbulence, Su)),
XiGModel_(XiGModel::New(XiProperties, thermo, turbulence, Su)) XiGModel_(XiGModel::New(XiProperties, thermo, turbulence, Su))
{} {}

View File

@ -57,7 +57,7 @@ Foam::XiModels::transport::transport
) )
: :
XiModel(XiProperties, thermo, turbulence, Su, rho, b, phi), XiModel(XiProperties, thermo, turbulence, Su, rho, b, phi),
XiShapeCoef(readScalar(XiModelCoeffs_.lookup("XiShapeCoef"))), XiShapeCoef(XiModelCoeffs_.get<scalar>("XiShapeCoef")),
XiEqModel_(XiEqModel::New(XiProperties, thermo, turbulence, Su)), XiEqModel_(XiEqModel::New(XiProperties, thermo, turbulence, Su)),
XiGModel_(XiGModel::New(XiProperties, thermo, turbulence, Su)) XiGModel_(XiGModel::New(XiProperties, thermo, turbulence, Su))
{} {}

View File

@ -53,8 +53,8 @@ Foam::laminarFlameSpeedModels::SCOPE::polynomial::polynomial
) )
: :
FixedList<scalar, 7>(polyDict.lookup("coefficients")), FixedList<scalar, 7>(polyDict.lookup("coefficients")),
ll(readScalar(polyDict.lookup("lowerLimit"))), ll(polyDict.get<scalar>("lowerLimit")),
ul(readScalar(polyDict.lookup("upperLimit"))), ul(polyDict.get<scalar>("upperLimit")),
llv(polyPhi(ll, *this)), llv(polyPhi(ll, *this)),
ulv(polyPhi(ul, *this)), ulv(polyPhi(ul, *this)),
lu(0) lu(0)
@ -75,39 +75,30 @@ Foam::laminarFlameSpeedModels::SCOPE::SCOPE
( (
IFstream IFstream
( (
fileName dict.get<fileName>("fuelFile")
(
dict.lookup("fuelFile")
)
)() )()
).optionalSubDict(typeName + "Coeffs") ).optionalSubDict(typeName + "Coeffs")
), ),
LFL_ LFL_
( (
readScalar coeffsDict_.getCompat<scalar>
( (
coeffsDict_.lookupCompat "lowerFlammabilityLimit",
( {{"lowerFlamabilityLimit", 1712}}
"lowerFlammabilityLimit",
{{"lowerFlamabilityLimit", 1712}}
)
) )
), ),
UFL_ UFL_
( (
readScalar coeffsDict_.getCompat<scalar>
( (
coeffsDict_.lookupCompat "upperFlammabilityLimit",
( {{"upperFlamabilityLimit", 1712}}
"upperFlammabilityLimit",
{{"upperFlamabilityLimit", 1712}}
)
) )
), ),
SuPolyL_(coeffsDict_.subDict("lowerSuPolynomial")), SuPolyL_(coeffsDict_.subDict("lowerSuPolynomial")),
SuPolyU_(coeffsDict_.subDict("upperSuPolynomial")), SuPolyU_(coeffsDict_.subDict("upperSuPolynomial")),
Texp_(readScalar(coeffsDict_.lookup("Texp"))), Texp_(coeffsDict_.get<scalar>("Texp")),
pexp_(readScalar(coeffsDict_.lookup("pexp"))), pexp_(coeffsDict_.get<scalar>("pexp")),
MaPolyL_(coeffsDict_.subDict("lowerMaPolynomial")), MaPolyL_(coeffsDict_.subDict("lowerMaPolynomial")),
MaPolyU_(coeffsDict_.subDict("upperMaPolynomial")) MaPolyU_(coeffsDict_.subDict("upperMaPolynomial"))
{ {

View File

@ -18,8 +18,8 @@
) )
); );
scalar p0 = readScalar(initialConditions.lookup("p")); scalar p0 = initialConditions.get<scalar>("p");
scalar T0 = readScalar(initialConditions.lookup("T")); scalar T0 = initialConditions.get<scalar>("T");
#include "createBaseFields.H" #include "createBaseFields.H"

View File

@ -40,7 +40,7 @@
const word& name = Y[i].name(); const word& name = Y[i].name();
if (fractions.found(name)) if (fractions.found(name))
{ {
X0[i] = readScalar(fractions.lookup(name)); X0[i] = fractions.get<scalar>(name);
} }
} }
@ -64,7 +64,7 @@
const word& name = Y[i].name(); const word& name = Y[i].name();
if (fractions.found(name)) if (fractions.found(name))
{ {
Y0[i] = readScalar(fractions.lookup(name)); Y0[i] = fractions.get<scalar>(name);
} }
} }

View File

@ -29,7 +29,7 @@ License
const dictionary& pimpleDict = pimple.dict(); const dictionary& pimpleDict = pimple.dict();
// Maximum flow Courant number // Maximum flow Courant number
scalar maxCo(readScalar(pimpleDict.lookup("maxCo"))); scalar maxCo(pimpleDict.get<scalar>("maxCo"));
// Maximum time scale // Maximum time scale
scalar maxDeltaT(pimpleDict.lookupOrDefault<scalar>("maxDeltaT", GREAT)); scalar maxDeltaT(pimpleDict.lookupOrDefault<scalar>("maxDeltaT", GREAT));
@ -118,7 +118,7 @@ License
if (Yref.found(Yi.name())) if (Yref.found(Yi.name()))
{ {
foundY = true; foundY = true;
scalar Yrefi = readScalar(Yref.lookup(Yi.name())); const scalar Yrefi = Yref.get<scalar>(Yi.name());
rDeltaTY.field() = max rDeltaTY.field() = max
( (

View File

@ -84,7 +84,7 @@ Foam::smoluchowskiJumpTFvPatchScalarField::smoluchowskiJumpTFvPatchScalarField
rhoName_(dict.lookupOrDefault<word>("rho", "rho")), rhoName_(dict.lookupOrDefault<word>("rho", "rho")),
psiName_(dict.lookupOrDefault<word>("psi", "thermo:psi")), psiName_(dict.lookupOrDefault<word>("psi", "thermo:psi")),
muName_(dict.lookupOrDefault<word>("mu", "thermo:mu")), muName_(dict.lookupOrDefault<word>("mu", "thermo:mu")),
accommodationCoeff_(readScalar(dict.lookup("accommodationCoeff"))), accommodationCoeff_(dict.get<scalar>("accommodationCoeff")),
Twall_("Twall", dict, p.size()), Twall_("Twall", dict, p.size()),
gamma_(dict.lookupOrDefault<scalar>("gamma", 1.4)) gamma_(dict.lookupOrDefault<scalar>("gamma", 1.4))
{ {

View File

@ -85,7 +85,7 @@ Foam::maxwellSlipUFvPatchVectorField::maxwellSlipUFvPatchVectorField
psiName_(dict.lookupOrDefault<word>("psi", "thermo:psi")), psiName_(dict.lookupOrDefault<word>("psi", "thermo:psi")),
muName_(dict.lookupOrDefault<word>("mu", "thermo:mu")), muName_(dict.lookupOrDefault<word>("mu", "thermo:mu")),
tauMCName_(dict.lookupOrDefault<word>("tauMC", "tauMC")), tauMCName_(dict.lookupOrDefault<word>("tauMC", "tauMC")),
accommodationCoeff_(readScalar(dict.lookup("accommodationCoeff"))), accommodationCoeff_(dict.get<scalar>("accommodationCoeff")),
Uwall_("Uwall", dict, p.size()), Uwall_("Uwall", dict, p.size()),
thermalCreep_(dict.lookupOrDefault("thermalCreep", true)), thermalCreep_(dict.lookupOrDefault("thermalCreep", true)),
curvature_(dict.lookupOrDefault("curvature", true)) curvature_(dict.lookupOrDefault("curvature", true))

View File

@ -25,8 +25,8 @@
if (!local) if (!local)
{ {
const scalar T0 = readScalar(eosDict.lookup("T0")); const scalar T0 = eosDict.get<scalar>("T0");
const scalar p0 = readScalar(eosDict.lookup("p0")); const scalar p0 = eosDict.get<scalar>("p0");
he = thermo.he(p, pow(p/p0, (gamma - scalar(1))/gamma)*T0); he = thermo.he(p, pow(p/p0, (gamma - scalar(1))/gamma)*T0);
} }

View File

@ -12,7 +12,7 @@ IOdictionary mdEquilibrationDict
) )
); );
scalar targetTemperature = readScalar scalar targetTemperature
( (
mdEquilibrationDict.lookup("targetTemperature") mdEquilibrationDict.get<scalar>("targetTemperature")
); );

View File

@ -139,10 +139,9 @@ basicKinematicTypeCloud kinematicCloud
scalar alphacMin scalar alphacMin
( (
1.0 1.0
- readScalar - (
(
kinematicCloud.particleProperties().subDict("constantProperties") kinematicCloud.particleProperties().subDict("constantProperties")
.lookup("alphaMax") .get<scalar>("alphaMax")
) )
); );

View File

@ -29,7 +29,7 @@ License
const dictionary& pimpleDict = pimple.dict(); const dictionary& pimpleDict = pimple.dict();
// Maximum flow Courant number // Maximum flow Courant number
scalar maxCo(readScalar(pimpleDict.lookup("maxCo"))); scalar maxCo(pimpleDict.get<scalar>("maxCo"));
// Maximum time scale // Maximum time scale
scalar maxDeltaT(pimpleDict.lookupOrDefault<scalar>("maxDeltaT", GREAT)); scalar maxDeltaT(pimpleDict.lookupOrDefault<scalar>("maxDeltaT", GREAT));

View File

@ -29,7 +29,7 @@ License
const dictionary& pimpleDict = pimple.dict(); const dictionary& pimpleDict = pimple.dict();
// Maximum flow Courant number // Maximum flow Courant number
scalar maxCo(readScalar(pimpleDict.lookup("maxCo"))); scalar maxCo(pimpleDict.get<scalar>("maxCo"));
// Maximum time scale // Maximum time scale
scalar maxDeltaT(pimpleDict.lookupOrDefault<scalar>("maxDeltaT", GREAT)); scalar maxDeltaT(pimpleDict.lookupOrDefault<scalar>("maxDeltaT", GREAT));

View File

@ -160,10 +160,9 @@ basicKinematicMPPICCloud kinematicCloud
scalar alphacMin scalar alphacMin
( (
1.0 1.0
- readScalar - (
(
kinematicCloud.particleProperties().subDict("constantProperties") kinematicCloud.particleProperties().subDict("constantProperties")
.lookup("alphaMax") .get<scalar>("alphaMax")
) )
); );

View File

@ -31,7 +31,7 @@ Description
scalar maxAlphaCo scalar maxAlphaCo
( (
readScalar(runTime.controlDict().lookup("maxAlphaCo")) runTime.controlDict().get<scalar>("maxAlphaCo")
); );
scalar alphaCoNum = 0.0; scalar alphaCoNum = 0.0;

View File

@ -2,5 +2,5 @@
scalar maxAcousticCo scalar maxAcousticCo
( (
readScalar(runTime.controlDict().lookup("maxAcousticCo")) runTime.controlDict().get<scalar>("maxAcousticCo")
); );

View File

@ -70,10 +70,10 @@
// Remove the swirl component of velocity for "wedge" cases // Remove the swirl component of velocity for "wedge" cases
if (pimple.dict().found("removeSwirl")) if (pimple.dict().found("removeSwirl"))
{ {
label swirlCmpt(readLabel(pimple.dict().lookup("removeSwirl"))); label swirlCmpt(pimple.dict().get<label>("removeSwirl"));
Info<< "Removing swirl component-" << swirlCmpt << " of U" << endl; Info<< "Removing swirl component-" << swirlCmpt << " of U" << endl;
U.field().replace(swirlCmpt, 0.0); U.field().replace(swirlCmpt, Zero);
} }
U.correctBoundaryConditions(); U.correctBoundaryConditions();

View File

@ -2,5 +2,5 @@
scalar maxAcousticCo scalar maxAcousticCo
( (
readScalar(runTime.controlDict().lookup("maxAcousticCo")) runTime.controlDict().get<scalar>("maxAcousticCo")
); );

View File

@ -73,10 +73,10 @@
// Remove the swirl component of velocity for "wedge" cases // Remove the swirl component of velocity for "wedge" cases
if (pimple.dict().found("removeSwirl")) if (pimple.dict().found("removeSwirl"))
{ {
label swirlCmpt(readLabel(pimple.dict().lookup("removeSwirl"))); label swirlCmpt(pimple.dict().get<label>("removeSwirl"));
Info<< "Removing swirl component-" << swirlCmpt << " of U" << endl; Info<< "Removing swirl component-" << swirlCmpt << " of U" << endl;
U.field().replace(swirlCmpt, 0.0); U.field().replace(swirlCmpt, Zero);
} }
U.correctBoundaryConditions(); U.correctBoundaryConditions();

View File

@ -763,8 +763,8 @@ void Foam::multiphaseMixtureThermo::solve()
const Time& runTime = mesh_.time(); const Time& runTime = mesh_.time();
const dictionary& alphaControls = mesh_.solverDict("alpha"); const dictionary& alphaControls = mesh_.solverDict("alpha");
label nAlphaSubCycles(readLabel(alphaControls.lookup("nAlphaSubCycles"))); label nAlphaSubCycles(alphaControls.get<label>("nAlphaSubCycles"));
scalar cAlpha(readScalar(alphaControls.lookup("cAlpha"))); scalar cAlpha(alphaControls.get<scalar>("cAlpha"));
volScalarField& alpha = phases_.first(); volScalarField& alpha = phases_.first();

View File

@ -1,8 +1,8 @@
const dictionary& alphaControls = mesh.solverDict(alpha1.name()); const dictionary& alphaControls = mesh.solverDict(alpha1.name());
label nAlphaCorr(readLabel(alphaControls.lookup("nAlphaCorr"))); label nAlphaCorr(alphaControls.get<label>("nAlphaCorr"));
label nAlphaSubCycles(readLabel(alphaControls.lookup("nAlphaSubCycles"))); label nAlphaSubCycles(alphaControls.get<label>("nAlphaSubCycles"));
bool MULESCorr(alphaControls.lookupOrDefault("MULESCorr", false)); bool MULESCorr(alphaControls.lookupOrDefault("MULESCorr", false));

View File

@ -31,7 +31,7 @@ Description
scalar maxAlphaCo scalar maxAlphaCo
( (
readScalar(runTime.controlDict().lookup("maxAlphaCo")) runTime.controlDict().get<scalar>("maxAlphaCo")
); );
scalar maxAlphaDdt scalar maxAlphaDdt

View File

@ -198,7 +198,7 @@ void Foam::radiation::laserDTRM::initialise()
{ {
case pdGaussian: case pdGaussian:
{ {
sigma_ = readScalar(lookup("sigma")); sigma_ = get<scalar>("sigma");
break; break;
} }
case pdManual: case pdManual:
@ -325,8 +325,8 @@ Foam::radiation::laserDTRM::laserDTRM(const volScalarField& T)
mode_(powerDistNames_.lookup("mode", *this)), mode_(powerDistNames_.lookup("mode", *this)),
DTRMCloud_(mesh_, "DTRMCloud", IDLList<DTRMParticle>()), DTRMCloud_(mesh_, "DTRMCloud", IDLList<DTRMParticle>()),
nParticles_(0), nParticles_(0),
ndTheta_(readLabel(lookup("nTheta"))), ndTheta_(get<label>("nTheta")),
ndr_(readLabel(lookup("nr"))), ndr_(get<label>("nr")),
maxTrackLength_(mesh_.bounds().mag()), maxTrackLength_(mesh_.bounds().mag()),
focalLaserPosition_ focalLaserPosition_
@ -339,7 +339,7 @@ Foam::radiation::laserDTRM::laserDTRM(const volScalarField& T)
Function1<vector>::New("laserDirection", *this) Function1<vector>::New("laserDirection", *this)
), ),
focalLaserRadius_(readScalar(lookup("focalLaserRadius"))), focalLaserRadius_(get<scalar>("focalLaserRadius")),
qualityBeamLaser_ qualityBeamLaser_
( (
lookupOrDefault<scalar>("qualityBeamLaser", 0.0) lookupOrDefault<scalar>("qualityBeamLaser", 0.0)
@ -435,8 +435,8 @@ Foam::radiation::laserDTRM::laserDTRM
mode_(powerDistNames_.lookup("mode", *this)), mode_(powerDistNames_.lookup("mode", *this)),
DTRMCloud_(mesh_, "DTRMCloud", IDLList<DTRMParticle>()), DTRMCloud_(mesh_, "DTRMCloud", IDLList<DTRMParticle>()),
nParticles_(0), nParticles_(0),
ndTheta_(readLabel(lookup("nTheta"))), ndTheta_(get<label>("nTheta")),
ndr_(readLabel(lookup("nr"))), ndr_(get<label>("nr")),
maxTrackLength_(mesh_.bounds().mag()), maxTrackLength_(mesh_.bounds().mag()),
focalLaserPosition_ focalLaserPosition_
@ -448,7 +448,7 @@ Foam::radiation::laserDTRM::laserDTRM
Function1<vector>::New("laserDirection", *this) Function1<vector>::New("laserDirection", *this)
), ),
focalLaserRadius_(readScalar(lookup("focalLaserRadius"))), focalLaserRadius_(get<scalar>("focalLaserRadius")),
qualityBeamLaser_ qualityBeamLaser_
( (
lookupOrDefault<scalar>("qualityBeamLaser", 0.0) lookupOrDefault<scalar>("qualityBeamLaser", 0.0)

View File

@ -53,7 +53,7 @@ Foam::radiation::FresnelLaser::FresnelLaser
) )
: :
reflectionModel(dict, mesh), reflectionModel(dict, mesh),
epsilon_(readScalar(dict.lookup("epsilon"))) epsilon_(dict.get<scalar>("epsilon"))
{} {}

View File

@ -53,8 +53,8 @@ Foam::porousModels::VollerPrakash::VollerPrakash
) )
: :
porousModel(dict, mesh), porousModel(dict, mesh),
Cu_(readScalar(dict.lookup("Cu"))), Cu_(dict.get<scalar>("Cu")),
solidPhase_(dict.lookup("solidPhase")) solidPhase_(dict.get<word>("solidPhase"))
{} {}

View File

@ -191,7 +191,7 @@ void Foam::MultiComponentPhaseModel<BasePhaseModel, phaseThermo>::solveYi
const dictionary& MULEScontrols = mesh.solverDict(alpha1.name()); const dictionary& MULEScontrols = mesh.solverDict(alpha1.name());
scalar cAlpha(readScalar(MULEScontrols.lookup("cYi"))); scalar cAlpha(MULEScontrols.get<scalar>("cYi"));
PtrList<surfaceScalarField> phiYiCorrs(species_.size()); PtrList<surfaceScalarField> phiYiCorrs(species_.size());
const surfaceScalarField& phi = this->fluid().phi(); const surfaceScalarField& phi = this->fluid().phi();

View File

@ -269,8 +269,8 @@ void Foam::multiphaseSystem::solve()
const fvMesh& mesh = this->mesh(); const fvMesh& mesh = this->mesh();
const dictionary& alphaControls = mesh.solverDict("alpha"); const dictionary& alphaControls = mesh.solverDict("alpha");
label nAlphaSubCycles(readLabel(alphaControls.lookup("nAlphaSubCycles"))); label nAlphaSubCycles(alphaControls.get<label>("nAlphaSubCycles"));
label nAlphaCorr(readLabel(alphaControls.lookup("nAlphaCorr"))); label nAlphaCorr(alphaControls.get<label>("nAlphaCorr"));
mesh.solverDict("alpha").readEntry("cAlphas", cAlphas_); mesh.solverDict("alpha").readEntry("cAlphas", cAlphas_);
// Reset ddtAlphaMax // Reset ddtAlphaMax

View File

@ -50,10 +50,7 @@ Foam::temperaturePhaseChangeTwoPhaseMixture::New
const word modelType const word modelType
( (
phaseChangePropertiesDict.lookup phaseChangePropertiesDict.get<word>("phaseChangeTwoPhaseModel")
(
"phaseChangeTwoPhaseModel"
)
); );
Info<< "Selecting phaseChange model " << modelType << endl; Info<< "Selecting phaseChange model " << modelType << endl;

View File

@ -1,5 +1,5 @@
const dictionary& alphaControls = mesh.solverDict(alpha1.name()); const dictionary& alphaControls = mesh.solverDict(alpha1.name());
label nAlphaCorr(readLabel(alphaControls.lookup("nAlphaCorr"))); label nAlphaCorr(alphaControls.get<label>("nAlphaCorr"));
label nAlphaSubCycles(readLabel(alphaControls.lookup("nAlphaSubCycles"))); label nAlphaSubCycles(alphaControls.get<label>("nAlphaSubCycles"));

View File

@ -155,13 +155,10 @@ Foam::threePhaseInterfaceProperties::threePhaseInterfaceProperties
mixture_(mixture), mixture_(mixture),
cAlpha_ cAlpha_
( (
readScalar mixture.U().mesh().solverDict
( (
mixture.U().mesh().solverDict mixture_.alpha1().name()
( ).get<scalar>("cAlpha")
mixture_.alpha1().name()
).lookup("cAlpha")
)
), ),
sigma12_("sigma12", dimensionSet(1, 0, -2, 0, 0), mixture), sigma12_("sigma12", dimensionSet(1, 0, -2, 0, 0), mixture),
sigma13_("sigma13", dimensionSet(1, 0, -2, 0, 0), mixture), sigma13_("sigma13", dimensionSet(1, 0, -2, 0, 0), mixture),

View File

@ -31,7 +31,7 @@ Description
scalar maxAlphaCo scalar maxAlphaCo
( (
readScalar(runTime.controlDict().lookup("maxAlphaCo")) runTime.controlDict().get<scalar>("maxAlphaCo")
); );
scalar alphaCoNum = 0.0; scalar alphaCoNum = 0.0;

View File

@ -1,3 +1,3 @@
const dictionary& alphaControls = mesh.solverDict(alpha1.name()); const dictionary& alphaControls = mesh.solverDict(alpha1.name());
label nAlphaSubCycles(readLabel(alphaControls.lookup("nAlphaSubCycles"))); label nAlphaSubCycles(alphaControls.get<label>("nAlphaSubCycles"));

View File

@ -31,7 +31,7 @@ Description
scalar maxAlphaCo scalar maxAlphaCo
( (
readScalar(runTime.controlDict().lookup("maxAlphaCo")) runTime.controlDict().get<scalar>("maxAlphaCo")
); );
scalar alphaCoNum = 0.0; scalar alphaCoNum = 0.0;

View File

@ -1,8 +1,8 @@
const dictionary& alphaControls = mesh.solverDict(alpha1.name()); const dictionary& alphaControls = mesh.solverDict(alpha1.name());
label nAlphaCorr(readLabel(alphaControls.lookup("nAlphaCorr"))); label nAlphaCorr(alphaControls.get<label>("nAlphaCorr"));
label nAlphaSubCycles(readLabel(alphaControls.lookup("nAlphaSubCycles"))); label nAlphaSubCycles(alphaControls.get<label>("nAlphaSubCycles"));
bool MULESCorr(alphaControls.lookupOrDefault("MULESCorr", false)); bool MULESCorr(alphaControls.lookupOrDefault("MULESCorr", false));

View File

@ -844,7 +844,7 @@ void Foam::multiphaseSystem::solve()
const Time& runTime = mesh_.time(); const Time& runTime = mesh_.time();
const dictionary& alphaControls = mesh_.solverDict("alpha"); const dictionary& alphaControls = mesh_.solverDict("alpha");
label nAlphaSubCycles(readLabel(alphaControls.lookup("nAlphaSubCycles"))); label nAlphaSubCycles(alphaControls.get<label>("nAlphaSubCycles"));
if (nAlphaSubCycles > 1) if (nAlphaSubCycles > 1)
{ {

View File

@ -311,8 +311,8 @@ void Foam::multiphaseMixture::solve()
volScalarField& alpha = phases_.first(); volScalarField& alpha = phases_.first();
const dictionary& alphaControls = mesh_.solverDict("alpha"); const dictionary& alphaControls = mesh_.solverDict("alpha");
label nAlphaSubCycles(readLabel(alphaControls.lookup("nAlphaSubCycles"))); label nAlphaSubCycles(alphaControls.get<label>("nAlphaSubCycles"));
scalar cAlpha(readScalar(alphaControls.lookup("cAlpha"))); scalar cAlpha(alphaControls.get<scalar>("cAlpha"));
if (nAlphaSubCycles > 1) if (nAlphaSubCycles > 1)
{ {

View File

@ -55,7 +55,7 @@ Foam::wallLubricationModels::Frank::Frank
wallLubricationModel(dict, pair), wallLubricationModel(dict, pair),
Cwd_("Cwd", dimless, dict), Cwd_("Cwd", dimless, dict),
Cwc_("Cwc", dimless, dict), Cwc_("Cwc", dimless, dict),
p_(readScalar(dict.lookup("p"))) p_(dict.get<scalar>("p"))
{} {}

View File

@ -606,7 +606,7 @@ void Foam::multiphaseSystem::solve()
const Time& runTime = mesh_.time(); const Time& runTime = mesh_.time();
const dictionary& alphaControls = mesh_.solverDict("alpha"); const dictionary& alphaControls = mesh_.solverDict("alpha");
label nAlphaSubCycles(readLabel(alphaControls.lookup("nAlphaSubCycles"))); label nAlphaSubCycles(alphaControls.get<label>("nAlphaSubCycles"));
bool LTS = fv::localEulerDdt::enabled(mesh_); bool LTS = fv::localEulerDdt::enabled(mesh_);

View File

@ -60,7 +60,7 @@ KocamustafaogullariIshii::KocamustafaogullariIshii
) )
: :
departureDiameterModel(), departureDiameterModel(),
phi_(readScalar(dict.lookup("phi"))) phi_(dict.get<scalar>("phi"))
{} {}

View File

@ -52,7 +52,7 @@ Foam::wallBoilingModels::partitioningModels::
Lavieville::Lavieville(const dictionary& dict) Lavieville::Lavieville(const dictionary& dict)
: :
partitioningModel(), partitioningModel(),
alphaCrit_(readScalar(dict.lookup("alphaCrit"))) alphaCrit_(dict.get<scalar>("alphaCrit"))
{} {}

View File

@ -52,8 +52,8 @@ Foam::wallBoilingModels::partitioningModels::
cosine::cosine(const dictionary& dict) cosine::cosine(const dictionary& dict)
: :
partitioningModel(), partitioningModel(),
alphaLiquid1_(readScalar(dict.lookup("alphaLiquid1"))), alphaLiquid1_(dict.get<scalar>("alphaLiquid1")),
alphaLiquid0_(readScalar(dict.lookup("alphaLiquid0"))) alphaLiquid0_(dict.get<scalar>("alphaLiquid0"))
{} {}

View File

@ -52,8 +52,8 @@ Foam::wallBoilingModels::partitioningModels::
linear::linear(const dictionary& dict) linear::linear(const dictionary& dict)
: :
partitioningModel(), partitioningModel(),
alphaLiquid1_(readScalar(dict.lookup("alphaLiquid1"))), alphaLiquid1_(dict.get<scalar>("alphaLiquid1")),
alphaLiquid0_(readScalar(dict.lookup("alphaLiquid0"))) alphaLiquid0_(dict.get<scalar>("alphaLiquid0"))
{} {}

View File

@ -57,9 +57,9 @@ Foam::RASModels::phasePressureModel::phasePressureModel
phase_(phase), phase_(phase),
alphaMax_(readScalar(coeffDict_.lookup("alphaMax"))), alphaMax_(coeffDict_.get<scalar>("alphaMax")),
preAlphaExp_(readScalar(coeffDict_.lookup("preAlphaExp"))), preAlphaExp_(coeffDict_.get<scalar>("preAlphaExp")),
expMax_(readScalar(coeffDict_.lookup("expMax"))), expMax_(coeffDict_.get<scalar>("expMax")),
g0_ g0_
( (
"g0", "g0",

View File

@ -193,8 +193,8 @@ void Foam::twoPhaseSystem::solve()
const dictionary& alphaControls = mesh_.solverDict(alpha1.name()); const dictionary& alphaControls = mesh_.solverDict(alpha1.name());
label nAlphaSubCycles(readLabel(alphaControls.lookup("nAlphaSubCycles"))); label nAlphaSubCycles(alphaControls.get<label>("nAlphaSubCycles"));
label nAlphaCorr(readLabel(alphaControls.lookup("nAlphaCorr"))); label nAlphaCorr(alphaControls.get<label>("nAlphaCorr"));
bool LTS = fv::localEulerDdt::enabled(mesh_); bool LTS = fv::localEulerDdt::enabled(mesh_);

View File

@ -1,3 +1,3 @@
const dictionary& alphaControls = mesh.solverDict(alpha1.name()); const dictionary& alphaControls = mesh.solverDict(alpha1.name());
label nAlphaSubCycles(readLabel(alphaControls.lookup("nAlphaSubCycles"))); label nAlphaSubCycles(alphaControls.get<label>("nAlphaSubCycles"));

View File

@ -31,7 +31,7 @@ Description
scalar maxAlphaCo scalar maxAlphaCo
( (
readScalar(runTime.controlDict().lookup("maxAlphaCo")) runTime.controlDict().get<scalar>("maxAlphaCo")
); );
scalar alphaCoNum = 0.0; scalar alphaCoNum = 0.0;

View File

@ -55,7 +55,7 @@ Foam::wallLubricationModels::Frank::Frank
wallLubricationModel(dict, pair), wallLubricationModel(dict, pair),
Cwd_("Cwd", dimless, dict), Cwd_("Cwd", dimless, dict),
Cwc_("Cwc", dimless, dict), Cwc_("Cwc", dimless, dict),
p_(readScalar(dict.lookup("p"))) p_(dict.get<scalar>("p"))
{} {}

View File

@ -60,9 +60,9 @@ Foam::RASModels::phasePressureModel::phasePressureModel
phase_(phase), phase_(phase),
alphaMax_(readScalar(coeffDict_.lookup("alphaMax"))), alphaMax_(coeffDict_.get<scalar>("alphaMax")),
preAlphaExp_(readScalar(coeffDict_.lookup("preAlphaExp"))), preAlphaExp_(coeffDict_.get<scalar>("preAlphaExp")),
expMax_(readScalar(coeffDict_.lookup("expMax"))), expMax_(coeffDict_.get<scalar>("expMax")),
g0_ g0_
( (
"g0", "g0",

View File

@ -360,8 +360,8 @@ void Foam::twoPhaseSystem::solve()
alpha1.name() alpha1.name()
); );
label nAlphaSubCycles(readLabel(alphaControls.lookup("nAlphaSubCycles"))); label nAlphaSubCycles(alphaControls.get<label>("nAlphaSubCycles"));
label nAlphaCorr(readLabel(alphaControls.lookup("nAlphaCorr"))); label nAlphaCorr(alphaControls.get<label>("nAlphaCorr"));
word alphaScheme("div(phi," + alpha1.name() + ')'); word alphaScheme("div(phi," + alpha1.name() + ')');
word alpharScheme("div(phir," + alpha1.name() + ')'); word alpharScheme("div(phir," + alpha1.name() + ')');

View File

@ -13,7 +13,7 @@
); );
const dictionary& rhoDict(mechanicalProperties.subDict("rho")); const dictionary& rhoDict(mechanicalProperties.subDict("rho"));
word rhoType(rhoDict.lookup("type")); word rhoType(rhoDict.get<word>("type"));
autoPtr<volScalarField> rhoPtr; autoPtr<volScalarField> rhoPtr;
@ -28,7 +28,7 @@
if (rhoType == "uniform") if (rhoType == "uniform")
{ {
scalar rhoValue(readScalar(rhoDict.lookup("value"))); scalar rhoValue(rhoDict.get<scalar>("value"));
rhoPtr.reset rhoPtr.reset
( (
@ -68,7 +68,7 @@
volScalarField& rho = rhoPtr(); volScalarField& rho = rhoPtr();
const dictionary& EDict(mechanicalProperties.subDict("E")); const dictionary& EDict(mechanicalProperties.subDict("E"));
word EType(EDict.lookup("type")); word EType(EDict.get<word>("type"));
autoPtr<volScalarField> EPtr; autoPtr<volScalarField> EPtr;
@ -83,7 +83,7 @@
if (EType == "uniform") if (EType == "uniform")
{ {
scalar rhoEValue(readScalar(EDict.lookup("value"))); scalar rhoEValue(EDict.get<scalar>("value"));
EPtr.reset EPtr.reset
( (
@ -134,11 +134,11 @@
); );
const dictionary& nuDict(mechanicalProperties.subDict("nu")); const dictionary& nuDict(mechanicalProperties.subDict("nu"));
word nuType(nuDict.lookup("type")); word nuType(nuDict.get<word>("type"));
if (nuType == "uniform") if (nuType == "uniform")
{ {
scalar nuValue(readScalar(nuDict.lookup("value"))); scalar nuValue(nuDict.get<scalar>("value"));
nuPtr.reset nuPtr.reset
( (
new volScalarField new volScalarField

View File

@ -58,10 +58,10 @@ if (thermalStress)
); );
const dictionary& CDict(thermalProperties.subDict("C")); const dictionary& CDict(thermalProperties.subDict("C"));
word CType(CDict.lookup("type")); word CType(CDict.get<word>("type"));
if (CType == "uniform") if (CType == "uniform")
{ {
scalar CValue(readScalar(CDict.lookup("value"))); scalar CValue(CDict.get<scalar>("value"));
CPtr.reset CPtr.reset
( (
@ -113,10 +113,10 @@ if (thermalStress)
); );
const dictionary& kDict(thermalProperties.subDict("k")); const dictionary& kDict(thermalProperties.subDict("k"));
word kType(kDict.lookup("type")); word kType(kDict.get<word>("type"));
if (kType == "uniform") if (kType == "uniform")
{ {
scalar rhoKValue(readScalar(kDict.lookup("value"))); scalar rhoKValue(kDict.get<scalar>("value"));
rhoKPtr.reset rhoKPtr.reset
( (
@ -169,11 +169,11 @@ if (thermalStress)
const dictionary& alphaDict(thermalProperties.subDict("alpha")); const dictionary& alphaDict(thermalProperties.subDict("alpha"));
word alphaType(alphaDict.lookup("type")); word alphaType(alphaDict.get<word>("type"));
if (alphaType == "uniform") if (alphaType == "uniform")
{ {
scalar alphaValue(readScalar(alphaDict.lookup("value"))); scalar alphaValue(alphaDict.get<scalar>("value"));
alphaPtr.reset alphaPtr.reset
( (
new volScalarField new volScalarField

View File

@ -1 +1 @@
scalar accFac(readScalar(stressControl.lookup("accelerationFactor"))); scalar accFac(stressControl.get<scalar>("accelerationFactor"));

View File

@ -120,8 +120,8 @@ int main(int argc, char *argv[])
) )
); );
scalar x0 = readScalar(function1Properties.lookup("x0")); scalar x0 = function1Properties.get<scalar>("x0");
scalar x1 = readScalar(function1Properties.lookup("x1")); scalar x1 = function1Properties.get<scalar>("x1");
Info<< "Data entry type: " << function1().type() << nl << endl; Info<< "Data entry type: " << function1().type() << nl << endl;

View File

@ -55,7 +55,7 @@ int main(int argc, char *argv[])
// Create the pendulumAndSpring model from dictionary // Create the pendulumAndSpring model from dictionary
rigidBodyMotion pendulumAndSpring(runTime, pendulumAndSpringDict); rigidBodyMotion pendulumAndSpring(runTime, pendulumAndSpringDict);
label nIter(readLabel(pendulumAndSpringDict.lookup("nIter"))); label nIter(pendulumAndSpringDict.get<label>("nIter"));
Info<< pendulumAndSpring << endl; Info<< pendulumAndSpring << endl;
Info<< "// Joint state " << endl; Info<< "// Joint state " << endl;

View File

@ -54,7 +54,7 @@ int main(int argc, char *argv[])
// Create the sphericalJoint model from dictionary // Create the sphericalJoint model from dictionary
rigidBodyMotion sphericalJoint(runTime, sphericalJointDict); rigidBodyMotion sphericalJoint(runTime, sphericalJointDict);
label nIter(readLabel(sphericalJointDict.lookup("nIter"))); label nIter(sphericalJointDict.get<label>("nIter"));
Info<< sphericalJoint << endl; Info<< sphericalJoint << endl;

View File

@ -49,7 +49,7 @@ int main(int argc, char *argv[])
// Create the spring model from dictionary // Create the spring model from dictionary
rigidBodyMotion spring(springDict); rigidBodyMotion spring(springDict);
label nIter(readLabel(springDict.lookup("nIter"))); label nIter(springDict.get<label>("nIter"));
Info<< spring << endl; Info<< spring << endl;

View File

@ -751,7 +751,7 @@ Foam::conformalVoronoiMesh::createPolyMeshFromPoints
forAll(patches, p) forAll(patches, p)
{ {
label totalPatchSize = patchDicts[p].get<label>("nFaces"); const label totalPatchSize = patchDicts[p].get<label>("nFaces");
if if
( (

View File

@ -816,7 +816,7 @@ void Foam::conformalVoronoiMesh::writeMesh
forAll(patches, p) forAll(patches, p)
{ {
label totalPatchSize = patchDicts[p].get<label>("nFaces"); const label totalPatchSize = patchDicts[p].get<label>("nFaces");
if if
( (

View File

@ -73,7 +73,7 @@ CONSTRUCT
) )
: :
PARENT(p, iF), PARENT(p, iF),
scalarData_(readScalar(dict.lookup("scalarData"))), scalarData_(dict.get<scalar>("scalarData")),
data_(pTraits<TYPE>(dict.lookup("data"))), data_(pTraits<TYPE>(dict.lookup("data"))),
fieldData_("fieldData", dict, p.size()), fieldData_("fieldData", dict, p.size()),
timeVsData_(Function1<TYPE>::New("timeVsData", dict)), timeVsData_(Function1<TYPE>::New("timeVsData", dict)),

View File

@ -85,6 +85,7 @@ SeeAlso
#ifndef dictionary_H #ifndef dictionary_H
#define dictionary_H #define dictionary_H
#include <type_traits>
#include "entry.H" #include "entry.H"
#include "IDLList.H" #include "IDLList.H"
#include "DLList.H" #include "DLList.H"
@ -93,7 +94,10 @@ SeeAlso
#include "HashTable.H" #include "HashTable.H"
#include "wordList.H" #include "wordList.H"
#include "className.H" #include "className.H"
#include <type_traits>
// Some common data types
#include "label.H"
#include "scalar.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -450,7 +454,7 @@ public:
virtual ~dictionary(); virtual ~dictionary();
// Member functions // Member Functions
// Access // Access
@ -1146,6 +1150,30 @@ public:
//- Write dictionary to Ostream //- Write dictionary to Ostream
friend Ostream& operator<<(Ostream& os, const dictionary& dict); friend Ostream& operator<<(Ostream& os, const dictionary& dict);
// Shortcuts - may be more useable in templated code
#undef defineDictionaryGetter
#define defineDictionaryGetter(Func,Type) \
/** Same as get\<Type\> */ \
Type Func \
( \
const word& keyword, \
bool recursive = false, \
bool patternMatch = true \
) const \
{ \
return get<Type>(keyword, recursive, patternMatch); \
}
defineDictionaryGetter(getBool, bool);
defineDictionaryGetter(getLabel, label);
defineDictionaryGetter(getScalar, scalar);
defineDictionaryGetter(getWord, word);
defineDictionaryGetter(getFileName, fileName);
#undef defineDictionaryGetter
}; };

View File

@ -1217,7 +1217,7 @@ void Foam::argList::parse
dictionary decompDict(decompDictStream); dictionary decompDict(decompDictStream);
dictNProcs = decompDict.get<label>("numberOfSubdomains"); decompDict.readEntry("numberOfSubdomains", dictNProcs);
if (decompDict.lookupOrDefault("distributed", false)) if (decompDict.lookupOrDefault("distributed", false))
{ {

View File

@ -158,19 +158,19 @@ void Foam::interpolationLookUpTable<Type>::dimensionTable()
forAll(entries_,i) forAll(entries_,i)
{ {
dim_[i] = readLabel(entries_[i].lookup("N")); dim_[i] = entries_[i].get<label>("N");
max_[i] = readScalar(entries_[i].lookup("max")); max_[i] = entries_[i].get<scalar>("max");
min_[i] = readScalar(entries_[i].lookup("min")); min_[i] = entries_[i].get<scalar>("min");
delta_[i] = (max_[i] - min_[i])/dim_[i]; delta_[i] = (max_[i] - min_[i])/dim_[i];
tableDim *= dim_[i] + 1; tableDim *= dim_[i] + 1;
fieldIndices_.insert(entries_[i].lookup("name"), index); fieldIndices_.insert(entries_[i].get<word>("name"), index);
entryIndices_[i] = index; entryIndices_[i] = index;
index++; index++;
} }
forAll(output_,i) forAll(output_,i)
{ {
fieldIndices_.insert(output_[i].lookup("name"), index); fieldIndices_.insert(output_[i].get<word>("name"), index);
outputIndices_[i] = index; outputIndices_[i] = index;
index++; index++;
} }
@ -284,7 +284,7 @@ Foam::interpolationLookUpTable<Type>::interpolationLookUpTable
) )
: :
List<scalarField>(), List<scalarField>(),
fileName_(fileName(dict.lookup("file")).expand()), fileName_(dict.get<fileName>("file").expand()),
dim_(0), dim_(0),
min_(0.0), min_(0.0),
delta_(0.0), delta_(0.0),

View File

@ -33,10 +33,10 @@ template<class Type>
Foam::csvTableReader<Type>::csvTableReader(const dictionary& dict) Foam::csvTableReader<Type>::csvTableReader(const dictionary& dict)
: :
tableReader<Type>(dict), tableReader<Type>(dict),
headerLine_(readBool(dict.lookup("hasHeaderLine"))), headerLine_(dict.get<bool>("hasHeaderLine")),
timeColumn_(readLabel(dict.lookup("timeColumn"))), timeColumn_(dict.get<label>("timeColumn")),
componentColumns_(dict.lookup("valueColumns")), componentColumns_(dict.lookup("valueColumns")),
separator_(dict.lookupOrDefault<string>("separator", string(","))[0]) separator_(dict.lookupOrDefault<string>("separator", ",")[0])
{ {
if (componentColumns_.size() != pTraits<Type>::nComponents) if (componentColumns_.size() != pTraits<Type>::nComponents)
{ {

View File

@ -94,14 +94,14 @@ Foam::uniformInterpolationTable<Type>::uniformInterpolationTable
false // if used in BCs, could be used by multiple patches false // if used in BCs, could be used by multiple patches
), ),
List<scalar>(2, 0.0), List<scalar>(2, 0.0),
x0_(readScalar(dict.lookup("x0"))), x0_(dict.get<scalar>("x0")),
dx_(readScalar(dict.lookup("dx"))), dx_(dict.get<scalar>("dx")),
log10_(dict.lookupOrDefault<Switch>("log10", false)), log10_(dict.lookupOrDefault<Switch>("log10", false)),
bound_(dict.lookupOrDefault<Switch>("bound", false)) bound_(dict.lookupOrDefault<Switch>("bound", false))
{ {
if (initialiseOnly) if (initialiseOnly)
{ {
const scalar xMax = readScalar(dict.lookup("xMax")); const scalar xMax = dict.get<scalar>("xMax");
const label nIntervals = static_cast<label>(xMax - x0_)/dx_ + 1; const label nIntervals = static_cast<label>(xMax - x0_)/dx_ + 1;
this->setSize(nIntervals); this->setSize(nIntervals);
} }

View File

@ -50,7 +50,7 @@ Foam::dummyAgglomeration::dummyAgglomeration
) )
: :
GAMGAgglomeration(mesh, controlDict), GAMGAgglomeration(mesh, controlDict),
nLevels_(readLabel(controlDict.lookup("nLevels"))) nLevels_(controlDict.get<label>("nLevels"))
{ {
const label nCoarseCells = mesh.lduAddr().size(); const label nCoarseCells = mesh.lduAddr().size();

View File

@ -223,7 +223,7 @@ Foam::procFacesGAMGProcAgglomeration::procFacesGAMGProcAgglomeration
) )
: :
GAMGProcAgglomeration(agglom, controlDict), GAMGProcAgglomeration(agglom, controlDict),
nAgglomeratingCells_(readLabel(controlDict.lookup("nAgglomeratingCells"))) nAgglomeratingCells_(controlDict.get<label>("nAgglomeratingCells"))
{} {}

View File

@ -74,7 +74,7 @@ void Foam::solution::read(const dictionary& dict)
forAll(entryNames, i) forAll(entryNames, i)
{ {
const word& e = entryNames[i]; const word& e = entryNames[i];
scalar value = readScalar(relaxDict.lookup(e)); scalar value = relaxDict.get<scalar>(e);
if (e.startsWith("p")) if (e.startsWith("p"))
{ {
@ -274,7 +274,7 @@ Foam::scalar Foam::solution::fieldRelaxationFactor(const word& name) const
if (fieldRelaxDict_.found(name)) if (fieldRelaxDict_.found(name))
{ {
return readScalar(fieldRelaxDict_.lookup(name)); return fieldRelaxDict_.get<scalar>(name);
} }
else if (fieldRelaxDefault_ > SMALL) else if (fieldRelaxDefault_ > SMALL)
{ {
@ -303,7 +303,7 @@ Foam::scalar Foam::solution::equationRelaxationFactor(const word& name) const
if (eqnRelaxDict_.found(name)) if (eqnRelaxDict_.found(name))
{ {
return readScalar(eqnRelaxDict_.lookup(name)); return eqnRelaxDict_.get<scalar>(name);
} }
else if (eqnRelaxDefault_ > SMALL) else if (eqnRelaxDefault_ > SMALL)
{ {
@ -327,12 +327,10 @@ const Foam::dictionary& Foam::solution::solutionDict() const
{ {
if (found("select")) if (found("select"))
{ {
return subDict(word(lookup("select"))); return subDict(get<word>("select"));
}
else
{
return *this;
} }
return *this;
} }
@ -366,10 +364,8 @@ bool Foam::solution::read()
return true; return true;
} }
else
{ return false;
return false;
}
} }

View File

@ -93,13 +93,13 @@ bool Foam::tolerances::relax(const word& name) const
Foam::scalar Foam::tolerances::relaxationFactor(const word& name) const Foam::scalar Foam::tolerances::relaxationFactor(const word& name) const
{ {
return readScalar(relaxationFactors_.lookup(name)); return relaxationFactors_.get<scalar>(name);
} }
Foam::scalar Foam::tolerances::solverTolerance(const word& name) const Foam::scalar Foam::tolerances::solverTolerance(const word& name) const
{ {
return readScalar(solverTolerances_.lookup(name)); return solverTolerances_.get<scalar>(name);
} }
@ -111,7 +111,7 @@ bool Foam::tolerances::solverRelativeTolerances() const
Foam::scalar Foam::tolerances::solverRelativeTolerance(const word& name) const Foam::scalar Foam::tolerances::solverRelativeTolerance(const word& name) const
{ {
return readScalar(solverRelativeTolerances_.lookup(name)); return solverRelativeTolerances_.get<scalar>(name);
} }

View File

@ -109,8 +109,8 @@ Foam::processorPolyPatch::processorPolyPatch
) )
: :
coupledPolyPatch(name, dict, index, bm, patchType), coupledPolyPatch(name, dict, index, bm, patchType),
myProcNo_(readLabel(dict.lookup("myProcNo"))), myProcNo_(dict.get<label>("myProcNo")),
neighbProcNo_(readLabel(dict.lookup("neighbProcNo"))), neighbProcNo_(dict.get<label>("neighbProcNo")),
neighbFaceCentres_(), neighbFaceCentres_(),
neighbFaceAreas_(), neighbFaceAreas_(),
neighbFaceCellCentres_() neighbFaceCellCentres_()

View File

@ -146,12 +146,12 @@ Foam::polyPatch::polyPatch
faceSubList faceSubList
( (
bm.mesh().faces(), bm.mesh().faces(),
readLabel(dict.lookup("nFaces")), dict.get<label>("nFaces"),
readLabel(dict.lookup("startFace")) dict.get<label>("startFace")
), ),
bm.mesh().points() bm.mesh().points()
), ),
start_(readLabel(dict.lookup("startFace"))), start_(dict.get<label>("startFace")),
boundaryMesh_(bm), boundaryMesh_(bm),
faceCellsPtr_(nullptr), faceCellsPtr_(nullptr),
mePtr_(nullptr) mePtr_(nullptr)

View File

@ -209,12 +209,12 @@ Foam::Function1Types::CSV<Type>::CSV
) )
: :
TableBase<Type>(entryName, dict), TableBase<Type>(entryName, dict),
nHeaderLine_(readLabel(dict.lookup("nHeaderLine"))), nHeaderLine_(dict.get<label>("nHeaderLine")),
refColumn_(readLabel(dict.lookup("refColumn"))), refColumn_(dict.get<label>("refColumn")),
componentColumns_(dict.lookup("componentColumns")), componentColumns_(dict.lookup("componentColumns")),
separator_(dict.lookupOrDefault<string>("separator", string(","))[0]), separator_(dict.lookupOrDefault<string>("separator", ",")[0]),
mergeSeparators_(readBool(dict.lookup("mergeSeparators"))), mergeSeparators_(dict.get<bool>("mergeSeparators")),
fName_(fName != fileName::null ? fName : dict.lookup("file")) fName_(fName.empty() ? dict.get<fileName>("file") : fName)
{ {
if (componentColumns_.size() != pTraits<Type>::nComponents) if (componentColumns_.size() != pTraits<Type>::nComponents)
{ {

View File

@ -30,7 +30,7 @@ License
void Foam::Function1Types::ramp::read(const dictionary& coeffs) void Foam::Function1Types::ramp::read(const dictionary& coeffs)
{ {
start_ = coeffs.lookupOrDefault<scalar>("start", 0); start_ = coeffs.lookupOrDefault<scalar>("start", 0);
duration_ = coeffs.get<scalar>("duration"); coeffs.readEntry("duration", duration_);
} }

View File

@ -72,7 +72,7 @@ convectiveHeatTransferFvPatchScalarField
) )
: :
fixedValueFvPatchScalarField(p, iF, dict), fixedValueFvPatchScalarField(p, iF, dict),
L_(readScalar(dict.lookup("L"))) L_(dict.get<scalar>("L"))
{} {}

View File

@ -77,8 +77,8 @@ lumpedMassWallTemperatureFvPatchScalarField
: :
mixedFvPatchScalarField(p, iF), mixedFvPatchScalarField(p, iF),
temperatureCoupledBase(patch(), dict), temperatureCoupledBase(patch(), dict),
Cp_(readScalar(dict.lookup("Cp"))), Cp_(dict.get<scalar>("Cp")),
mass_(readScalar(dict.lookup("mass"))), mass_(dict.get<scalar>("mass")),
curTimeIndex_(-1) curTimeIndex_(-1)
{ {
refGrad() = 0.0; refGrad() = 0.0;

View File

@ -63,7 +63,7 @@ outletMachNumberPressureFvPatchScalarField
: :
fixedValueFvPatchScalarField(p, iF, dict), fixedValueFvPatchScalarField(p, iF, dict),
M_(dict.lookupOrDefault<scalar>("M", 0.0)), M_(dict.lookupOrDefault<scalar>("M", 0.0)),
pBack_(readScalar(dict.lookup("pBack"))), pBack_(dict.get<scalar>("pBack")),
c1_(dict.lookupOrDefault<scalar>("c1", 0.0)), c1_(dict.lookupOrDefault<scalar>("c1", 0.0)),
A1_(dict.lookupOrDefault<scalar>("A1", 0.0)), A1_(dict.lookupOrDefault<scalar>("A1", 0.0)),
phiName_(dict.lookupOrDefault<word>("phi", "phi")), phiName_(dict.lookupOrDefault<word>("phi", "phi")),

View File

@ -76,7 +76,7 @@ outletMappedUniformInletHeatAdditionFvPatchField
fixedValueFvPatchScalarField(p, iF, dict), fixedValueFvPatchScalarField(p, iF, dict),
outletPatchName_(dict.lookup("outletPatch")), outletPatchName_(dict.lookup("outletPatch")),
phiName_(dict.lookupOrDefault<word>("phi", "phi")), phiName_(dict.lookupOrDefault<word>("phi", "phi")),
Q_(readScalar(dict.lookup("Q"))), Q_(dict.get<scalar>("Q")),
TMin_(dict.lookupOrDefault<scalar>("TMin", 0)), TMin_(dict.lookupOrDefault<scalar>("TMin", 0)),
TMax_(dict.lookupOrDefault<scalar>("TMax", 5000)) TMax_(dict.lookupOrDefault<scalar>("TMax", 5000))
{} {}

View File

@ -175,7 +175,7 @@ alphatJayatillekeWallFunctionFvPatchScalarField
) )
: :
fixedValueFvPatchScalarField(p, iF, dict), fixedValueFvPatchScalarField(p, iF, dict),
Prt_(readScalar(dict.lookup("Prt"))), // force read to avoid ambiguity Prt_(dict.get<scalar>("Prt")), // force read to avoid ambiguity
kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)), kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)),
E_(dict.lookupOrDefault<scalar>("E", 9.8)) E_(dict.lookupOrDefault<scalar>("E", 9.8))
{ {

View File

@ -161,10 +161,7 @@ Foam::LESModels::smoothDelta::smoothDelta
), ),
maxDeltaRatio_ maxDeltaRatio_
( (
readScalar dict.optionalSubDict(type() + "Coeffs").get<scalar>("maxDeltaRatio")
(
dict.optionalSubDict(type() + "Coeffs").lookup("maxDeltaRatio")
)
) )
{ {
calcDelta(); calcDelta();

View File

@ -86,7 +86,7 @@ Foam::anisotropicFilter::anisotropicFilter
LESfilter(mesh), LESfilter(mesh),
widthCoeff_ widthCoeff_
( (
readScalar(bd.optionalSubDict(type() + "Coeffs").lookup("widthCoeff")) bd.optionalSubDict(type() + "Coeffs").get<scalar>("widthCoeff")
), ),
coeff_ coeff_
( (

View File

@ -66,7 +66,7 @@ Foam::laplaceFilter::laplaceFilter(const fvMesh& mesh, const dictionary& bd)
LESfilter(mesh), LESfilter(mesh),
widthCoeff_ widthCoeff_
( (
readScalar(bd.optionalSubDict(type() + "Coeffs").lookup("widthCoeff")) bd.optionalSubDict(type() + "Coeffs").get<scalar>("widthCoeff")
), ),
coeff_ coeff_
( (

View File

@ -78,7 +78,7 @@ turbulentMixingLengthDissipationRateInletFvPatchScalarField
) )
: :
inletOutletFvPatchScalarField(p, iF), inletOutletFvPatchScalarField(p, iF),
mixingLength_(readScalar(dict.lookup("mixingLength"))), mixingLength_(dict.get<scalar>("mixingLength")),
kName_(dict.lookupOrDefault<word>("k", "k")) kName_(dict.lookupOrDefault<word>("k", "k"))
{ {
this->phiName_ = dict.lookupOrDefault<word>("phi", "phi"); this->phiName_ = dict.lookupOrDefault<word>("phi", "phi");

View File

@ -76,7 +76,7 @@ turbulentMixingLengthFrequencyInletFvPatchScalarField
) )
: :
inletOutletFvPatchScalarField(p, iF), inletOutletFvPatchScalarField(p, iF),
mixingLength_(readScalar(dict.lookup("mixingLength"))), mixingLength_(dict.get<scalar>("mixingLength")),
kName_(dict.lookupOrDefault<word>("k", "k")) kName_(dict.lookupOrDefault<word>("k", "k"))
{ {
this->phiName_ = dict.lookupOrDefault<word>("phi", "phi"); this->phiName_ = dict.lookupOrDefault<word>("phi", "phi");

View File

@ -58,7 +58,7 @@ Foam::porousBafflePressureFvPatchField::porousBafflePressureFvPatchField
rhoName_(dict.lookupOrDefault<word>("rho", "rho")), rhoName_(dict.lookupOrDefault<word>("rho", "rho")),
D_(Function1<scalar>::New("D", dict)), D_(Function1<scalar>::New("D", dict)),
I_(Function1<scalar>::New("I", dict)), I_(Function1<scalar>::New("I", dict)),
length_(readScalar(dict.lookup("length"))), length_(dict.get<scalar>("length")),
uniformJump_(dict.lookupOrDefault("uniformJump", false)) uniformJump_(dict.lookupOrDefault("uniformJump", false))
{ {
fvPatchField<scalar>::operator= fvPatchField<scalar>::operator=

View File

@ -238,9 +238,9 @@ nutURoughWallFunctionFvPatchScalarField::nutURoughWallFunctionFvPatchScalarField
) )
: :
nutWallFunctionFvPatchScalarField(p, iF, dict), nutWallFunctionFvPatchScalarField(p, iF, dict),
roughnessHeight_(readScalar(dict.lookup("roughnessHeight"))), roughnessHeight_(dict.get<scalar>("roughnessHeight")),
roughnessConstant_(readScalar(dict.lookup("roughnessConstant"))), roughnessConstant_(dict.get<scalar>("roughnessConstant")),
roughnessFactor_(readScalar(dict.lookup("roughnessFactor"))) roughnessFactor_(dict.get<scalar>("roughnessFactor"))
{} {}

View File

@ -52,8 +52,8 @@ atmBoundaryLayer::atmBoundaryLayer(const vectorField& p, const dictionary& dict)
zDir_(dict.lookup("zDir")), zDir_(dict.lookup("zDir")),
kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)), kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)),
Cmu_(dict.lookupOrDefault<scalar>("Cmu", 0.09)), Cmu_(dict.lookupOrDefault<scalar>("Cmu", 0.09)),
Uref_(readScalar(dict.lookup("Uref"))), Uref_(dict.get<scalar>("Uref")),
Zref_(readScalar(dict.lookup("Zref"))), Zref_(dict.get<scalar>("Zref")),
z0_("z0", dict, p.size()), z0_("z0", dict, p.size()),
zGround_("zGround", dict, p.size()), zGround_("zGround", dict, p.size()),
Ustar_(p.size()) Ustar_(p.size())

View File

@ -48,7 +48,7 @@ void kEpsilonLopesdaCosta<BasicTurbulenceModel>::setPorosityCoefficient
{ {
const labelList& cellZoneIDs = pm.cellZoneIDs(); const labelList& cellZoneIDs = pm.cellZoneIDs();
const scalar Cpm = readScalar(pm.dict().lookup(C.name())); const scalar Cpm = pm.dict().get<scalar>(C.name());
for (const label zonei : cellZoneIDs) for (const label zonei : cellZoneIDs)
{ {
@ -75,7 +75,7 @@ void kEpsilonLopesdaCosta<BasicTurbulenceModel>::setCdSigma
const labelList& cellZoneIDs = pm.cellZoneIDs(); const labelList& cellZoneIDs = pm.cellZoneIDs();
const scalarField& Sigma = pm.Sigma(); const scalarField& Sigma = pm.Sigma();
const scalar Cpm = readScalar(pm.dict().lookup(C.name())); const scalar Cpm = pm.dict().get<scalar>(C.name());
for (const label zonei : cellZoneIDs) for (const label zonei : cellZoneIDs)
{ {

View File

@ -60,7 +60,7 @@ Foam::porosityModels::powerLawLopesdaCostaZone::powerLawLopesdaCostaZone
vector zDir(coeffs.lookup("zDir")); vector zDir(coeffs.lookup("zDir"));
// Span of the search for the cells in the porous region // Span of the search for the cells in the porous region
scalar searchSpan(readScalar(coeffs.lookup("searchSpan"))); scalar searchSpan(coeffs.get<scalar>("searchSpan"));
// Top surface file name defining the extent of the porous region // Top surface file name defining the extent of the porous region
word topSurfaceFileName(coeffs.lookup("topSurface")); word topSurfaceFileName(coeffs.lookup("topSurface"));
@ -305,8 +305,8 @@ Foam::porosityModels::powerLawLopesdaCosta::powerLawLopesdaCosta
dict, dict,
powerLawLopesdaCostaZone::zoneName_ powerLawLopesdaCostaZone::zoneName_
), ),
Cd_(readScalar(coeffs_.lookup("Cd"))), Cd_(coeffs_.get<scalar>("Cd")),
C1_(readScalar(coeffs_.lookup("C1"))), C1_(coeffs_.get<scalar>("C1")),
rhoName_(coeffs_.lookupOrDefault<word>("rho", "rho")) rhoName_(coeffs_.lookupOrDefault<word>("rho", "rho"))
{} {}

View File

@ -76,12 +76,12 @@ FSD<ReactionThermo, ThermoType>::FSD
), ),
YFuelFuelStream_(dimensionedScalar("YFuelStream", dimless, 1.0)), YFuelFuelStream_(dimensionedScalar("YFuelStream", dimless, 1.0)),
YO2OxiStream_(dimensionedScalar("YOxiStream", dimless, 0.23)), YO2OxiStream_(dimensionedScalar("YOxiStream", dimless, 0.23)),
Cv_(readScalar(this->coeffs().lookup("Cv"))), Cv_(this->coeffs().getScalar("Cv")),
C_(5.0), C_(5.0),
ftMin_(0.0), ftMin_(0.0),
ftMax_(1.0), ftMax_(1.0),
ftDim_(300), ftDim_(300),
ftVarMin_(readScalar(this->coeffs().lookup("ftVarMin"))) ftVarMin_(this->coeffs().getScalar("ftVarMin"))
{} {}

View File

@ -39,10 +39,10 @@ Foam::consumptionSpeed::consumptionSpeed
( (
const dictionary& dict const dictionary& dict
) )
: omega0_(readScalar(dict.lookup("omega0"))), : omega0_(dict.get<scalar>("omega0")),
eta_(readScalar(dict.lookup("eta"))), eta_(dict.get<scalar>("eta")),
sigmaExt_(readScalar(dict.lookup("sigmaExt"))), sigmaExt_(dict.get<scalar>("sigmaExt")),
omegaMin_(readScalar(dict.lookup("omegaMin"))) omegaMin_(dict.get<scalar>("omegaMin"))
{} {}

View File

@ -57,11 +57,8 @@ Foam::reactionRateFlameAreaModels::relaxation::relaxation
: :
reactionRateFlameArea(modelType, dict, mesh, combModel), reactionRateFlameArea(modelType, dict, mesh, combModel),
correlation_(dict.optionalSubDict(typeName + "Coeffs").subDict(fuel_)), correlation_(dict.optionalSubDict(typeName + "Coeffs").subDict(fuel_)),
C_(readScalar(dict.optionalSubDict(typeName + "Coeffs").lookup("C"))), C_(dict.optionalSubDict(typeName + "Coeffs").get<scalar>("C")),
alpha_ alpha_(dict.optionalSubDict(typeName + "Coeffs").get<scalar>("alpha"))
(
readScalar(dict.optionalSubDict(typeName + "Coeffs").lookup("alpha"))
)
{} {}

View File

@ -37,7 +37,7 @@ Foam::combustionModels::PaSR<ReactionThermo>::PaSR
) )
: :
laminar<ReactionThermo>(modelType, thermo, turb, combustionProperties), laminar<ReactionThermo>(modelType, thermo, turb, combustionProperties),
Cmix_(readScalar(this->coeffs().lookup("Cmix"))), Cmix_(this->coeffs().getScalar("Cmix")),
kappa_ kappa_
( (
IOobject IOobject

View File

@ -49,7 +49,7 @@ diffusion<ReactionThermo, ThermoType>::diffusion
turb, turb,
combustionProperties combustionProperties
), ),
C_(readScalar(this->coeffs().lookup("C"))), C_(this->coeffs().getScalar("C")),
oxidantName_(this->coeffs().template lookupOrDefault<word>("oxidant", "O2")) oxidantName_(this->coeffs().template lookupOrDefault<word>("oxidant", "O2"))
{} {}

View File

@ -48,7 +48,7 @@ eddyDissipationDiffusionModel
turb, turb,
combustionProperties combustionProperties
), ),
Cd_(readScalar(this->coeffs().lookup("Cd"))) Cd_(this->coeffs().getScalar("Cd"))
{} {}

View File

@ -48,7 +48,7 @@ eddyDissipationModelBase<ReactionThermo, ThermoType>::eddyDissipationModelBase
turb, turb,
combustionProperties combustionProperties
), ),
CEDC_(readScalar(this->coeffs().lookup("CEDC"))) CEDC_(this->coeffs().getScalar("CEDC"))
{} {}

View File

@ -48,7 +48,7 @@ infinitelyFastChemistry<ReactionThermo, ThermoType>::infinitelyFastChemistry
turb, turb,
combustionProperties combustionProperties
), ),
C_(readScalar(this->coeffs().lookup("C"))) C_(this->coeffs().getScalar("C"))
{} {}

Some files were not shown because too many files have changed in this diff Show More