From f48cbb88a94771294fcc14c6aecc7d7506d50898 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Fri, 13 Jun 2008 15:51:31 +0200 Subject: [PATCH] use dictionary lookupOrDefault() method instead of found() + lookup() --- .../sampledSurface/patch/sampledPatch.C | 2 +- .../sampledSurface/sampledSurface.C | 23 ++----------------- .../sampledSurface/sampledSurface.H | 5 ---- 3 files changed, 3 insertions(+), 27 deletions(-) diff --git a/src/sampling/sampledSurface/patch/sampledPatch.C b/src/sampling/sampledSurface/patch/sampledPatch.C index 2b4f636ee7..8ca36d42f5 100644 --- a/src/sampling/sampledSurface/patch/sampledPatch.C +++ b/src/sampling/sampledSurface/patch/sampledPatch.C @@ -140,7 +140,7 @@ Foam::sampledPatch::sampledPatch patchFaceLabels_(0) { // default: non-triangulated - triangulate() = getBool(dict, "triangulate", false); + triangulate() = dict.lookupOrDefault("triangulate", false); createGeometry(); } diff --git a/src/sampling/sampledSurface/sampledSurface/sampledSurface.C b/src/sampling/sampledSurface/sampledSurface/sampledSurface.C index 24ceb62aa6..ef805c8642 100644 --- a/src/sampling/sampledSurface/sampledSurface/sampledSurface.C +++ b/src/sampling/sampledSurface/sampledSurface/sampledSurface.C @@ -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), diff --git a/src/sampling/sampledSurface/sampledSurface/sampledSurface.H b/src/sampling/sampledSurface/sampledSurface/sampledSurface.H index d91ff075e2..d143ee95aa 100644 --- a/src/sampling/sampledSurface/sampledSurface/sampledSurface.H +++ b/src/sampling/sampledSurface/sampledSurface/sampledSurface.H @@ -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;