ENH: construct string types from Istream now explicit (#1033)

- this helps for trapping unguarded dictionary lookups.
This commit is contained in:
Mark Olesen 2018-11-03 20:24:34 +01:00
parent 552682ec03
commit 50baac3c45
65 changed files with 189 additions and 244 deletions

View File

@ -53,13 +53,7 @@ Foam::surfaceTensionModels::liquidProperties::liquidProperties
)
:
surfaceTensionModel(mesh),
phaseName_(dict.lookup("phase"))
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::surfaceTensionModels::liquidProperties::~liquidProperties()
phaseName_(dict.get<word>("phase"))
{}

View File

@ -95,7 +95,7 @@ public:
//- Destructor
virtual ~liquidProperties();
virtual ~liquidProperties() = default;
// Member Functions

View File

@ -98,7 +98,7 @@ public:
autoPtr<phaseModel> operator()(Istream& is) const
{
return autoPtr<phaseModel>::New(is, p_, T_);
return autoPtr<phaseModel>::New(word(is), p_, T_);
}
};

View File

@ -72,7 +72,7 @@ MultiComponentPhaseModel
species_ = thermoPtr_->composition().species();
inertIndex_ = species_[thermoPtr_().lookup("inertSpecie")];
inertIndex_ = species_[thermoPtr_->getWord("inertSpecie")];
X_.setSize(thermoPtr_->composition().species().size());
@ -104,7 +104,6 @@ MultiComponentPhaseModel
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class BasePhaseModel, class phaseThermo>
void Foam::MultiComponentPhaseModel<BasePhaseModel, phaseThermo>
::calculateVolumeFractions()

View File

@ -53,7 +53,7 @@ Foam::phaseModel::phaseModel
IOobject::AUTO_WRITE
),
fluid.mesh(),
dimensionedScalar("alpha", dimless, 0)
dimensionedScalar(dimless, Zero)
),
fluid_(fluid),
name_(phaseName)

View File

