mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
use dictionary::readIfPresent wherever reasonable
This commit is contained in:
@ -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_);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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)
|
||||
{
|
||||
|
||||
@ -188,10 +188,7 @@ Foam::sampledSurface::sampledSurface
|
||||
CfPtr_(NULL),
|
||||
area_(-1)
|
||||
{
|
||||
if (dict.found("name"))
|
||||
{
|
||||
dict.lookup("name") >> name_;
|
||||
}
|
||||
dict.readIfPresent("name", name_);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
Reference in New Issue
Block a user