Commit f00c7a65 authored by Mark Olesen's avatar Mark Olesen
Browse files

COMP: rename dictionary::read<T> to dictionary::readEntry<T>

- avoids compiler ambiguity when virtual methods such as
  IOdictionary::read() exist.

- the method was introduced in 1806, and was thus not yet widely used
parent 21557091
......@@ -81,7 +81,7 @@ bool Foam::PDRDragModel::read(const dictionary& PDRProperties)
{
PDRDragModelCoeffs_ = PDRProperties.optionalSubDict(type() + "Coeffs");
PDRDragModelCoeffs_.read("drag", on_);
PDRDragModelCoeffs_.readEntry("drag", on_);
return true;
}
......
......@@ -165,8 +165,8 @@ bool Foam::PDRDragModels::basic::read(const dictionary& PDRProperties)
{
PDRDragModel::read(PDRProperties);
PDRDragModelCoeffs_.read("Csu", Csu.value());
PDRDragModelCoeffs_.read("Csk", Csk.value());
PDRDragModelCoeffs_.readEntry("Csu", Csu.value());
PDRDragModelCoeffs_.readEntry("Csk", Csk.value());
return true;
}
......
runTime.controlDict().read("adjustTimeStep", adjustTimeStep);
runTime.controlDict().readEntry("adjustTimeStep", adjustTimeStep);
runTime.controlDict().read("maxDeltaT", maxDeltaT);
runTime.controlDict().readEntry("maxDeltaT", maxDeltaT);
#include "readDyMControls.H"
correctPhi = pimple.dict().lookupOrDefault("correctPhi", true);
maxAcousticCo = readScalar(runTime.controlDict().lookup("maxAcousticCo"));
maxAcousticCo = runTime.controlDict().get<scalar>("maxAcousticCo");
#include "readTimeControls.H"
maxAcousticCo = readScalar(runTime.controlDict().lookup("maxAcousticCo"));
maxAcousticCo = runTime.controlDict().get<scalar>("maxAcousticCo");
......@@ -112,7 +112,7 @@ Foam::boundaryInfo::boundaryInfo(const Time& runTime, const word& regionName)
const dictionary& dict = boundaryDict_[patchI].dict();
names_[patchI] = dict.dictName();
dict.read("type", types_[patchI]);
dict.readEntry("type", types_[patchI]);
if (polyPatch::constraintType(types_[patchI]))
{
constraint_[patchI] = true;
......
......@@ -120,12 +120,12 @@ Foam::dictionary Foam::solverTemplate::readFluidFieldTemplates
else if (modelType == "RAS")
{
turbPropDict.subDict(modelType)
.read("RASModel", turbulenceModel);
.readEntry("RASModel", turbulenceModel);
}
else if (modelType == "LES")
{
turbPropDict.subDict(modelType)
.read("LESModel", turbulenceModel);
.readEntry("LESModel", turbulenceModel);
}
else
{
......
Subproject commit 2ac2c5ec6e3bec25b3e4b641781adcd78d8dd20b
Subproject commit 4575b54c6f9ce3bfcbeee246b46b0fb8f69529e0
......@@ -67,11 +67,17 @@ bool Foam::IOobject::readHeader(Istream& is)
{
const dictionary headerDict(is);
is.version(headerDict.lookup("version"));
is.format(headerDict.lookup("format"));
headerClassName_ = word(headerDict.lookup("class"));
const word headerObject(headerDict.lookup("object"));
is.version
(
IOstreamOption::versionNumber
(
headerDict.get<float>("version")
)
);
is.format(headerDict.get<word>("format"));
headerClassName_ = headerDict.get<word>("class");
const word headerObject(headerDict.get<word>("object"));
if (IOobject::debug && headerObject != name())
{
IOWarningInFunction(is)
......
......@@ -1166,8 +1166,14 @@ Foam::label Foam::decomposedBlockData::numBlocks(const fileName& fName)
)
{
dictionary headerDict(is);
is.version(headerDict.lookup("version"));
is.format(headerDict.lookup("format"));
is.version
(
IOstreamOption::versionNumber
(
headerDict.get<float>("version")
)
);
is.format(headerDict.get<word>("format"));
// Obtain number of blocks directly
if (headerDict.readIfPresent("blocks", nBlocks))
......
......@@ -149,7 +149,7 @@ void Foam::Time::setControls()
if (startFrom == "startTime")
{
controlDict_.lookup("startTime") >> startTime_;
controlDict_.readEntry("startTime", startTime_);
}
else
{
......@@ -938,7 +938,7 @@ bool Foam::Time::stopAt(const stopAtControls stopCtrl) const
// Adjust endTime
if (stopCtrl == stopAtControls::saEndTime)
{
controlDict_.lookup("endTime") >> endTime_;
controlDict_.readEntry("endTime", endTime_);
}
return changed;
......
......@@ -344,7 +344,7 @@ void Foam::Time::readDict()
if (!deltaTchanged_)
{
deltaT_ = readScalar(controlDict_.lookup("deltaT"));
controlDict_.readEntry("deltaT", deltaT_);
}
if (controlDict_.found("writeControl"))
......@@ -369,7 +369,7 @@ void Foam::Time::readDict()
}
else
{
controlDict_.lookup("writeFrequency") >> writeInterval_;
controlDict_.readEntry("writeFrequency", writeInterval_);
}
......@@ -409,7 +409,7 @@ void Foam::Time::readDict()
if (controlDict_.found("timeFormat"))
{
const word formatName(controlDict_.lookup("timeFormat"));
const word formatName(controlDict_.get<word>("timeFormat"));
if (formatName == "general")
{
......@@ -441,7 +441,7 @@ void Foam::Time::readDict()
if (stopAt_ == saEndTime)
{
controlDict_.lookup("endTime") >> endTime_;
controlDict_.readEntry("endTime", endTime_);
}
else
{
......@@ -468,14 +468,14 @@ void Foam::Time::readDict()
if (controlDict_.found("writeFormat"))
{
writeStreamOption_.format(word(controlDict_.lookup("writeFormat")));
writeStreamOption_.format(controlDict_.get<word>("writeFormat"));
}
if (controlDict_.found("writePrecision"))
{
IOstream::defaultPrecision
(
readUint(controlDict_.lookup("writePrecision"))
controlDict_.get<unsigned int>("writePrecision")
);
Sout.precision(IOstream::defaultPrecision());
......@@ -495,7 +495,7 @@ void Foam::Time::readDict()
{
writeStreamOption_.compression
(
word(controlDict_.lookup("writeCompression"))
controlDict_.get<word>("writeCompression")
);
if
......
......@@ -477,7 +477,7 @@ Foam::dictionary& Foam::dictionary::subDict(const word& keyword)
Foam::dictionary Foam::dictionary::subOrEmptyDict
(
const word& keyword,
const bool mustRead
const bool mandatory
) const
{
// Find non-recursive with patterns
......@@ -489,7 +489,7 @@ Foam::dictionary Foam::dictionary::subOrEmptyDict
return finder.dict();
}
if (mustRead)
if (mandatory)
{
FatalIOErrorInFunction(*this)
<< "'" << keyword
......
......@@ -405,7 +405,7 @@ public:
explicit dictionary(const fileName& name);
//- Construct given the entry name, parent dictionary and Istream,
// reading entries until EOF
//- reading entries until EOF
dictionary
(
const fileName& name,
......@@ -414,11 +414,11 @@ public:
);
//- Construct top-level dictionary from Istream,
// reading entries until EOF
//- reading entries until EOF
dictionary(Istream& is);
//- Construct top-level dictionary from Istream,
// reading entries until EOF, optionally keeping the header
//- reading entries until EOF, optionally keeping the header
dictionary(Istream& is, bool keepHeader);
//- Copy construct given the parent dictionary
......@@ -604,7 +604,7 @@ public:
//
// \return true if the entry was found.
template<class T>
bool read
bool readEntry
(
const word& keyword,
T& val,
......@@ -682,7 +682,7 @@ public:
dictionary subOrEmptyDict
(
const word& keyword,
const bool mustRead = false
const bool mandatory = false
) const;
//- Find and return a sub-dictionary, otherwise return this dictionary.
......
......@@ -58,7 +58,7 @@ T Foam::dictionary::get
) const
{
T val;
read<T>(keyword, val, recursive, patternMatch);
readEntry<T>(keyword, val, recursive, patternMatch);
return val;
}
......@@ -196,7 +196,7 @@ T Foam::dictionary::lookupOrAddDefault
template<class T>
bool Foam::dictionary::read
bool Foam::dictionary::readEntry
(
const word& keyword,
T& val,
......@@ -238,7 +238,7 @@ bool Foam::dictionary::readIfPresent
) const
{
// Read is non-mandatory
return read<T>(keyword, val, recursive, patternMatch, false);
return readEntry<T>(keyword, val, recursive, patternMatch, false);
}
......
......@@ -44,9 +44,9 @@ Foam::IOerror::IOerror(const string& title)
Foam::IOerror::IOerror(const dictionary& errDict)
:
error(errDict),
ioFileName_(errDict.lookup("ioFileName")),
ioStartLineNumber_(readLabel(errDict.lookup("ioStartLineNumber"))),
ioEndLineNumber_(readLabel(errDict.lookup("ioEndLineNumber")))
ioFileName_(errDict.get<string>("ioFileName")),
ioStartLineNumber_(errDict.get<label>("ioStartLineNumber")),
ioEndLineNumber_(errDict.get<label>("ioEndLineNumber"))
{}
......
......@@ -92,9 +92,9 @@ Foam::error::error(const dictionary& errDict)
:
std::exception(),
messageStream(errDict),
functionName_(errDict.lookup("functionName")),
sourceFileName_(errDict.lookup("sourceFileName")),
sourceFileLineNumber_(readLabel(errDict.lookup("sourceFileLineNumber"))),
functionName_(errDict.get<string>("functionName")),
sourceFileName_(errDict.get<string>("sourceFileName")),
sourceFileLineNumber_(errDict.get<label>("sourceFileLineNumber")),
throwExceptions_(false),
messageStreamPtr_(new OStringStream())
{
......
......@@ -54,7 +54,7 @@ Foam::messageStream::messageStream
Foam::messageStream::messageStream(const dictionary& dict)
:
title_(dict.lookup("title")),
title_(dict.get<string>("title")),
severity_(FATAL),
maxErrors_(0),
errorCount_(0)
......
......@@ -66,7 +66,7 @@ Foam::autoPtr<Foam::functionObject> Foam::functionObject::New
const dictionary& dict
)
{
const word functionType(dict.lookup("type"));
const word functionType(dict.get<word>("type"));
if (debug)
{
......
......@@ -309,11 +309,11 @@ bool Foam::functionObjectList::readFunctionObject
}
else if (funcDict.found("field"))
{
requiredFields.insert(wordRe(funcDict.lookup("field")));
requiredFields.insert(funcDict.get<wordRe>("field"));
}
else if (funcDict.found("fields"))
{
requiredFields.insert(wordReList(funcDict.lookup("fields")));
requiredFields.insert(funcDict.get<wordRes>("fields"));
}
// Insert named arguments
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment