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;
}
}