@ -122,46 +122,29 @@ int main(int argc, char *argv[])
{
if (nameMap.found(starFieldNames[i]))
{
IOobject io
(
nameMap.get<word>(starFieldNames[i]),
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
);
if (starFieldNames[i] == "SU")
{
vFields[i] =
new volVectorField
(
IOobject
(
nameMap.lookup(starFieldNames[i]),
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
vFields[i] = new volVectorField(io, mesh);
i += 3;
}
else
{
sFields[i] =
new volScalarField
(
IOobject
(
nameMap.lookup(starFieldNames[i]),
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
i++;
sFields[i] = new volScalarField(io, mesh);
++i;
}
}
else
{
i++;
++i;
}
}

View File

@ -1297,6 +1297,7 @@ public:
defineDictionaryGetter(getBool, bool);
defineDictionaryGetter(getLabel, label);
defineDictionaryGetter(getScalar, scalar);
defineDictionaryGetter(getString, string);
defineDictionaryGetter(getWord, word);
defineDictionaryGetter(getFileName, fileName);

View File

@ -48,7 +48,7 @@ Foam::fixedNormalSlipPointPatchField<Type>::fixedNormalSlipPointPatchField
)
:
slipPointPatchField<Type>(p, iF, dict),
n_(dict.lookup("n"))
n_(dict.get<vector>("n"))
{}

View File

@ -53,7 +53,7 @@ Foam::PBiCCCG<Type, DType, LUType>::solve
Field<Type>& psi
) const
{
word preconditionerName(this->controlDict_.lookup("preconditioner"));
const word preconditionerName(this->controlDict_.getWord("preconditioner"));
// --- Setup class containing solver performance data
SolverPerformance<Type> solverPerf

View File

@ -50,7 +50,7 @@ template<class Type, class DType, class LUType>
Foam::SolverPerformance<Type>
Foam::PBiCICG<Type, DType, LUType>::solve(Field<Type>& psi) const
{
word preconditionerName(this->controlDict_.lookup("preconditioner"));
const word preconditionerName(this->controlDict_.getWord("preconditioner"));
// --- Setup class containing solver performance data
SolverPerformance<Type> solverPerf

View File

@ -50,7 +50,7 @@ template<class Type, class DType, class LUType>
typename Foam::SolverPerformance<Type>
Foam::PCICG<Type, DType, LUType>::solve(Field<Type>& psi) const
{
word preconditionerName(this->controlDict_.lookup("preconditioner"));
const word preconditionerName(this->controlDict_.getWord("preconditioner"));
// --- Setup class containing solver performance data
SolverPerformance<Type> solverPerf

View File

@ -248,7 +248,7 @@ Foam::GAMGAgglomeration::GAMGAgglomeration
)
? GAMGProcAgglomeration::New
(
controlDict.lookup("processorAgglomerator"),
controlDict.get<word>("processorAgglomerator"),
*this,
controlDict
)

View File

@ -77,7 +77,7 @@ public:
inline Pair(const FixedList<T, 2>& lst, const bool doSort);
//- Construct from Istream
inline Pair(Istream& is);
inline explicit Pair(Istream& is);
// Member Functions

View File

@ -44,7 +44,7 @@ See also
namespace Foam
{
// Forward declaration of friend functions and operators
// Forward declarations
template<class Type1, class Type2>
class Tuple2;
@ -93,7 +93,7 @@ public:
{}
//- Construct from Istream
inline Tuple2(Istream& is)
inline explicit Tuple2(Istream& is)
{
is >> *this;
}

View File

@ -153,7 +153,7 @@ public:
{}
//- Construct from Istream
Switch(Istream& is);
explicit Switch(Istream& is);
// Helpers

View File

@ -137,9 +137,8 @@ public:
//- Construct by concatenating words separated by '/'
explicit fileName(std::initializer_list<word> list);
//- Construct from Istream
fileName(Istream& is);
explicit fileName(Istream& is);
// Member Functions

View File

@ -130,7 +130,7 @@ public:
//- Construct from Istream
// Treat as regular expression if surrounded by quotation marks.
keyType(Istream& is);
explicit keyType(Istream& is);
// Member Functions

View File

@ -49,8 +49,6 @@ namespace Foam
namespace parsing
{
// Enumerations
//- Enumeration for possible parsing error
enum class errorType
{

View File

@ -182,7 +182,7 @@ public:
inline string(const size_type len, const char c);
//- Construct from Istream
string(Istream& is);
explicit string(Istream& is);
// Member Functions

View File

@ -109,7 +109,7 @@ public:
inline word(const char* s, size_type len, bool doStrip);
//- Construct from Istream
word(Istream& is);
explicit word(Istream& is);
// Member Functions

View File

@ -162,7 +162,7 @@ public:
//- Construct from Istream
// Words are treated as literals, strings with an auto-test
wordRe(Istream& is);
explicit wordRe(Istream& is);
// Member Functions

View File

@ -69,7 +69,7 @@ outletMachNumberPressureFvPatchScalarField
phiName_(dict.lookupOrDefault<word>("phi", "phi")),
rhoName_(dict.lookupOrDefault<word>("rho", "rho")),
UName_(dict.lookupOrDefault<word>("U", "U")),
choked_(dict.lookup("choked")),
choked_(dict.get<Switch>("choked")),
relax_(dict.lookupOrDefault<scalar>("relax", 0))
{}

View File

@ -74,7 +74,7 @@ outletMappedUniformInletHeatAdditionFvPatchField
)
:
fixedValueFvPatchScalarField(p, iF, dict),
outletPatchName_(dict.lookup("outletPatch")),
outletPatchName_(dict.get<word>("outletPatch")),
phiName_(dict.lookupOrDefault<word>("phi", "phi")),
Q_(dict.get<scalar>("Q")),
TMin_(dict.lookupOrDefault<scalar>("TMin", 0)),

View File

@ -86,7 +86,7 @@ turbulentTemperatureCoupledBaffleMixedFvPatchScalarField
:
mixedFvPatchScalarField(p, iF),
temperatureCoupledBase(patch(), dict),
TnbrName_(dict.lookup("Tnbr")),
TnbrName_(dict.get<word>("Tnbr")),
thicknessLayers_(0),
kappaLayers_(0),
contactRes_(0.0)

View File

@ -65,7 +65,7 @@ Foam::LESModel<BasicTurbulenceModel>::LESModel
),
LESDict_(this->subOrEmptyDict("LES")),
turbulence_(LESDict_.lookup("turbulence")),
turbulence_(LESDict_.get<Switch>("turbulence")),
printCoeffs_(LESDict_.lookupOrDefault<Switch>("printCoeffs", false)),
coeffDict_(LESDict_.optionalSubDict(type + "Coeffs")),

View File

@ -93,11 +93,6 @@ protected:
//- Print model coefficients
virtual void printCoeffs(const word& type);
private:
// Private Member Functions
//- No copy construct
LESModel(const LESModel&) = delete;
@ -168,8 +163,7 @@ public:
//- Destructor
virtual ~LESModel()
{}
virtual ~LESModel() = default;
// Member Functions

View File

@ -65,7 +65,7 @@ Foam::RASModel<BasicTurbulenceModel>::RASModel
),
RASDict_(this->subOrEmptyDict("RAS")),
turbulence_(RASDict_.lookup("turbulence")),
turbulence_(RASDict_.get<Switch>("turbulence")),
printCoeffs_(RASDict_.lookupOrDefault<Switch>("printCoeffs", false)),
coeffDict_(RASDict_.optionalSubDict(type + "Coeffs")),

View File

@ -83,11 +83,6 @@ protected:
//- Print model coefficients
virtual void printCoeffs(const word& type);
private:
// Private Member Functions
//- No copy construct
RASModel(const RASModel&) = delete;
@ -158,8 +153,7 @@ public:
//- Destructor
virtual ~RASModel()
{}
virtual ~RASModel() = default;
// Member Functions

View File

@ -100,7 +100,7 @@ Foam::TurbulenceModel<Alpha, Rho, BasicTurbulenceModel, TransportModel>::New
IOobject::NO_WRITE,
false
)
).lookup("simulationType")
).get<word>("simulationType")
);
Info<< "Selecting turbulence model type " << modelType << endl;

