use dictionary lookupOrDefault() method instead of found() + lookup()
This commit is contained in:
parent
92cd94ac66
commit
f48cbb88a9
@ -140,7 +140,7 @@ Foam::sampledPatch::sampledPatch
|
||||
patchFaceLabels_(0)
|
||||
{
|
||||
// default: non-triangulated
|
||||
triangulate() = getBool(dict, "triangulate", false);
|
||||
triangulate() = dict.lookupOrDefault("triangulate", false);
|
||||
createGeometry();
|
||||
}
|
||||
|
||||
|
@ -151,25 +151,6 @@ Foam::sampledSurface::New
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::sampledSurface::getBool
|
||||
(
|
||||
const dictionary& dict,
|
||||
const word& key,
|
||||
const bool defaultVal
|
||||
)
|
||||
{
|
||||
if (dict.found(key))
|
||||
{
|
||||
return readBool(dict.lookup(key));
|
||||
}
|
||||
else
|
||||
{
|
||||
return defaultVal;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::sampledSurface::sampledSurface
|
||||
@ -200,8 +181,8 @@ Foam::sampledSurface::sampledSurface
|
||||
:
|
||||
name_(name),
|
||||
mesh_(mesh),
|
||||
triangulate_(getBool(dict, "triangulate", true)),
|
||||
interpolate_(getBool(dict, "interpolate", false)),
|
||||
triangulate_(dict.lookupOrDefault("triangulate", true)),
|
||||
interpolate_(dict.lookupOrDefault("interpolate", false)),
|
||||
SfPtr_(NULL),
|
||||
magSfPtr_(NULL),
|
||||
CfPtr_(NULL),
|
||||
|
@ -128,11 +128,6 @@ class sampledSurface
|
||||
|
||||
protected:
|
||||
|
||||
// Protected static functions
|
||||
|
||||
//- Read bool from dictionary. Return provided value if not found
|
||||
static bool getBool(const dictionary&, const word&, const bool);
|
||||
|
||||
// Protected Member functions
|
||||
|
||||
virtual void clearGeom() const;
|
||||
|
Loading…
Reference in New Issue
Block a user