use dictionary lookupOrDefault() method instead of found() + lookup()

This commit is contained in:
Mark Olesen
2008-06-13 15:51:31 +02:00
parent 92cd94ac66
commit f48cbb88a9
3 changed files with 3 additions and 27 deletions

View File

@ -140,7 +140,7 @@ Foam::sampledPatch::sampledPatch
patchFaceLabels_(0) patchFaceLabels_(0)
{ {
// default: non-triangulated // default: non-triangulated
triangulate() = getBool(dict, "triangulate", false); triangulate() = dict.lookupOrDefault("triangulate", false);
createGeometry(); createGeometry();
} }

View File

@ -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 * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::sampledSurface::sampledSurface Foam::sampledSurface::sampledSurface
@ -200,8 +181,8 @@ Foam::sampledSurface::sampledSurface
: :
name_(name), name_(name),
mesh_(mesh), mesh_(mesh),
triangulate_(getBool(dict, "triangulate", true)), triangulate_(dict.lookupOrDefault("triangulate", true)),
interpolate_(getBool(dict, "interpolate", false)), interpolate_(dict.lookupOrDefault("interpolate", false)),
SfPtr_(NULL), SfPtr_(NULL),
magSfPtr_(NULL), magSfPtr_(NULL),
CfPtr_(NULL), CfPtr_(NULL),

View File

@ -128,11 +128,6 @@ class sampledSurface
protected: 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 // Protected Member functions
virtual void clearGeom() const; virtual void clearGeom() const;