ENH: use dictionary findDict() instead of isDict() + subDict()

- avoids redundant dictionary searching

STYLE: remove dictionary lookupOrDefaultCompat wrapper

- deprecated and replaced by getOrDefaultCompat (2019-05).
  The function is usually specific to internal keyword upgrading
  (version compatibility) and unlikely to exist in any user code.
This commit is contained in:
Mark Olesen
2022-09-28 09:24:46 +02:00
parent 9d5a3a5c54
commit 55f5f8774b
14 changed files with 110 additions and 116 deletions

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017-2021 OpenCFD Ltd.
Copyright (C) 2017-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -252,7 +252,9 @@ Foam::functionObjects::energyTransport::energyTransport
{
const word& key = iter().keyword();
if (!multiphaseThermo_.isDict(key))
const dictionary* subDictPtr = multiphaseThermo_.findDict(key);
if (!subDictPtr)
{
FatalErrorInFunction
<< "Found non-dictionary entry " << iter()
@ -260,7 +262,7 @@ Foam::functionObjects::energyTransport::energyTransport
<< exit(FatalError);
}
const dictionary& dict = multiphaseThermo_.subDict(key);
const dictionary& dict = *subDictPtr;
phaseNames_[phasei] = key;