mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: rationalize dictionary access methods
- use keyType::option enum to consolidate searching options.
These enumeration names should be more intuitive to use
and improve code readability.
Eg, lookupEntry(key, keyType::REGEX);
vs lookupEntry(key, false, true);
or
Eg, lookupEntry(key, keyType::LITERAL_RECURSIVE);
vs lookupEntry(key, true, false);
- new findEntry(), findDict(), findScoped() methods with consolidated
search options for shorter naming and access names more closely
aligned with other components. Behave simliarly to the
methods lookupEntryPtr(), subDictPtr(), lookupScopedEntryPtr(),
respectively. Default search parameters consistent with lookupEntry().
Eg, const entry* e = dict.findEntry(key);
vs const entry* e = dict.lookupEntryPtr(key, false, true);
- added '*' and '->' dereference operators to dictionary searchers.
This commit is contained in:
@ -183,7 +183,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
// Assumed to be good if it has 'profiling' sub-dict
|
||||
|
||||
const dictionary* ptr = dict.subDictPtr(blockNameProfiling);
|
||||
const dictionary* ptr = dict.findDict(blockNameProfiling);
|
||||
if (ptr)
|
||||
{
|
||||
++nDict;
|
||||
@ -295,13 +295,12 @@ int main(int argc, char *argv[])
|
||||
|
||||
for (const dictionary& procDict : profiles)
|
||||
{
|
||||
const dictionary* inDictPtr =
|
||||
procDict.subDictPtr(level1Name);
|
||||
const dictionary* inDictPtr = procDict.findDict(level1Name);
|
||||
|
||||
if (inDictPtr && hasDictEntries)
|
||||
{
|
||||
// descend to the next level as required
|
||||
inDictPtr = inDictPtr->subDictPtr(level2Name);
|
||||
// Descend to the next level as required
|
||||
inDictPtr = inDictPtr->findDict(level2Name);
|
||||
}
|
||||
|
||||
if (!inDictPtr)
|
||||
@ -313,16 +312,13 @@ int main(int argc, char *argv[])
|
||||
|
||||
for (const word& tag : tags)
|
||||
{
|
||||
const entry* eptr = inDictPtr->lookupEntryPtr
|
||||
(
|
||||
tag,
|
||||
false,
|
||||
false
|
||||
);
|
||||
scalar val;
|
||||
|
||||
if (eptr)
|
||||
if
|
||||
(
|
||||
inDictPtr->readIfPresent(tag, val, keyType::LITERAL)
|
||||
)
|
||||
{
|
||||
const scalar val = readScalar(eptr->stream());
|
||||
stats(tag).append(val);
|
||||
}
|
||||
}
|
||||
@ -339,7 +335,7 @@ int main(int argc, char *argv[])
|
||||
if (hasDictEntries)
|
||||
{
|
||||
outputDict.add(level2Name, level1Dict.subDict(level2Name));
|
||||
outDictPtr = outputDict.subDictPtr(level2Name);
|
||||
outDictPtr = outputDict.findDict(level2Name);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user