mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
STYLE: use guards for dictionary lookup()
This commit is contained in:
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -28,6 +29,7 @@ License
|
||||
#include "general.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "Tuple2.H"
|
||||
#include "Switch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -135,12 +137,15 @@ Foam::tabulatedWallFunctions::general::general
|
||||
:
|
||||
tabulatedWallFunction(dict, mesh, typeName),
|
||||
interpType_(interpolationTypeNames_.get("interpType", coeffDict_)),
|
||||
log10YPlus_(coeffDict_.get<bool>("log10YPlus")),
|
||||
log10UPlus_(coeffDict_.get<bool>("log10UPlus")),
|
||||
yPlus_(),
|
||||
uPlus_(),
|
||||
log10YPlus_(coeffDict_.lookup("log10YPlus")),
|
||||
log10UPlus_(coeffDict_.lookup("log10UPlus"))
|
||||
uPlus_()
|
||||
{
|
||||
List<Tuple2<scalar, scalar>> inputTable = coeffDict_.lookup("inputTable");
|
||||
List<Tuple2<scalar, scalar>> inputTable;
|
||||
|
||||
coeffDict_.readEntry("inputTable", inputTable);
|
||||
|
||||
if (inputTable.size() < 2)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011 OpenFOAM Foundation
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -32,6 +33,7 @@ Description
|
||||
|
||||
Example dictionary specification:
|
||||
|
||||
\verbatim
|
||||
tabulatedWallFunction general;
|
||||
|
||||
// Output table info
|
||||
@ -52,9 +54,8 @@ Description
|
||||
...
|
||||
(yPlusValueN uPlusValueN)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
\endverbatim
|
||||
|
||||
SourceFiles
|
||||
general.C
|
||||
@ -66,7 +67,6 @@ SourceFiles
|
||||
|
||||
#include "tabulatedWallFunction.H"
|
||||
#include "Enum.H"
|
||||
#include "Switch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -103,18 +103,18 @@ protected:
|
||||
//- Type of interpolation to apply when inverting the data set
|
||||
interpolationType interpType_;
|
||||
|
||||
//- Are y+ values entered as log10(y+)?
|
||||
bool log10YPlus_;
|
||||
|
||||
//- Are U+ values entered as log10(U+)?
|
||||
bool log10UPlus_;
|
||||
|
||||
//- Input y+ values
|
||||
List<scalar> yPlus_;
|
||||
|
||||
//- Input U+ values
|
||||
List<scalar> uPlus_;
|
||||
|
||||
//- Are y+ values entered as log10(y+)?
|
||||
Switch log10YPlus_;
|
||||
|
||||
//- Are U+ values entered as log10(U+)?
|
||||
Switch log10UPlus_;
|
||||
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2015-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -69,7 +69,7 @@ void Foam::ConeNozzleInjection<CloudType>::setInjectionMethod()
|
||||
case injectionMethod::imPoint:
|
||||
case injectionMethod::imDisc:
|
||||
{
|
||||
position_ = this->coeffDict().lookup("position");
|
||||
this->coeffDict().readEntry("position", position_);
|
||||
break;
|
||||
}
|
||||
case injectionMethod::imMovingPoint:
|
||||
|
||||
@ -67,7 +67,10 @@ void Foam::moleculeCloud::buildConstProps()
|
||||
const word& id = idList[i];
|
||||
const dictionary& molDict = moleculePropertiesDict.subDict(id);
|
||||
|
||||
List<word> siteIdNames = molDict.lookup("siteIds");
|
||||
List<word> siteIdNames
|
||||
(
|
||||
molDict.lookup("siteIds")
|
||||
);
|
||||
|
||||
List<label> siteIds(siteIdNames.size());
|
||||
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -47,7 +48,10 @@ void Foam::potential::setSiteIdList(const dictionary& moleculePropertiesDict)
|
||||
|
||||
const dictionary& molDict(moleculePropertiesDict.subDict(id));
|
||||
|
||||
List<word> siteIdNames = molDict.lookup("siteIds");
|
||||
List<word> siteIdNames
|
||||
(
|
||||
molDict.lookup("siteIds")
|
||||
);
|
||||
|
||||
forAll(siteIdNames, sI)
|
||||
{
|
||||
@ -59,7 +63,10 @@ void Foam::potential::setSiteIdList(const dictionary& moleculePropertiesDict)
|
||||
}
|
||||
}
|
||||
|
||||
List<word> pairPotSiteIds = molDict.lookup("pairPotentialSiteIds");
|
||||
List<word> pairPotSiteIds
|
||||
(
|
||||
molDict.lookup("pairPotentialSiteIds")
|
||||
);
|
||||
|
||||
forAll(pairPotSiteIds, sI)
|
||||
{
|
||||
@ -111,7 +118,7 @@ void Foam::potential::potential::readPotentialDict()
|
||||
)
|
||||
);
|
||||
|
||||
idList_ = List<word>(idListDict.lookup("idList"));
|
||||
idListDict.readEntry("idList", idList_);
|
||||
|
||||
setSiteIdList
|
||||
(
|
||||
@ -156,10 +163,10 @@ void Foam::potential::potential::readPotentialDict()
|
||||
|
||||
potentialDict.readEntry("potentialEnergyLimit", potentialEnergyLimit_);
|
||||
|
||||
if (potentialDict.found("removalOrder"))
|
||||
{
|
||||
List<word> remOrd = potentialDict.lookup("removalOrder");
|
||||
List<word> remOrd;
|
||||
|
||||
if (potentialDict.readIfPresent("removalOrder", remOrd))
|
||||
{
|
||||
removalOrder_.setSize(remOrd.size());
|
||||
|
||||
forAll(removalOrder_, rO)
|
||||
|
||||
@ -1057,7 +1057,6 @@ Foam::mappedPatchBase::mappedPatchBase
|
||||
|
||||
case NONUNIFORM:
|
||||
{
|
||||
//offsets_ = pointField(dict.lookup("offsets"));
|
||||
offsets_ = readListOrField("offsets", dict, patch_.size());
|
||||
}
|
||||
break;
|
||||
@ -1076,7 +1075,6 @@ Foam::mappedPatchBase::mappedPatchBase
|
||||
else if (dict.found("offsets"))
|
||||
{
|
||||
offsetMode_ = NONUNIFORM;
|
||||
//offsets_ = pointField(dict.lookup("offsets"));
|
||||
offsets_ = readListOrField("offsets", dict, patch_.size());
|
||||
}
|
||||
else if (mode_ != NEARESTPATCHFACE && mode_ != NEARESTPATCHFACEAMI)
|
||||
|
||||
@ -731,10 +731,10 @@ Foam::surfaceFeatures::surfaceFeatures
|
||||
|
||||
dictionary featInfoDict(str);
|
||||
|
||||
featureEdges_ = labelList(featInfoDict.lookup("featureEdges"));
|
||||
featurePoints_ = labelList(featInfoDict.lookup("featurePoints"));
|
||||
externalStart_ = featInfoDict.get<label>("externalStart");
|
||||
internalStart_ = featInfoDict.get<label>("internalStart");
|
||||
featInfoDict.readEntry("featureEdges", featureEdges_);
|
||||
featInfoDict.readEntry("featurePoints", featurePoints_);
|
||||
featInfoDict.readEntry("externalStart", externalStart_);
|
||||
featInfoDict.readEntry("internalStart", internalStart_);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -159,9 +159,9 @@ bool Foam::RBD::restraints::linearAxialAngularSpring::read
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
axis_ = coeffs_.lookup("axis");
|
||||
coeffs_.readEntry("axis", axis_);
|
||||
|
||||
scalar magAxis(mag(axis_));
|
||||
const scalar magAxis(mag(axis_));
|
||||
|
||||
if (magAxis > VSMALL)
|
||||
{
|
||||
|
||||
@ -176,9 +176,9 @@ bool Foam::RBD::restraints::prescribedRotation::read
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
axis_ = coeffs_.lookup("axis");
|
||||
coeffs_.readEntry("axis", axis_);
|
||||
|
||||
scalar magAxis(mag(axis_));
|
||||
const scalar magAxis(mag(axis_));
|
||||
|
||||
if (magAxis > VSMALL)
|
||||
{
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2018 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -162,9 +162,9 @@ bool Foam::sixDoFRigidBodyMotionRestraints::linearAxialAngularSpring::read
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
axis_ = sDoFRBMRCoeffs_.lookup("axis");
|
||||
sDoFRBMRCoeffs_.readEntry("axis", axis_);
|
||||
|
||||
scalar magAxis(mag(axis_));
|
||||
const scalar magAxis(mag(axis_));
|
||||
|
||||
if (magAxis > VSMALL)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user