use dictionary::readIfPresent wherever reasonable

This commit is contained in:
Mark Olesen
2008-07-20 14:07:49 +02:00
parent 7f9631634d
commit a48bc8746a
33 changed files with 129 additions and 337 deletions

View File

@ -34,25 +34,10 @@ License
template<class OutputFilter>
void Foam::OutputFilterFunctionObject<OutputFilter>::readDict()
{
if (dict_.found("region"))
{
dict_.lookup("region") >> regionName_;
}
if (dict_.found("dictionary"))
{
dict_.lookup("dictionary") >> dictName_;
}
if (dict_.found("interval"))
{
dict_.lookup("interval") >> interval_;
}
if (dict_.found("enabled"))
{
dict_.lookup("enabled") >> execution_;
}
dict_.readIfPresent("region", regionName_);
dict_.readIfPresent("dictionary", dictName_);
dict_.readIfPresent("interval", interval_);
dict_.readIfPresent("enabled", execution_);
}

View File

@ -289,16 +289,10 @@ void Foam::sampledSets::read(const dictionary& dict)
fieldNames_ = wordList(dict_.lookup("fields"));
interpolationScheme_ = "cell";
if (dict_.found("interpolationScheme"))
{
dict_.lookup("interpolationScheme") >> interpolationScheme_;
}
dict_.readIfPresent("interpolationScheme", interpolationScheme_);
writeFormat_ = "null";
if (dict_.found("setFormat"))
{
dict_.lookup("setFormat") >> writeFormat_;
}
dict_.readIfPresent("setFormat", writeFormat_);
scalarFields_.clear();
vectorFields_.clear();

View File

@ -156,9 +156,8 @@ Foam::sampledPlane::sampledPlane
label zoneId = -1;
if (dict.found("zone"))
if (dict.readIfPresent("zone", zoneName_))
{
dict.lookup("zone") >> zoneName_;
zoneId = mesh.cellZones().findZoneID(zoneName_);
if (debug && zoneId < 0)
{

View File

@ -188,10 +188,7 @@ Foam::sampledSurface::sampledSurface
CfPtr_(NULL),
area_(-1)
{
if (dict.found("name"))
{
dict.lookup("name") >> name_;
}
dict.readIfPresent("name", name_);
}

View File

@ -327,16 +327,10 @@ void Foam::sampledSurfaces::read(const dictionary& dict)
fieldNames_ = wordList(dict.lookup("fields"));
interpolationScheme_ = "cell";
if (dict.found("interpolationScheme"))
{
dict.lookup("interpolationScheme") >> interpolationScheme_;
}
dict.readIfPresent("interpolationScheme", interpolationScheme_);
writeFormat_ = "null";
if (dict.found("surfaceFormat"))
{
dict.lookup("surfaceFormat") >> writeFormat_;
}
dict.readIfPresent("surfaceFormat", writeFormat_);
PtrList<sampledSurface> newList