View File

@ -75,9 +75,7 @@ protected:
const transportModel& transport_;
private:
// Private Member Functions
// Protected Member Functions
//- No copy construct
TurbulenceModel(const TurbulenceModel&) = delete;
@ -139,8 +137,7 @@ public:
//- Destructor
virtual ~TurbulenceModel()
{}
virtual ~TurbulenceModel() = default;
// Member Functions

View File

@ -134,7 +134,7 @@ nutUTabulatedWallFunctionFvPatchScalarField
)
:
nutWallFunctionFvPatchScalarField(p, iF, dict),
uPlusTableName_(dict.lookup("uPlusTable")),
uPlusTableName_(dict.get<word>("uPlusTable")),
uPlusTable_
(
IOobject

View File

@ -109,7 +109,7 @@ Foam::laminarModel<BasicTurbulenceModel>::New
// otherwise it is registered in the database twice
const word modelType
(
modelDict.subDict("laminar").lookup("laminarModel")
modelDict.subDict("laminar").get<word>("laminarModel")
);
Info<< "Selecting laminar stress model " << modelType << endl;

View File

@ -71,11 +71,6 @@ protected:
//- Print model coefficients
virtual void printCoeffs(const word& type);
private:
// Private Member Functions
//- No copy construct
laminarModel(const laminarModel&) = delete;
@ -146,8 +141,7 @@ public:
//- Destructor
virtual ~laminarModel()
{}
virtual ~laminarModel() = default;
// Member Functions

View File

@ -98,7 +98,7 @@ Foam::velocityDisplacementMotionSolver::velocityDisplacementMotionSolver
(
displacementMotionSolver::New
(
coeffDict().lookup("solver"),
coeffDict().get<word>("solver"),
mesh,
IOdictionary
(

View File

@ -50,6 +50,7 @@ namespace functionObjects
}
}
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
void Foam::functionObjects::codedFunctionObject::prepare
@ -194,9 +195,10 @@ bool Foam::functionObjects::codedFunctionObject::read(const dictionary& dict)
dict.readCompat<word>("name", {{"redirectType", 1706}}, name_);
const entry* dataPtr = dict.findEntry("codeData", keyType::LITERAL);
if (dataPtr)
{
codeData_ = stringOps::trim(dataPtr->stream());
dataPtr->readEntry(codeData_);
stringOps::inplaceExpand(codeData_, dict);
dynamicCodeContext::addLineDirective
(
@ -207,9 +209,10 @@ bool Foam::functionObjects::codedFunctionObject::read(const dictionary& dict)
}
const entry* readPtr = dict.findEntry("codeRead", keyType::LITERAL);
if (readPtr)
{
codeRead_ = stringOps::trim(readPtr->stream());
readPtr->readEntry(codeRead_);
stringOps::inplaceExpand(codeRead_, dict);
dynamicCodeContext::addLineDirective
(
@ -220,9 +223,10 @@ bool Foam::functionObjects::codedFunctionObject::read(const dictionary& dict)
}
const entry* execPtr = dict.findEntry("codeExecute", keyType::LITERAL);
if (execPtr)
{
codeExecute_ = stringOps::trim(execPtr->stream());
execPtr->readEntry(codeExecute_);
stringOps::inplaceExpand(codeExecute_, dict);
dynamicCodeContext::addLineDirective
(
@ -233,9 +237,10 @@ bool Foam::functionObjects::codedFunctionObject::read(const dictionary& dict)
}
const entry* writePtr = dict.findEntry("codeWrite", keyType::LITERAL);
if (writePtr)
{
codeWrite_ = stringOps::trim(writePtr->stream());
writePtr->readEntry(codeWrite_);
stringOps::inplaceExpand(codeWrite_, dict);
dynamicCodeContext::addLineDirective
(
@ -246,9 +251,10 @@ bool Foam::functionObjects::codedFunctionObject::read(const dictionary& dict)
}
const entry* endPtr = dict.findEntry("codeEnd", keyType::LITERAL);
if (endPtr)
{
codeEnd_ = stringOps::trim(endPtr->stream());
endPtr->readEntry(codeEnd_);
stringOps::inplaceExpand(codeEnd_, dict);
dynamicCodeContext::addLineDirective
(
@ -260,10 +266,8 @@ bool Foam::functionObjects::codedFunctionObject::read(const dictionary& dict)
if (!dataPtr && !readPtr && !execPtr && !writePtr && !endPtr)
{
IOWarningInFunction
(
dict
) << "No critical \"code\" prefixed keywords were found."
IOWarningInFunction(dict)
<< "No critical \"code\" prefixed keywords were found."
<< " Please check the code documentation for more details."
<< nl << endl;
}

View File

@ -134,8 +134,6 @@ protected:
virtual const dictionary& codeDict() const;
private:
//- No copy construct
codedFunctionObject(const codedFunctionObject&) = delete;

View File

@ -85,20 +85,14 @@ displacementComponentLaplacianFvMotionSolver
frozenPointsZone_
(
coeffDict().found("frozenPointsZone")
? fvMesh_.pointZones().findZoneID(coeffDict().lookup("frozenPointsZone"))
? fvMesh_.pointZones().findZoneID
(
coeffDict().get<word>("frozenPointsZone")
)
: -1
)
{
Switch applyPointLocation
(
coeffDict().lookupOrDefault
(
"applyPointLocation",
true
)
);
if (applyPointLocation)
if (coeffDict().lookupOrDefault("applyPointLocation", true))
{
pointLocation_.reset
(

View File

@ -93,7 +93,10 @@ Foam::displacementLaplacianFvMotionSolver::displacementLaplacianFvMotionSolver
frozenPointsZone_
(
coeffDict().found("frozenPointsZone")
? fvMesh_.pointZones().findZoneID(coeffDict().lookup("frozenPointsZone"))
? fvMesh_.pointZones().findZoneID
(
coeffDict().get<word>("frozenPointsZone")
)
: -1
)
{
@ -178,7 +181,10 @@ displacementLaplacianFvMotionSolver
frozenPointsZone_
(
coeffDict().found("frozenPointsZone")
? fvMesh_.pointZones().findZoneID(coeffDict().lookup("frozenPointsZone"))
? fvMesh_.pointZones().findZoneID
(
coeffDict().get<word>("frozenPointsZone")
)
: -1
)
{

View File

@ -97,7 +97,10 @@ solidBodyDisplacementLaplacianFvMotionSolver
frozenPointsZone_
(
coeffDict().found("frozenPointsZone")
? fvMesh_.pointZones().findZoneID(coeffDict().lookup("frozenPointsZone"))
? fvMesh_.pointZones().findZoneID
(
coeffDict().get<word>("frozenPointsZone")
)
: -1
)
{
@ -183,7 +186,10 @@ solidBodyDisplacementLaplacianFvMotionSolver
frozenPointsZone_
(
coeffDict().found("frozenPointsZone")
? fvMesh_.pointZones().findZoneID(coeffDict().lookup("frozenPointsZone"))
? fvMesh_.pointZones().findZoneID
(
coeffDict().get<word>("frozenPointsZone")
)
: -1
)
{

View File

@ -316,10 +316,10 @@ surfaceDisplacementPointPatchVectorField
)
:
fixedValuePointPatchVectorField(p, iF, dict),
velocity_(dict.lookup("velocity")),
velocity_(dict.get<vector>("velocity")),
surfacesDict_(dict.subDict("geometry")),
projectMode_(projectModeNames_.get("projectMode", dict)),
projectDir_(dict.lookup("projectDirection")),
projectDir_(dict.get<vector>("projectDirection")),
wedgePlane_(dict.lookupOrDefault("wedgePlane", -1)),
frozenPointsZone_(dict.lookupOrDefault("frozenPointsZone", word::null))
{

View File

@ -110,7 +110,7 @@ private:
//- Plane for 2D wedge case or -1.
const label wedgePlane_;
//- pointZone with frozen points
//- Name of pointZone with frozen points
const word frozenPointsZone_;
//- Demand driven: surface to project

View File

@ -317,7 +317,7 @@ surfaceSlipDisplacementPointPatchVectorField
pointPatchVectorField(p, iF, dict),
surfacesDict_(dict.subDict("geometry")),
projectMode_(projectModeNames_.get("projectMode", dict)),
projectDir_(dict.lookup("projectDirection")),
projectDir_(dict.get<vector>("projectDirection")),
wedgePlane_(dict.lookupOrDefault("wedgePlane", -1)),
frozenPointsZone_(dict.lookupOrDefault("frozenPointsZone", word::null))
{}

View File

@ -153,11 +153,9 @@ void Foam::fv::CodedSource<Type>::correct
GeometricField<Type, fvPatchField, volMesh>& field
)
{
if (debug)
{
Info<< "CodedSource<"<< pTraits<Type>::typeName
<< ">::correct for source " << name_ << endl;
}
DebugInfo
<< "CodedSource<" << pTraits<Type>::typeName
<< ">::correct for source " << name_ << endl;
updateLibrary(name_);
redirectFvOption().correct(field);
@ -171,11 +169,9 @@ void Foam::fv::CodedSource<Type>::addSup
const label fieldi
)
{
if (debug)
{
Info<< "CodedSource<"<< pTraits<Type>::typeName
<< ">::addSup for source " << name_ << endl;
}
DebugInfo
<< "CodedSource<" << pTraits<Type>::typeName
<< ">::addSup for source " << name_ << endl;
updateLibrary(name_);
redirectFvOption().addSup(eqn, fieldi);
@ -190,11 +186,9 @@ void Foam::fv::CodedSource<Type>::addSup
const label fieldi
)
{
if (debug)
{
Info<< "CodedSource<"<< pTraits<Type>::typeName
<< ">::addSup for source " << name_ << endl;
}
DebugInfo
<< "CodedSource<" << pTraits<Type>::typeName
<< ">::addSup for source " << name_ << endl;
updateLibrary(name_);
redirectFvOption().addSup(rho, eqn, fieldi);
@ -208,11 +202,9 @@ void Foam::fv::CodedSource<Type>::constrain
const label fieldi
)
{
if (debug)
{
Info<< "CodedSource<"<< pTraits<Type>::typeName
<< ">::constrain for source " << name_ << endl;
}
DebugInfo
<< "CodedSource<" << pTraits<Type>::typeName
<< ">::constrain for source " << name_ << endl;
updateLibrary(name_);
redirectFvOption().constrain(eqn, fieldi);

View File

@ -43,7 +43,8 @@ bool Foam::fv::CodedSource<Type>::read(const dictionary& dict)
const entry& e =
coeffs_.lookupEntry("codeCorrect", keyType::LITERAL);
codeCorrect_ = stringOps::trim(e.stream());
e.readEntry(codeCorrect_);
stringOps::inplaceTrim(codeCorrect_);
stringOps::inplaceExpand(codeCorrect_, coeffs_);
dynamicCodeContext::addLineDirective
(
@ -57,7 +58,8 @@ bool Foam::fv::CodedSource<Type>::read(const dictionary& dict)
const entry& e =
coeffs_.lookupEntry("codeAddSup", keyType::LITERAL);
codeAddSup_ = stringOps::trim(e.stream());
e.readEntry(codeAddSup_);
stringOps::inplaceTrim(codeAddSup_);
stringOps::inplaceExpand(codeAddSup_, coeffs_);
dynamicCodeContext::addLineDirective
(
@ -71,7 +73,8 @@ bool Foam::fv::CodedSource<Type>::read(const dictionary& dict)
const entry& e =
coeffs_.lookupEntry("codeSetValue", keyType::LITERAL);
codeSetValue_ = stringOps::trim(e.stream());
e.readEntry(codeSetValue_);
stringOps::inplaceTrim(codeSetValue_);
stringOps::inplaceExpand(codeSetValue_, coeffs_);
dynamicCodeContext::addLineDirective
(

View File

@ -45,17 +45,17 @@ Foam::FieldActivatedInjection<CloudType>::FieldActivatedInjection
(
owner.db().objectRegistry::template lookupObject<volScalarField>
(
this->coeffDict().lookup("referenceField")
this->coeffDict().getWord("referenceField")
)
),
thresholdField_
(
owner.db().objectRegistry::template lookupObject<volScalarField>
(
this->coeffDict().lookup("thresholdField")
this->coeffDict().getWord("thresholdField")
)
),
positionsFile_(this->coeffDict().lookup("positionsFile")),
positionsFile_(this->coeffDict().getWord("positionsFile")),
positions_
(
IOobject
@ -74,8 +74,11 @@ Foam::FieldActivatedInjection<CloudType>::FieldActivatedInjection
(
this->coeffDict().getLabel("parcelsPerInjector")
),
nParcelsInjected_(positions_.size(), 0),
U0_(this->coeffDict().lookup("U0")),
nParcelsInjected_(positions_.size(), Zero),
U0_
(
this->coeffDict().template get<vector>("U0")
),
diameters_(positions_.size()),
sizeDistribution_
(

View File

@ -40,7 +40,7 @@ Foam::PatchFlowRateInjection<CloudType>::PatchFlowRateInjection
)
:
InjectionModel<CloudType>(dict, owner, modelName,typeName),
patchInjectionBase(owner.mesh(), this->coeffDict().lookup("patch")),
patchInjectionBase(owner.mesh(), this->coeffDict().getWord("patch")),
phiName_(this->coeffDict().template lookupOrDefault<word>("phi", "phi")),
rhoName_(this->coeffDict().template lookupOrDefault<word>("rho", "rho")),
duration_(this->coeffDict().getScalar("duration")),

View File

@ -38,7 +38,7 @@ Foam::PatchInjection<CloudType>::PatchInjection
)
:
InjectionModel<CloudType>(dict, owner, modelName, typeName),
patchInjectionBase(owner.mesh(), this->coeffDict().lookup("patch")),
patchInjectionBase(owner.mesh(), this->coeffDict().getWord("patch")),
duration_(this->coeffDict().getScalar("duration")),
parcelsPerSecond_
(

View File

@ -75,12 +75,6 @@ Foam::patchInjectionBase::patchInjectionBase(const patchInjectionBase& pib)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::patchInjectionBase::~patchInjectionBase()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::patchInjectionBase::updateMesh(const polyMesh& mesh)

View File

@ -51,7 +51,7 @@ SourceFiles
namespace Foam
{
// Forward class declarations
// Forward declarations
class polyMesh;
class fvMesh;
class Random;
@ -106,7 +106,7 @@ public:
//- Destructor
virtual ~patchInjectionBase();
virtual ~patchInjectionBase() = default;
// Member Functions

View File

@ -60,7 +60,7 @@ Foam::ErgunWenYuDragForce<CloudType>::ErgunWenYuDragForce
(
this->mesh().template lookupObject<volScalarField>
(
this->coeffs().lookup("alphac")
this->coeffs().getWord("alphac")
)
)
{}
@ -77,7 +77,7 @@ Foam::ErgunWenYuDragForce<CloudType>::ErgunWenYuDragForce
(
this->mesh().template lookupObject<volScalarField>
(
this->coeffs().lookup("alphac")
this->coeffs().getWord("alphac")
)
)
{}

View File

@ -60,7 +60,7 @@ Foam::PlessisMasliyahDragForce<CloudType>::PlessisMasliyahDragForce
(
this->mesh().template lookupObject<volScalarField>
(
this->coeffs().lookup("alphac")
this->coeffs().getWord("alphac")
)
)
{}
@ -77,7 +77,7 @@ Foam::PlessisMasliyahDragForce<CloudType>::PlessisMasliyahDragForce
(
this->mesh().template lookupObject<volScalarField>
(
this->coeffs().lookup("alphac")
this->coeffs().getWord("alphac")
)
)
{}

View File

@ -57,7 +57,7 @@ Foam::WenYuDragForce<CloudType>::WenYuDragForce
(
this->mesh().template lookupObject<volScalarField>
(
this->coeffs().lookup("alphac")
this->coeffs().getWord("alphac")
)
)
{}
@ -74,7 +74,7 @@ Foam::WenYuDragForce<CloudType>::WenYuDragForce
(
this->mesh().template lookupObject<volScalarField>
(
this->coeffs().lookup("alphac")
this->coeffs().getWord("alphac")
)
)
{}

View File

@ -95,19 +95,12 @@ Foam::PhaseChangeModel<CloudType>::PhaseChangeModel
CloudSubModelBase<CloudType>(owner, dict, typeName, type),
enthalpyTransfer_
(
wordToEnthalpyTransfer(this->coeffDict().lookup("enthalpyTransfer"))
wordToEnthalpyTransfer(this->coeffDict().getWord("enthalpyTransfer"))
),
dMass_(0.0)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class CloudType>
Foam::PhaseChangeModel<CloudType>::~PhaseChangeModel()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>

View File

@ -60,7 +60,7 @@ class PhaseChangeModel
{
public:
// Public enumerations
// Public Enumerations
//- Enthalpy transfer type
enum enthalpyTransferType
@ -70,7 +70,7 @@ public:
};
//- Name representations of enthalpy transfer types
static const Foam::wordList enthalpyTransferTypeNames;
static const wordList enthalpyTransferTypeNames;
protected:
@ -136,7 +136,7 @@ public:
//- Destructor
virtual ~PhaseChangeModel();
virtual ~PhaseChangeModel() = default;
//- Selector

View File

@ -489,7 +489,7 @@ Foam::ThermoSurfaceFilm<CloudType>::ThermoSurfaceFilm
CpFilmPatch_(0),
interactionType_
(
interactionTypeEnum(this->coeffDict().lookup("interactionType"))
interactionTypeEnum(this->coeffDict().getWord("interactionType"))
),
deltaWet_(0.0),
splashParcelType_(0),

View File

@ -118,7 +118,7 @@ Foam::displacementMotionSolverMeshMover::displacementMotionSolverMeshMover
(
displacementMotionSolver::New
(
dict.lookup("solver"),
dict.get<word>("solver"),
pointDisplacement.mesh()(),
IOdictionary
(

View File

@ -48,7 +48,7 @@ Foam::RBD::restraint::restraint
)
:
name_(name),
bodyID_(model.bodyID(dict.lookup("body"))),
bodyID_(model.bodyID(dict.get<word>("body"))),
bodyIndex_(model.master(bodyID_)),
coeffs_(dict),
model_(model)

View File

@ -60,7 +60,7 @@ namespace RBD
class rigidBodyModel;
/*---------------------------------------------------------------------------*\
Class restraint Declaration
Class restraint Declaration
\*---------------------------------------------------------------------------*/
class restraint

View File

@ -194,7 +194,7 @@ Foam::RBD::rigidBodyModel::rigidBodyModel
{
merge
(
bodyID(bodyDict.lookup("mergeWith")),
bodyID(bodyDict.get<word>("mergeWith")),
bodyDict.lookup("transform"),
rigidBody::New(key, bodyDict)
);
@ -203,7 +203,7 @@ Foam::RBD::rigidBodyModel::rigidBodyModel
{
join
(
bodyID(bodyDict.lookup("parent")),
bodyID(bodyDict.get<word>("parent")),
bodyDict.lookup("transform"),
joint::New(bodyDict.subDict("joint")),
rigidBody::New(key, bodyDict)

View File

@ -64,16 +64,16 @@ Foam::autoPtr<ChemistryModel> Foam::basicChemistryModel::New
const dictionary& chemistryTypeDict =
chemistryDict.subDict("chemistryType");
const word& solverName
const word solverName
(
chemistryTypeDict.found("solver")
? chemistryTypeDict.lookup("solver")
: chemistryTypeDict.found("chemistrySolver")
? chemistryTypeDict.lookup("chemistrySolver")
: chemistryTypeDict.lookup("solver") // error if neither entry is found
chemistryTypeDict.getCompat<word>
(
"solver",
{{"chemistrySolver", -1712}}
)
);
const word& methodName
const word methodName
(
chemistryTypeDict.lookupOrDefault<word>
(
@ -90,8 +90,7 @@ Foam::autoPtr<ChemistryModel> Foam::basicChemistryModel::New
Info<< "Selecting chemistry solver " << chemistryTypeDictNew << endl;
typedef typename ChemistryModel::thermoConstructorTable cstrTableType;
cstrTableType* cstrTable = ChemistryModel::thermoConstructorTablePtr_;
auto* cstrTable = ChemistryModel::thermoConstructorTablePtr_;
const word chemSolverCompThermoName =
solverName + '<' + methodName + '<'
@ -106,7 +105,7 @@ Foam::autoPtr<ChemistryModel> Foam::basicChemistryModel::New
<< "Unknown " << typeName_() << " type " << solverName << endl
<< endl;
const wordList names(cstrTable->toc());
const wordList names(cstrTable->sortedToc());
wordList thisCmpts;
thisCmpts.append(word::null);
@ -123,7 +122,7 @@ Foam::autoPtr<ChemistryModel> Foam::basicChemistryModel::New
const wordList cmpts(basicThermo::splitThermoName(names[i], 8));
bool isValid = true;
for (label i = 2; i < cmpts.size() && isValid; ++ i)
for (label i = 2; i < cmpts.size() && isValid; ++i)
{
isValid = isValid && cmpts[i] == thisCmpts[i];
}

View File

@ -91,28 +91,28 @@ Foam::radiation::greyMeanAbsorptionEmission::greyMeanAbsorptionEmission
nFunc++;
}
if (coeffsDict_.found("lookUpTableFileName"))
if
(
coeffsDict_.found("lookUpTableFileName")
&& "none" != coeffsDict_.get<word>("lookUpTableFileName")
)
{
const word name = coeffsDict_.lookup("lookUpTableFileName");
if (name != "none")
{
lookUpTablePtr_.reset
lookUpTablePtr_.reset
(
new interpolationLookUpTable<scalar>
(
new interpolationLookUpTable<scalar>
(
fileName(coeffsDict_.lookup("lookUpTableFileName")),
mesh.time().constant(),
mesh
)
);
coeffsDict_.get<fileName>("lookUpTableFileName"),
mesh.time().constant(),
mesh
)
);
if (!mesh.foundObject<volScalarField>("ft"))
{
FatalErrorInFunction
<< "specie ft is not present to use with "
<< "lookUpTableFileName " << nl
<< exit(FatalError);
}
if (!mesh.foundObject<volScalarField>("ft"))
{
FatalErrorInFunction
<< "specie ft is not present to use with "
<< "lookUpTableFileName " << nl
<< exit(FatalError);
}
}
@ -213,7 +213,7 @@ Foam::radiation::greyMeanAbsorptionEmission::aCont(const label bandI) const
forAll(a, celli)
{
forAllConstIter(HashTable<label>, speciesNames_, iter)
forAllConstIters(speciesNames_, iter)
{
label n = iter();
scalar Xipi = 0.0;

View File

@ -102,28 +102,28 @@ Foam::radiation::wideBandAbsorptionEmission::wideBandAbsorptionEmission
}
nBands_ = nBand;
if (coeffsDict_.found("lookUpTableFileName"))
if
(
coeffsDict_.found("lookUpTableFileName")
&& "none" != coeffsDict_.get<word>("lookUpTableFileName")
)
{
const word name = coeffsDict_.lookup("lookUpTableFileName");
if (name != "none")
{
lookUpTablePtr_.set
lookUpTablePtr_.set
(
new interpolationLookUpTable<scalar>
(
new interpolationLookUpTable<scalar>
(
fileName(coeffsDict_.lookup("lookUpTableFileName")),
mesh.time().constant(),
mesh
)
);
coeffsDict_.get<fileName>("lookUpTableFileName"),
mesh.time().constant(),
mesh
)
);
if (!mesh.foundObject<volScalarField>("ft"))
{
FatalErrorInFunction
<< "specie ft is not present to use with "
<< "lookUpTableFileName " << nl
<< exit(FatalError);
}
if (!mesh.foundObject<volScalarField>("ft"))
{
FatalErrorInFunction
<< "specie ft is not present to use with "
<< "lookUpTableFileName " << nl
<< exit(FatalError);
}
}
@ -224,7 +224,7 @@ Foam::radiation::wideBandAbsorptionEmission::aCont(const label bandi) const
forAll(a, celli)
{
forAllConstIter(HashTable<label>, speciesNames_, iter)
forAllConstIters(speciesNames_, iter)
{
const label n = iter();
scalar Xipi = 0;

View File

@ -51,7 +51,7 @@ void Foam::singleStepReactingMixture<ThermoType>::calculateqFuel()
specieProd_[speciei] = -1;
}
Info << "Fuel heat of combustion :" << qFuel_.value() << endl;
Info<< "Fuel heat of combustion :" << qFuel_.value() << endl;
}
@ -73,9 +73,9 @@ void Foam::singleStepReactingMixture<ThermoType>::massAndAirStoichRatios()
* mag(specieStoichCoeffs_[O2Index]))
/ (Wu*mag(specieStoichCoeffs_[fuelIndex_]));
Info << "stoichiometric air-fuel ratio :" << stoicRatio_.value() << endl;
Info<< "stoichiometric air-fuel ratio :" << stoicRatio_.value() << endl;
Info << "stoichiometric oxygen-fuel ratio :" << s_.value() << endl;
Info<< "stoichiometric oxygen-fuel ratio :" << s_.value() << endl;
}
@ -108,7 +108,7 @@ void Foam::singleStepReactingMixture<ThermoType>::calculateMaxProducts()
Yprod0_[speciei] = this->speciesData()[speciei].W()/Wm*Xi[i];
}
Info << "Maximum products mass concentrations:" << nl;
Info<< "Maximum products mass concentrations:" << nl;
forAll(Yprod0_, i)
{
if (Yprod0_[i] > 0)
@ -202,8 +202,8 @@ Foam::singleStepReactingMixture<ThermoType>::singleStepReactingMixture
specieStoichCoeffs_(this->species_.size(), Zero),
Yprod0_(this->species_.size(), Zero),
fres_(Yprod0_.size()),
inertIndex_(this->species()[thermoDict.lookup("inertSpecie")]),
fuelIndex_(this->species()[thermoDict.lookup("fuel")]),
inertIndex_(this->species()[thermoDict.get<word>("inertSpecie")]),
fuelIndex_(this->species()[thermoDict.get<word>("fuel")]),
specieProd_(Yprod0_.size(), 1)
{
if (this->size() == 1)

View File

@ -74,7 +74,7 @@ Foam::solidReaction<ReactionThermo>::solidReaction
{
this->setLRhs
(
IStringStream(dict.lookup("reaction"))(),
IStringStream(dict.getString("reaction"))(),
pyrolisisGases_,
glhs_,
grhs_

View File

@ -335,7 +335,7 @@ Foam::Reaction<ReactionThermo>::Reaction
{
setLRhs
(
IStringStream(dict.lookup("reaction"))(),
IStringStream(dict.getString("reaction"))(),
species_,
lhs_,
rhs_