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,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