ENH: unify use of dictionary method names

- previously introduced `getOrDefault` as a dictionary _get_ method,
  now complete the transition and use it everywhere instead of
  `lookupOrDefault`. This avoids mixed usage of the two methods that
  are identical in behaviour, makes for shorter names, and promotes
  the distinction between "lookup" access (ie, return a token stream,
  locate and return an entry) and "get" access (ie, the above with
  conversion to concrete types such as scalar, label etc).
This commit is contained in:
Mark Olesen
2020-06-02 16:38:55 +02:00
parent f721b5344f
commit 3e43edf056
624 changed files with 2109 additions and 1954 deletions

View File

@ -170,11 +170,11 @@ bool Foam::functionObjects::vtkWrite::read(const dictionary& dict)
// We probably cannot trust old information after a reread
series_.clear();
// verbose_ = dict.lookupOrDefault<bool>("verbose", true);
doInternal_ = dict.lookupOrDefault<bool>("internal", true);
doBoundary_ = dict.lookupOrDefault<bool>("boundary", true);
oneBoundary_ = dict.lookupOrDefault<bool>("single", false);
interpolate_ = dict.lookupOrDefault<bool>("interpolate", false);
// verbose_ = dict.getOrDefault("verbose", true);
doInternal_ = dict.getOrDefault("internal", true);
doBoundary_ = dict.getOrDefault("boundary", true);
oneBoundary_ = dict.getOrDefault("single", false);
interpolate_ = dict.getOrDefault("interpolate", false);
//
// Writer options - default is xml base64
@ -197,7 +197,7 @@ bool Foam::functionObjects::vtkWrite::read(const dictionary& dict)
// Info<< type() << " " << name() << " output-format: "
// << writeOpts_.description() << nl;
const int padWidth = dict.lookupOrDefault<int>("width", 8);
const int padWidth = dict.getOrDefault<int>("width", 8);
// Appropriate printf format - Enforce min/max sanity limits
if (padWidth < 1 || padWidth > 31)
@ -213,8 +213,8 @@ bool Foam::functionObjects::vtkWrite::read(const dictionary& dict)
// Other options
//
decompose_ = dict.lookupOrDefault("decompose", false);
writeIds_ = dict.lookupOrDefault("writeIds", false);
decompose_ = dict.getOrDefault("decompose", false);
writeIds_ = dict.getOrDefault("writeIds", false);
// Output directory

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2018 OpenCFD Ltd.
Copyright (C) 2018-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -241,7 +241,7 @@ bool Foam::functionObjects::vtkWrite::readSelection(const dictionary& dict)
{
selectRegions_.resize(1);
selectRegions_.first() =
dict.lookupOrDefault<word>("region", polyMesh::defaultRegion);
dict.getOrDefault<word>("region", polyMesh::defaultRegion);
}
// Restrict to specified meshes