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:
@ -82,8 +82,8 @@ int main(int argc, char *argv[])
|
|||||||
Info<< "dict1.toc(): " << dict1.name() << " " << dict1.toc()
|
Info<< "dict1.toc(): " << dict1.name() << " " << dict1.toc()
|
||||||
<< endl;
|
<< endl;
|
||||||
|
|
||||||
dictionary dict3(dict2.subDictPtr("boundaryField"));
|
dictionary dict3(dict2.findDict("boundaryField"));
|
||||||
dictionary dict4(dict2.subDictPtr("NONEXISTENT"));
|
dictionary dict4(dict2.findDict("NONEXISTENT"));
|
||||||
|
|
||||||
Info<< "dictionary construct from pointer" << nl
|
Info<< "dictionary construct from pointer" << nl
|
||||||
<< "ok = " << dict3.name() << " " << dict3.toc() << nl
|
<< "ok = " << dict3.name() << " " << dict3.toc() << nl
|
||||||
@ -105,23 +105,17 @@ int main(int argc, char *argv[])
|
|||||||
Info<< "Pattern find \"abc\" in top directory : "
|
Info<< "Pattern find \"abc\" in top directory : "
|
||||||
<< dict.lookup("abc") << endl;
|
<< dict.lookup("abc") << endl;
|
||||||
Info<< "Pattern find \"abc\" in sub directory : "
|
Info<< "Pattern find \"abc\" in sub directory : "
|
||||||
<< dict.subDict("someDict").lookup("abc")
|
<< dict.subDict("someDict").lookup("abc") << nl;
|
||||||
<< endl;
|
|
||||||
Info<< "Recursive pattern find \"def\" in sub directory : "
|
Info<< "Recursive pattern find \"def\" in sub directory : "
|
||||||
<< dict.subDict("someDict").lookup("def", true)
|
<< dict.subDict("someDict").lookup("def", true) << nl;
|
||||||
<< endl;
|
|
||||||
Info<< "Recursive pattern find \"foo\" in sub directory : "
|
Info<< "Recursive pattern find \"foo\" in sub directory : "
|
||||||
<< dict.subDict("someDict").lookup("foo", true)
|
<< dict.subDict("someDict").lookup("foo", true) << nl;
|
||||||
<< endl;
|
|
||||||
Info<< "Recursive pattern find \"fooz\" in sub directory : "
|
Info<< "Recursive pattern find \"fooz\" in sub directory : "
|
||||||
<< dict.subDict("someDict").lookup("fooz", true)
|
<< dict.subDict("someDict").lookup("fooz", true) << nl;
|
||||||
<< endl;
|
|
||||||
Info<< "Recursive pattern find \"bar\" in sub directory : "
|
Info<< "Recursive pattern find \"bar\" in sub directory : "
|
||||||
<< dict.subDict("someDict").lookup("bar", true)
|
<< dict.subDict("someDict").lookup("bar", true) << nl;
|
||||||
<< endl;
|
|
||||||
Info<< "Recursive pattern find \"xxx\" in sub directory : "
|
Info<< "Recursive pattern find \"xxx\" in sub directory : "
|
||||||
<< dict.subDict("someDict").lookup("xxx", true)
|
<< dict.subDict("someDict").lookup("xxx", true) << nl;
|
||||||
<< endl;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@ -52,20 +52,16 @@ bool checkDictionaryContent(const dictionary& dict1, const dictionary& dict2)
|
|||||||
|
|
||||||
forAllConstIter(dictionary, dict1, iter1)
|
forAllConstIter(dictionary, dict1, iter1)
|
||||||
{
|
{
|
||||||
const entry* entryPtr = dict2.lookupEntryPtr
|
const entry* eptr =
|
||||||
(
|
dict2.findEntry(iter1().keyword(), keyType::LITERAL);
|
||||||
iter1().keyword(),
|
|
||||||
false,
|
|
||||||
false
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!entryPtr)
|
if (!eptr)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const entry& entry1 = iter1();
|
const entry& entry1 = iter1();
|
||||||
const entry& entry2 = *entryPtr;
|
const entry& entry2 = *eptr;
|
||||||
|
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
if (entry1.isDict())
|
if (entry1.isDict())
|
||||||
|
|||||||
@ -63,9 +63,13 @@ Foam::cellSizeFunction::cellSizeFunction
|
|||||||
defaultCellSize_(defaultCellSize),
|
defaultCellSize_(defaultCellSize),
|
||||||
regionIndices_(regionIndices),
|
regionIndices_(regionIndices),
|
||||||
sideMode_(),
|
sideMode_(),
|
||||||
priority_(cellSizeFunctionDict.get<label>("priority", true))
|
priority_
|
||||||
|
(
|
||||||
|
cellSizeFunctionDict.get<label>("priority", keyType::REGEX_RECURSIVE)
|
||||||
|
)
|
||||||
{
|
{
|
||||||
const word mode = cellSizeFunctionDict.get<word>("mode", true);
|
const word mode =
|
||||||
|
cellSizeFunctionDict.get<word>("mode", keyType::REGEX_RECURSIVE);
|
||||||
|
|
||||||
if (surface_.hasVolumeType())
|
if (surface_.hasVolumeType())
|
||||||
{
|
{
|
||||||
|
|||||||
@ -837,7 +837,7 @@ void Foam::conformalVoronoiMesh::checkCellSizing()
|
|||||||
= dict.subDict("meshQualityControls");
|
= dict.subDict("meshQualityControls");
|
||||||
|
|
||||||
const scalar maxNonOrtho =
|
const scalar maxNonOrtho =
|
||||||
meshQualityDict.get<scalar>("maxNonOrtho", true);
|
meshQualityDict.get<scalar>("maxNonOrtho", keyType::REGEX_RECURSIVE);
|
||||||
|
|
||||||
label nWrongFaces = 0;
|
label nWrongFaces = 0;
|
||||||
|
|
||||||
|
|||||||
@ -339,7 +339,7 @@ Foam::conformationSurfaces::conformationSurfaces
|
|||||||
{
|
{
|
||||||
const word& geomName = allGeometry_.names()[geomI];
|
const word& geomName = allGeometry_.names()[geomI];
|
||||||
|
|
||||||
const entry* ePtr = surfacesDict.lookupEntryPtr(geomName, false, true);
|
const entry* ePtr = surfacesDict.findEntry(geomName, keyType::REGEX);
|
||||||
|
|
||||||
if (ePtr)
|
if (ePtr)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -125,7 +125,7 @@ autoPtr<refinementSurfaces> createRefinementSurfaces
|
|||||||
{
|
{
|
||||||
const word& geomName = allGeometry.names()[geomi];
|
const word& geomName = allGeometry.names()[geomi];
|
||||||
|
|
||||||
const entry* ePtr = surfacesDict.lookupEntryPtr(geomName, false, true);
|
const entry* ePtr = surfacesDict.findEntry(geomName, keyType::REGEX);
|
||||||
|
|
||||||
if (ePtr)
|
if (ePtr)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -170,9 +170,10 @@ class dictAndKeyword
|
|||||||
word key_;
|
word key_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
dictAndKeyword(const word& scopedName)
|
dictAndKeyword(const word& scopedName)
|
||||||
{
|
{
|
||||||
string::size_type i = scopedName.rfind('/');
|
auto i = scopedName.rfind('/');
|
||||||
if (i == string::npos)
|
if (i == string::npos)
|
||||||
{
|
{
|
||||||
i = scopedName.rfind('.');
|
i = scopedName.rfind('.');
|
||||||
@ -212,7 +213,7 @@ const dictionary& lookupScopedDict
|
|||||||
return dict;
|
return dict;
|
||||||
}
|
}
|
||||||
|
|
||||||
const entry* eptr = dict.lookupScopedEntryPtr(subDictName, false, false);
|
const entry* eptr = dict.findScoped(subDictName, keyType::LITERAL);
|
||||||
|
|
||||||
if (!eptr || !eptr->isDict())
|
if (!eptr || !eptr->isDict())
|
||||||
{
|
{
|
||||||
@ -231,7 +232,7 @@ void removeDict(dictionary& dict, const dictionary& dictToRemove)
|
|||||||
{
|
{
|
||||||
for (const entry& refEntry : dictToRemove)
|
for (const entry& refEntry : dictToRemove)
|
||||||
{
|
{
|
||||||
auto finder = dict.search(refEntry.keyword(), false, false);
|
auto finder = dict.search(refEntry.keyword(), keyType::LITERAL);
|
||||||
|
|
||||||
bool purge = false;
|
bool purge = false;
|
||||||
|
|
||||||
@ -357,8 +358,7 @@ int main(int argc, char *argv[])
|
|||||||
bool changed = false;
|
bool changed = false;
|
||||||
|
|
||||||
// Read but preserve headers
|
// Read but preserve headers
|
||||||
dictionary dict;
|
dictionary dict(dictFile(), true);
|
||||||
dict.read(dictFile(), true);
|
|
||||||
|
|
||||||
if (listIncludes)
|
if (listIncludes)
|
||||||
{
|
{
|
||||||
@ -455,12 +455,7 @@ int main(int argc, char *argv[])
|
|||||||
changed = true;
|
changed = true;
|
||||||
|
|
||||||
// Print the changed entry
|
// Print the changed entry
|
||||||
const auto finder = dict.csearchScoped
|
const auto finder = dict.csearchScoped(scopedName, keyType::REGEX);
|
||||||
(
|
|
||||||
scopedName,
|
|
||||||
false,
|
|
||||||
true // Support wildcards
|
|
||||||
);
|
|
||||||
|
|
||||||
if (finder.found())
|
if (finder.found())
|
||||||
{
|
{
|
||||||
@ -489,8 +484,8 @@ int main(int argc, char *argv[])
|
|||||||
const dictionary& d1(lookupScopedDict(dict, dAk.dict()));
|
const dictionary& d1(lookupScopedDict(dict, dAk.dict()));
|
||||||
const dictionary& d2(lookupScopedDict(diffDict, dAk.dict()));
|
const dictionary& d2(lookupScopedDict(diffDict, dAk.dict()));
|
||||||
|
|
||||||
const entry* e1Ptr = d1.lookupEntryPtr(dAk.key(), false, true);
|
const entry* e1Ptr = d1.findEntry(dAk.key(), keyType::REGEX);
|
||||||
const entry* e2Ptr = d2.lookupEntryPtr(dAk.key(), false, true);
|
const entry* e2Ptr = d2.findEntry(dAk.key(), keyType::REGEX);
|
||||||
|
|
||||||
if (e1Ptr && e2Ptr)
|
if (e1Ptr && e2Ptr)
|
||||||
{
|
{
|
||||||
@ -509,12 +504,7 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto finder = dict.csearchScoped
|
const auto finder = dict.csearchScoped(scopedName, keyType::REGEX);
|
||||||
(
|
|
||||||
scopedName,
|
|
||||||
false,
|
|
||||||
true // Support wildcards
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!finder.found())
|
if (!finder.found())
|
||||||
{
|
{
|
||||||
|
|||||||
@ -183,7 +183,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
// Assumed to be good if it has 'profiling' sub-dict
|
// Assumed to be good if it has 'profiling' sub-dict
|
||||||
|
|
||||||
const dictionary* ptr = dict.subDictPtr(blockNameProfiling);
|
const dictionary* ptr = dict.findDict(blockNameProfiling);
|
||||||
if (ptr)
|
if (ptr)
|
||||||
{
|
{
|
||||||
++nDict;
|
++nDict;
|
||||||
@ -295,13 +295,12 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
for (const dictionary& procDict : profiles)
|
for (const dictionary& procDict : profiles)
|
||||||
{
|
{
|
||||||
const dictionary* inDictPtr =
|
const dictionary* inDictPtr = procDict.findDict(level1Name);
|
||||||
procDict.subDictPtr(level1Name);
|
|
||||||
|
|
||||||
if (inDictPtr && hasDictEntries)
|
if (inDictPtr && hasDictEntries)
|
||||||
{
|
{
|
||||||
// descend to the next level as required
|
// Descend to the next level as required
|
||||||
inDictPtr = inDictPtr->subDictPtr(level2Name);
|
inDictPtr = inDictPtr->findDict(level2Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!inDictPtr)
|
if (!inDictPtr)
|
||||||
@ -313,16 +312,13 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
for (const word& tag : tags)
|
for (const word& tag : tags)
|
||||||
{
|
{
|
||||||
const entry* eptr = inDictPtr->lookupEntryPtr
|
scalar val;
|
||||||
(
|
|
||||||
tag,
|
|
||||||
false,
|
|
||||||
false
|
|
||||||
);
|
|
||||||
|
|
||||||
if (eptr)
|
if
|
||||||
|
(
|
||||||
|
inDictPtr->readIfPresent(tag, val, keyType::LITERAL)
|
||||||
|
)
|
||||||
{
|
{
|
||||||
const scalar val = readScalar(eptr->stream());
|
|
||||||
stats(tag).append(val);
|
stats(tag).append(val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -339,7 +335,7 @@ int main(int argc, char *argv[])
|
|||||||
if (hasDictEntries)
|
if (hasDictEntries)
|
||||||
{
|
{
|
||||||
outputDict.add(level2Name, level1Dict.subDict(level2Name));
|
outputDict.add(level2Name, level1Dict.subDict(level2Name));
|
||||||
outDictPtr = outputDict.subDictPtr(level2Name);
|
outDictPtr = outputDict.findDict(level2Name);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -235,10 +235,9 @@ bool merge
|
|||||||
// Save current (non-wildcard) keys before adding items.
|
// Save current (non-wildcard) keys before adding items.
|
||||||
wordHashSet thisKeysSet;
|
wordHashSet thisKeysSet;
|
||||||
{
|
{
|
||||||
List<keyType> keys = thisDict.keys(false);
|
for (const word& k : thisDict.keys(false))
|
||||||
forAll(keys, i)
|
|
||||||
{
|
{
|
||||||
thisKeysSet.insert(keys[i]);
|
thisKeysSet.insert(k);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -261,25 +260,20 @@ bool merge
|
|||||||
}
|
}
|
||||||
else if (literalRE || !(key.isPattern() || shortcuts.found(key)))
|
else if (literalRE || !(key.isPattern() || shortcuts.found(key)))
|
||||||
{
|
{
|
||||||
entry* entryPtr = thisDict.lookupEntryPtr
|
entry* eptr = thisDict.findEntry(key, keyType::LITERAL);
|
||||||
(
|
|
||||||
key,
|
|
||||||
false, // recursive
|
|
||||||
false // patternMatch
|
|
||||||
);
|
|
||||||
|
|
||||||
if (entryPtr)
|
if (eptr)
|
||||||
{
|
{
|
||||||
// Mark thisDict entry as having been match for wildcard
|
// Mark thisDict entry as having been match for wildcard
|
||||||
// handling later on.
|
// handling later on.
|
||||||
thisKeysSet.erase(entryPtr->keyword());
|
thisKeysSet.erase(eptr->keyword());
|
||||||
|
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
addEntry
|
addEntry
|
||||||
(
|
(
|
||||||
thisDict,
|
thisDict,
|
||||||
*entryPtr,
|
*eptr,
|
||||||
mergeIter(),
|
mergeIter(),
|
||||||
literalRE,
|
literalRE,
|
||||||
shortcuts
|
shortcuts
|
||||||
@ -310,7 +304,7 @@ bool merge
|
|||||||
|
|
||||||
// Pass 2. Wildcard or shortcut matches (if any) on any non-match keys.
|
// Pass 2. Wildcard or shortcut matches (if any) on any non-match keys.
|
||||||
|
|
||||||
if (!literalRE && thisKeysSet.size() > 0)
|
if (!literalRE && thisKeysSet.size())
|
||||||
{
|
{
|
||||||
// Pick up remaining dictionary entries
|
// Pick up remaining dictionary entries
|
||||||
wordList thisKeys(thisKeysSet.toc());
|
wordList thisKeys(thisKeysSet.toc());
|
||||||
@ -336,10 +330,10 @@ bool merge
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Remove all matches
|
// Remove all matches
|
||||||
forAll(matches, i)
|
for (const label matchi : matches)
|
||||||
{
|
{
|
||||||
const word& thisKey = thisKeys[matches[i]];
|
const word& k = thisKeys[matchi];
|
||||||
thisKeysSet.erase(thisKey);
|
thisKeysSet.erase(k);
|
||||||
}
|
}
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
@ -358,21 +352,18 @@ bool merge
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Add all matches
|
// Add all matches
|
||||||
forAll(matches, i)
|
for (const label matchi : matches)
|
||||||
{
|
{
|
||||||
const word& thisKey = thisKeys[matches[i]];
|
const word& k = thisKeys[matchi];
|
||||||
|
|
||||||
entry& thisEntry = const_cast<entry&>
|
entry* eptr = thisDict.findEntry(k, keyType::LITERAL);
|
||||||
(
|
|
||||||
thisDict.lookupEntry(thisKey, false, false)
|
|
||||||
);
|
|
||||||
|
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
addEntry
|
addEntry
|
||||||
(
|
(
|
||||||
thisDict,
|
thisDict,
|
||||||
thisEntry,
|
*eptr,
|
||||||
mergeIter(),
|
mergeIter(),
|
||||||
literalRE,
|
literalRE,
|
||||||
HashTable<wordList>(0) // no shortcuts
|
HashTable<wordList>(0) // no shortcuts
|
||||||
@ -627,8 +618,7 @@ int main(int argc, char *argv[])
|
|||||||
fieldDict.lookupEntry
|
fieldDict.lookupEntry
|
||||||
(
|
(
|
||||||
doneKeys[i],
|
doneKeys[i],
|
||||||
false,
|
keyType::REGEX
|
||||||
true
|
|
||||||
).clone()
|
).clone()
|
||||||
);
|
);
|
||||||
fieldDict.remove(doneKeys[i]);
|
fieldDict.remove(doneKeys[i]);
|
||||||
|
|||||||
@ -342,11 +342,11 @@ void Foam::Time::setControls()
|
|||||||
|
|
||||||
void Foam::Time::setMonitoring(const bool forceProfiling)
|
void Foam::Time::setMonitoring(const bool forceProfiling)
|
||||||
{
|
{
|
||||||
const dictionary* profilingDict = controlDict_.subDictPtr("profiling");
|
const dictionary* profilingDict = controlDict_.findDict("profiling");
|
||||||
if (!profilingDict)
|
if (!profilingDict)
|
||||||
{
|
{
|
||||||
// ... or from etc/controlDict
|
// ... or from etc/controlDict
|
||||||
profilingDict = debug::controlDict().subDictPtr("profiling");
|
profilingDict = debug::controlDict().findDict("profiling");
|
||||||
}
|
}
|
||||||
|
|
||||||
// initialize profiling on request
|
// initialize profiling on request
|
||||||
|
|||||||
@ -99,7 +99,7 @@ void Foam::Time::readDict()
|
|||||||
// DebugSwitches
|
// DebugSwitches
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
(localDict = controlDict_.subDictPtr("DebugSwitches")) != nullptr
|
(localDict = controlDict_.findDict("DebugSwitches")) != nullptr
|
||||||
&& localDict->size()
|
&& localDict->size()
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -146,7 +146,7 @@ void Foam::Time::readDict()
|
|||||||
// InfoSwitches
|
// InfoSwitches
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
(localDict = controlDict_.subDictPtr("InfoSwitches")) != nullptr
|
(localDict = controlDict_.findDict("InfoSwitches")) != nullptr
|
||||||
&& localDict->size()
|
&& localDict->size()
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -192,7 +192,7 @@ void Foam::Time::readDict()
|
|||||||
// OptimisationSwitches
|
// OptimisationSwitches
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
(localDict = controlDict_.subDictPtr("OptimisationSwitches")) != nullptr
|
(localDict = controlDict_.findDict("OptimisationSwitches")) != nullptr
|
||||||
&& localDict->size()
|
&& localDict->size()
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -273,7 +273,7 @@ void Foam::Time::readDict()
|
|||||||
if
|
if
|
||||||
(
|
(
|
||||||
|
|
||||||
(localDict = controlDict_.subDictPtr("DimensionedConstants")) != nullptr
|
(localDict = controlDict_.findDict("DimensionedConstants")) != nullptr
|
||||||
&& localDict->size()
|
&& localDict->size()
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -310,7 +310,7 @@ void Foam::Time::readDict()
|
|||||||
// DimensionSets
|
// DimensionSets
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
(localDict = controlDict_.subDictPtr("DimensionSets")) != nullptr
|
(localDict = controlDict_.findDict("DimensionSets")) != nullptr
|
||||||
&& localDict->size()
|
&& localDict->size()
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -134,13 +134,14 @@ void Foam::dictionary::checkITstream
|
|||||||
|
|
||||||
Foam::dictionary::dictionary()
|
Foam::dictionary::dictionary()
|
||||||
:
|
:
|
||||||
|
name_(),
|
||||||
parent_(dictionary::null)
|
parent_(dictionary::null)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
Foam::dictionary::dictionary(const fileName& name)
|
Foam::dictionary::dictionary(const fileName& name)
|
||||||
:
|
:
|
||||||
dictionaryName(name),
|
name_(name),
|
||||||
parent_(dictionary::null)
|
parent_(dictionary::null)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@ -151,8 +152,8 @@ Foam::dictionary::dictionary
|
|||||||
const dictionary& dict
|
const dictionary& dict
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
dictionaryName(dict.name()),
|
|
||||||
parent_type(dict, *this),
|
parent_type(dict, *this),
|
||||||
|
name_(dict.name()),
|
||||||
parent_(parentDict)
|
parent_(parentDict)
|
||||||
{
|
{
|
||||||
forAllIter(parent_type, *this, iter)
|
forAllIter(parent_type, *this, iter)
|
||||||
@ -173,8 +174,8 @@ Foam::dictionary::dictionary
|
|||||||
const dictionary& dict
|
const dictionary& dict
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
dictionaryName(dict.name()),
|
|
||||||
parent_type(dict, *this),
|
parent_type(dict, *this),
|
||||||
|
name_(dict.name()),
|
||||||
parent_(dictionary::null)
|
parent_(dictionary::null)
|
||||||
{
|
{
|
||||||
forAllIter(parent_type, *this, iter)
|
forAllIter(parent_type, *this, iter)
|
||||||
@ -190,16 +191,14 @@ Foam::dictionary::dictionary
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::dictionary::dictionary
|
Foam::dictionary::dictionary(const dictionary* dict)
|
||||||
(
|
|
||||||
const dictionary* dictPtr
|
|
||||||
)
|
|
||||||
:
|
:
|
||||||
|
name_(),
|
||||||
parent_(dictionary::null)
|
parent_(dictionary::null)
|
||||||
{
|
{
|
||||||
if (dictPtr)
|
if (dict)
|
||||||
{
|
{
|
||||||
operator=(*dictPtr);
|
operator=(*dict);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -210,6 +209,7 @@ Foam::dictionary::dictionary
|
|||||||
dictionary&& dict
|
dictionary&& dict
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
|
name_(),
|
||||||
parent_(parentDict)
|
parent_(parentDict)
|
||||||
{
|
{
|
||||||
transfer(dict);
|
transfer(dict);
|
||||||
@ -222,6 +222,7 @@ Foam::dictionary::dictionary
|
|||||||
dictionary&& dict
|
dictionary&& dict
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
|
name_(),
|
||||||
parent_(dictionary::null)
|
parent_(dictionary::null)
|
||||||
{
|
{
|
||||||
transfer(dict);
|
transfer(dict);
|
||||||
@ -310,44 +311,50 @@ Foam::tokenList Foam::dictionary::tokens() const
|
|||||||
bool Foam::dictionary::found
|
bool Foam::dictionary::found
|
||||||
(
|
(
|
||||||
const word& keyword,
|
const word& keyword,
|
||||||
bool recursive,
|
enum keyType::option matchOpt
|
||||||
bool patternMatch
|
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
return csearch(keyword, recursive, patternMatch).found();
|
return csearch(keyword, matchOpt).found();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const Foam::entry* Foam::dictionary::lookupEntryPtr
|
Foam::entry* Foam::dictionary::findEntry
|
||||||
(
|
(
|
||||||
const word& keyword,
|
const word& keyword,
|
||||||
bool recursive,
|
enum keyType::option matchOpt
|
||||||
bool patternMatch
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
return csearch(keyword, recursive, patternMatch).ptr();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::entry* Foam::dictionary::lookupEntryPtr
|
|
||||||
(
|
|
||||||
const word& keyword,
|
|
||||||
bool recursive,
|
|
||||||
bool patternMatch
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return search(keyword, recursive, patternMatch).ptr();
|
return search(keyword, matchOpt).ptr();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const Foam::entry* Foam::dictionary::findEntry
|
||||||
|
(
|
||||||
|
const word& keyword,
|
||||||
|
enum keyType::option matchOpt
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return csearch(keyword, matchOpt).ptr();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const Foam::entry* Foam::dictionary::findScoped
|
||||||
|
(
|
||||||
|
const word& keyword,
|
||||||
|
enum keyType::option matchOpt
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return csearchScoped(keyword, matchOpt).ptr();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const Foam::entry& Foam::dictionary::lookupEntry
|
const Foam::entry& Foam::dictionary::lookupEntry
|
||||||
(
|
(
|
||||||
const word& keyword,
|
const word& keyword,
|
||||||
bool recursive,
|
enum keyType::option matchOpt
|
||||||
bool patternMatch
|
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
const const_searcher finder(csearch(keyword, recursive, patternMatch));
|
const const_searcher finder(csearch(keyword, matchOpt));
|
||||||
|
|
||||||
if (!finder.found())
|
if (!finder.found())
|
||||||
{
|
{
|
||||||
@ -364,22 +371,10 @@ const Foam::entry& Foam::dictionary::lookupEntry
|
|||||||
Foam::ITstream& Foam::dictionary::lookup
|
Foam::ITstream& Foam::dictionary::lookup
|
||||||
(
|
(
|
||||||
const word& keyword,
|
const word& keyword,
|
||||||
bool recursive,
|
enum keyType::option matchOpt
|
||||||
bool patternMatch
|
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
return lookupEntry(keyword, recursive, patternMatch).stream();
|
return lookupEntry(keyword, matchOpt).stream();
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const Foam::entry* Foam::dictionary::lookupScopedEntryPtr
|
|
||||||
(
|
|
||||||
const word& keyword,
|
|
||||||
bool recursive,
|
|
||||||
bool patternMatch
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
return csearchScoped(keyword, recursive, patternMatch).ptr();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -394,7 +389,7 @@ bool Foam::dictionary::substituteKeyword(const word& keyword, bool mergeEntry)
|
|||||||
const word varName(keyword.substr(1), false);
|
const word varName(keyword.substr(1), false);
|
||||||
|
|
||||||
// Lookup the variable name in the given dictionary
|
// Lookup the variable name in the given dictionary
|
||||||
const const_searcher finder(csearch(varName, true, true));
|
const const_searcher finder(csearch(varName, keyType::REGEX_RECURSIVE));
|
||||||
|
|
||||||
// If defined insert its entries into this dictionary
|
// If defined insert its entries into this dictionary
|
||||||
if (finder.found())
|
if (finder.found())
|
||||||
@ -428,7 +423,7 @@ bool Foam::dictionary::substituteScopedKeyword
|
|||||||
const word varName(keyword.substr(1), false);
|
const word varName(keyword.substr(1), false);
|
||||||
|
|
||||||
// Lookup the variable name in the given dictionary
|
// Lookup the variable name in the given dictionary
|
||||||
const const_searcher finder(csearchScoped(varName, true, true));
|
const auto finder(csearchScoped(varName, keyType::REGEX_RECURSIVE));
|
||||||
|
|
||||||
// If defined insert its entries into this dictionary
|
// If defined insert its entries into this dictionary
|
||||||
if (finder.found())
|
if (finder.found())
|
||||||
@ -449,29 +444,35 @@ bool Foam::dictionary::substituteScopedKeyword
|
|||||||
|
|
||||||
bool Foam::dictionary::isDict(const word& keyword) const
|
bool Foam::dictionary::isDict(const word& keyword) const
|
||||||
{
|
{
|
||||||
// Find non-recursive with patterns
|
// Allow patterns, non-recursive
|
||||||
return csearch(keyword, false, true).isDict();
|
return csearch(keyword, keyType::REGEX).isDict();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const Foam::dictionary* Foam::dictionary::subDictPtr(const word& keyword) const
|
Foam::dictionary* Foam::dictionary::findDict
|
||||||
|
(
|
||||||
|
const word& keyword,
|
||||||
|
enum keyType::option matchOpt
|
||||||
|
)
|
||||||
{
|
{
|
||||||
// Find non-recursive with patterns
|
return search(keyword, matchOpt).dictPtr();
|
||||||
return csearch(keyword, false, true).dictPtr();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::dictionary* Foam::dictionary::subDictPtr(const word& keyword)
|
const Foam::dictionary* Foam::dictionary::findDict
|
||||||
|
(
|
||||||
|
const word& keyword,
|
||||||
|
enum keyType::option matchOpt
|
||||||
|
) const
|
||||||
{
|
{
|
||||||
// Find non-recursive with patterns
|
return csearch(keyword, matchOpt).dictPtr();
|
||||||
return search(keyword, false, true).dictPtr();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const Foam::dictionary& Foam::dictionary::subDict(const word& keyword) const
|
const Foam::dictionary& Foam::dictionary::subDict(const word& keyword) const
|
||||||
{
|
{
|
||||||
// Find non-recursive with patterns
|
// Allow patterns, non-recursive
|
||||||
const const_searcher finder(csearch(keyword, false, true));
|
const const_searcher finder(csearch(keyword, keyType::REGEX));
|
||||||
|
|
||||||
if (!finder.found())
|
if (!finder.found())
|
||||||
{
|
{
|
||||||
@ -487,8 +488,8 @@ const Foam::dictionary& Foam::dictionary::subDict(const word& keyword) const
|
|||||||
|
|
||||||
Foam::dictionary& Foam::dictionary::subDict(const word& keyword)
|
Foam::dictionary& Foam::dictionary::subDict(const word& keyword)
|
||||||
{
|
{
|
||||||
// Find non-recursive with patterns
|
// Allow patterns, non-recursive
|
||||||
searcher finder = search(keyword, false, true);
|
searcher finder(search(keyword, keyType::REGEX));
|
||||||
|
|
||||||
if (!finder.found())
|
if (!finder.found())
|
||||||
{
|
{
|
||||||
@ -508,8 +509,8 @@ Foam::dictionary Foam::dictionary::subOrEmptyDict
|
|||||||
const bool mandatory
|
const bool mandatory
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
// Find non-recursive with patterns
|
// Allow patterns, non-recursive
|
||||||
const const_searcher finder(csearch(keyword, false, true));
|
const const_searcher finder(csearch(keyword, keyType::REGEX));
|
||||||
|
|
||||||
if (finder.isDict())
|
if (finder.isDict())
|
||||||
{
|
{
|
||||||
@ -543,7 +544,8 @@ const Foam::dictionary& Foam::dictionary::optionalSubDict
|
|||||||
const word& keyword
|
const word& keyword
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
const const_searcher finder(csearch(keyword, false, true));
|
// Allow patterns, non-recursive
|
||||||
|
const const_searcher finder(csearch(keyword, keyType::REGEX));
|
||||||
|
|
||||||
if (finder.isDict())
|
if (finder.isDict())
|
||||||
{
|
{
|
||||||
@ -565,15 +567,15 @@ const Foam::dictionary& Foam::dictionary::optionalSubDict
|
|||||||
|
|
||||||
Foam::wordList Foam::dictionary::toc() const
|
Foam::wordList Foam::dictionary::toc() const
|
||||||
{
|
{
|
||||||
wordList keys(size());
|
wordList list(size());
|
||||||
|
|
||||||
label n = 0;
|
label n = 0;
|
||||||
forAllConstIters(*this, iter)
|
forAllConstIters(*this, iter)
|
||||||
{
|
{
|
||||||
keys[n++] = iter().keyword();
|
list[n++] = iter().keyword();
|
||||||
}
|
}
|
||||||
|
|
||||||
return keys;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -585,19 +587,19 @@ Foam::wordList Foam::dictionary::sortedToc() const
|
|||||||
|
|
||||||
Foam::List<Foam::keyType> Foam::dictionary::keys(bool patterns) const
|
Foam::List<Foam::keyType> Foam::dictionary::keys(bool patterns) const
|
||||||
{
|
{
|
||||||
List<keyType> keys(size());
|
List<keyType> list(size());
|
||||||
|
|
||||||
label n = 0;
|
label n = 0;
|
||||||
forAllConstIters(*this, iter)
|
forAllConstIters(*this, iter)
|
||||||
{
|
{
|
||||||
if (iter().keyword().isPattern() ? patterns : !patterns)
|
if (iter().keyword().isPattern() ? patterns : !patterns)
|
||||||
{
|
{
|
||||||
keys[n++] = iter().keyword();
|
list[n++] = iter().keyword();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
keys.setSize(n);
|
list.resize(n);
|
||||||
|
|
||||||
return keys;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -746,7 +748,7 @@ Foam::entry* Foam::dictionary::set(entry* entryPtr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Find non-recursive with patterns
|
// Find non-recursive with patterns
|
||||||
searcher finder(search(entryPtr->keyword(), false, true));
|
searcher finder(search(entryPtr->keyword(), keyType::REGEX));
|
||||||
|
|
||||||
// Clear dictionary so merge acts like overwrite
|
// Clear dictionary so merge acts like overwrite
|
||||||
if (finder.isDict())
|
if (finder.isDict())
|
||||||
|
|||||||
@ -112,70 +112,12 @@ class SHA1Digest;
|
|||||||
Istream& operator>>(Istream& is, dictionary& dict);
|
Istream& operator>>(Istream& is, dictionary& dict);
|
||||||
Ostream& operator<<(Ostream& os, const dictionary& dict);
|
Ostream& operator<<(Ostream& os, const dictionary& dict);
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
Class dictionaryName Declaration
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
//- Holds name for a dictionary
|
|
||||||
class dictionaryName
|
|
||||||
{
|
|
||||||
// Private data
|
|
||||||
|
|
||||||
fileName name_;
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
// Constructors
|
|
||||||
|
|
||||||
//- Construct null
|
|
||||||
dictionaryName()
|
|
||||||
{}
|
|
||||||
|
|
||||||
//- Construct as copy of the given fileName
|
|
||||||
dictionaryName(const fileName& name)
|
|
||||||
:
|
|
||||||
name_(name)
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
// Member functions
|
|
||||||
|
|
||||||
//- Return the dictionary name
|
|
||||||
const fileName& name() const
|
|
||||||
{
|
|
||||||
return name_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Return the dictionary name for modification (use with caution).
|
|
||||||
fileName& name()
|
|
||||||
{
|
|
||||||
return name_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Return the local dictionary name (final part of scoped name)
|
|
||||||
word dictName() const
|
|
||||||
{
|
|
||||||
word scopedName(name_.name());
|
|
||||||
|
|
||||||
const auto i = scopedName.rfind('.');
|
|
||||||
if (i == std::string::npos)
|
|
||||||
{
|
|
||||||
return scopedName;
|
|
||||||
}
|
|
||||||
|
|
||||||
return scopedName.substr(i+1);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class dictionary Declaration
|
Class dictionary Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
class dictionary
|
class dictionary
|
||||||
:
|
:
|
||||||
public dictionaryName,
|
|
||||||
public IDLList<entry>
|
public IDLList<entry>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -250,7 +192,7 @@ public:
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
//- Entry was found.
|
//- True if entry was found
|
||||||
inline bool found() const
|
inline bool found() const
|
||||||
{
|
{
|
||||||
return eptr_;
|
return eptr_;
|
||||||
@ -298,6 +240,18 @@ public:
|
|||||||
{
|
{
|
||||||
return *reinterpret_cast<const Searcher<!Const>*>(this);
|
return *reinterpret_cast<const Searcher<!Const>*>(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//- A pointer to the entry (nullptr if not found)
|
||||||
|
pointer operator->() const
|
||||||
|
{
|
||||||
|
return eptr_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- A reference to the entry (Error if not found)
|
||||||
|
reference operator*() const
|
||||||
|
{
|
||||||
|
return *eptr_;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -326,6 +280,9 @@ private:
|
|||||||
// Set/unset via an InfoSwitch
|
// Set/unset via an InfoSwitch
|
||||||
static bool writeOptionalEntries;
|
static bool writeOptionalEntries;
|
||||||
|
|
||||||
|
//- The dictionary name
|
||||||
|
fileName name_;
|
||||||
|
|
||||||
//- Parent dictionary
|
//- Parent dictionary
|
||||||
const dictionary& parent_;
|
const dictionary& parent_;
|
||||||
|
|
||||||
@ -353,6 +310,21 @@ private:
|
|||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Convert old-style (1806) boolean search specification to enum
|
||||||
|
//
|
||||||
|
// \param recursive search parent dictionaries
|
||||||
|
// \param pattern match using regular expressions as well
|
||||||
|
static inline enum keyType::option
|
||||||
|
matchOpt(bool recursive, bool pattern)
|
||||||
|
{
|
||||||
|
return
|
||||||
|
keyType::option
|
||||||
|
(
|
||||||
|
(pattern ? keyType::REGEX : keyType::LITERAL)
|
||||||
|
| (recursive ? keyType::RECURSIVE : 0)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
//- Search using a '.' for scoping.
|
//- Search using a '.' for scoping.
|
||||||
// A leading dot means to use the parent dictionary.
|
// A leading dot means to use the parent dictionary.
|
||||||
// An intermediate dot separates a sub-dictionary or sub-entry.
|
// An intermediate dot separates a sub-dictionary or sub-entry.
|
||||||
@ -363,13 +335,11 @@ private:
|
|||||||
// The heuristic tries successively longer top-level entries
|
// The heuristic tries successively longer top-level entries
|
||||||
// until there is a suitable match.
|
// until there is a suitable match.
|
||||||
//
|
//
|
||||||
// \param recursive search parent dictionaries
|
// \param matchOpt the search mode
|
||||||
// \param patternMatch use regular expressions
|
|
||||||
const_searcher csearchDotScoped
|
const_searcher csearchDotScoped
|
||||||
(
|
(
|
||||||
const word& keyword,
|
const word& keyword,
|
||||||
bool recursive,
|
enum keyType::option matchOpt
|
||||||
bool patternMatch
|
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Search using a '/' for scoping.
|
//- Search using a '/' for scoping.
|
||||||
@ -379,11 +349,11 @@ private:
|
|||||||
// ambiguity between separator and content.
|
// ambiguity between separator and content.
|
||||||
// No possibility or need for recursion.
|
// No possibility or need for recursion.
|
||||||
//
|
//
|
||||||
// \param patternMatch use regular expressions
|
// \param matchOpt the search mode. Recursive is ignored.
|
||||||
const_searcher csearchSlashScoped
|
const_searcher csearchSlashScoped
|
||||||
(
|
(
|
||||||
const word& keyword,
|
const word& keyword,
|
||||||
bool patternMatch
|
enum keyType::option matchOpt
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
|
||||||
@ -411,16 +381,17 @@ public:
|
|||||||
explicit dictionary(const fileName& name);
|
explicit dictionary(const fileName& name);
|
||||||
|
|
||||||
//- Construct given the entry name, parent dictionary and Istream,
|
//- Construct given the entry name, parent dictionary and Istream,
|
||||||
//- reading entries until EOF
|
//- reading entries until EOF, optionally keeping the header
|
||||||
dictionary
|
dictionary
|
||||||
(
|
(
|
||||||
const fileName& name,
|
const fileName& name,
|
||||||
const dictionary& parentDict,
|
const dictionary& parentDict,
|
||||||
Istream& is
|
Istream& is,
|
||||||
|
bool keepHeader = false
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct top-level dictionary from Istream,
|
//- Construct top-level dictionary from Istream,
|
||||||
//- reading entries until EOF
|
//- reading entries until EOF. Discards the header.
|
||||||
dictionary(Istream& is);
|
dictionary(Istream& is);
|
||||||
|
|
||||||
//- Construct top-level dictionary from Istream,
|
//- Construct top-level dictionary from Istream,
|
||||||
@ -435,7 +406,7 @@ public:
|
|||||||
|
|
||||||
//- Construct top-level dictionary as copy from pointer to dictionary.
|
//- Construct top-level dictionary as copy from pointer to dictionary.
|
||||||
// A null pointer is treated like an empty dictionary.
|
// A null pointer is treated like an empty dictionary.
|
||||||
dictionary(const dictionary* dictPtr);
|
dictionary(const dictionary* dict);
|
||||||
|
|
||||||
//- Move construct for given parent dictionary
|
//- Move construct for given parent dictionary
|
||||||
dictionary(const dictionary& parentDict, dictionary&& dict);
|
dictionary(const dictionary& parentDict, dictionary&& dict);
|
||||||
@ -458,6 +429,32 @@ public:
|
|||||||
|
|
||||||
// Access
|
// Access
|
||||||
|
|
||||||
|
//- The dictionary name
|
||||||
|
const fileName& name() const
|
||||||
|
{
|
||||||
|
return name_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- The dictionary name for modification (use with caution).
|
||||||
|
fileName& name()
|
||||||
|
{
|
||||||
|
return name_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- The local dictionary name (final part of scoped name)
|
||||||
|
word dictName() const
|
||||||
|
{
|
||||||
|
word scopedName(name_.name());
|
||||||
|
|
||||||
|
const auto i = scopedName.rfind('.');
|
||||||
|
if (i == std::string::npos)
|
||||||
|
{
|
||||||
|
return scopedName;
|
||||||
|
}
|
||||||
|
|
||||||
|
return scopedName.substr(i+1);
|
||||||
|
}
|
||||||
|
|
||||||
//- Return the parent dictionary
|
//- Return the parent dictionary
|
||||||
const dictionary& parent() const
|
const dictionary& parent() const
|
||||||
{
|
{
|
||||||
@ -482,131 +479,137 @@ public:
|
|||||||
|
|
||||||
// Search and lookup
|
// Search and lookup
|
||||||
|
|
||||||
//- Search dictionary for given keyword.
|
//- Search for an entry (const access) with the given keyword.
|
||||||
// Default search: non-recursive with patterns.
|
|
||||||
//
|
//
|
||||||
// \param recursive search parent dictionaries
|
// \param matchOpt the default search is non-recursive with patterns
|
||||||
// \param patternMatch use regular expressions
|
//
|
||||||
|
// \return True if entry was found
|
||||||
bool found
|
bool found
|
||||||
(
|
(
|
||||||
const word& keyword,
|
const word& keyword,
|
||||||
bool recursive = false,
|
enum keyType::option matchOpt = keyType::REGEX
|
||||||
bool patternMatch = true
|
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Find and return an entry pointer if present, or return a nullptr.
|
//- Find for an entry (non-const access) with the given keyword.
|
||||||
//
|
//
|
||||||
// \param recursive search parent dictionaries
|
// \param matchOpt the search mode
|
||||||
// \param patternMatch use regular expressions
|
//
|
||||||
const entry* lookupEntryPtr
|
// \return the entry pointer found or a nullptr.
|
||||||
|
entry* findEntry
|
||||||
(
|
(
|
||||||
const word& keyword,
|
const word& keyword,
|
||||||
bool recursive,
|
enum keyType::option matchOpt = keyType::REGEX
|
||||||
bool patternMatch
|
|
||||||
) const;
|
|
||||||
|
|
||||||
//- Find and return an entry pointer for manipulation if present,
|
|
||||||
//- or return a nullptr.
|
|
||||||
//
|
|
||||||
// \param recursive search parent dictionaries
|
|
||||||
// \param patternMatch use regular expressions
|
|
||||||
entry* lookupEntryPtr
|
|
||||||
(
|
|
||||||
const word& keyword,
|
|
||||||
bool recursive,
|
|
||||||
bool patternMatch
|
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Find and return an entry if present, otherwise FatalIOError.
|
//- Find an entry (const access) with the given keyword.
|
||||||
//
|
//
|
||||||
// \param recursive search parent dictionaries
|
// \param matchOpt the default search is non-recursive with patterns
|
||||||
// \param patternMatch use regular expressions
|
//
|
||||||
|
// \return the entry pointer found or a nullptr.
|
||||||
|
const entry* findEntry
|
||||||
|
(
|
||||||
|
const word& keyword,
|
||||||
|
enum keyType::option matchOpt = keyType::REGEX
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Search for a scoped entry (const access) with the given keyword.
|
||||||
|
// Allows scoping using '.'.
|
||||||
|
// Special handling for an absolute anchor (^) at start of the keyword
|
||||||
|
// and for '..' to ascend into the parent dictionaries.
|
||||||
|
//
|
||||||
|
// \param matchOpt the default search is non-recursive with patterns
|
||||||
|
//
|
||||||
|
// \return the entry pointer found or a nullptr.
|
||||||
|
const entry* findScoped
|
||||||
|
(
|
||||||
|
const word& keyword,
|
||||||
|
enum keyType::option matchOpt = keyType::REGEX
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Find and return a sub-dictionary pointer if present
|
||||||
|
// (and a sub-dictionary) otherwise return nullptr.
|
||||||
|
//
|
||||||
|
// \param matchOpt the default search is non-recursive with patterns
|
||||||
|
dictionary* findDict
|
||||||
|
(
|
||||||
|
const word& keyword,
|
||||||
|
enum keyType::option matchOpt = keyType::REGEX
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Search for an entry (const access) with the given keyword.
|
||||||
|
//- Find and return a sub-dictionary pointer if present
|
||||||
|
// (and a sub-dictionary) otherwise return nullptr.
|
||||||
|
//
|
||||||
|
// \param matchOpt the default search is non-recursive with patterns
|
||||||
|
const dictionary* findDict
|
||||||
|
(
|
||||||
|
const word& keyword,
|
||||||
|
enum keyType::option matchOpt = keyType::REGEX
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//
|
||||||
|
// \param matchOpt the default search is non-recursive with patterns
|
||||||
|
//
|
||||||
|
// \return return an entry if present, otherwise FatalIOError.
|
||||||
const entry& lookupEntry
|
const entry& lookupEntry
|
||||||
(
|
(
|
||||||
const word& keyword,
|
const word& keyword,
|
||||||
bool recursive,
|
enum keyType::option matchOpt
|
||||||
bool patternMatch
|
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Find and return a T.
|
//- Find and return a T.
|
||||||
//- FatalIOError if not found, or if there are excess tokens.
|
//- FatalIOError if not found, or if the number of tokens is incorrect.
|
||||||
// Default search: non-recursive with patterns.
|
|
||||||
//
|
//
|
||||||
// \param recursive search parent dictionaries
|
// \param matchOpt the default search is non-recursive with patterns
|
||||||
// \param patternMatch use regular expressions
|
|
||||||
template<class T>
|
template<class T>
|
||||||
T get
|
T get
|
||||||
(
|
(
|
||||||
const word& keyword,
|
const word& keyword,
|
||||||
bool recursive = false,
|
enum keyType::option matchOpt = keyType::REGEX
|
||||||
bool patternMatch = true
|
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Find and return an entry data stream.
|
//- Find and return an entry data stream.
|
||||||
// Default search: non-recursive with patterns.
|
//- FatalIOError if not found, or if the number of tokens is incorrect.
|
||||||
//
|
//
|
||||||
// \param recursive search parent dictionaries
|
// \param matchOpt the default search is non-recursive with patterns
|
||||||
// \param patternMatch use regular expressions
|
|
||||||
ITstream& lookup
|
ITstream& lookup
|
||||||
(
|
(
|
||||||
const word& keyword,
|
const word& keyword,
|
||||||
bool recursive = false,
|
enum keyType::option matchOpt = keyType::REGEX
|
||||||
bool patternMatch = true
|
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Find and return a T.
|
//- Find and return a T, or return the given default value.
|
||||||
//- FatalIOError if not found, or if there are excess tokens.
|
//- FatalIOError if it is found and the number of tokens is incorrect.
|
||||||
// Default search: non-recursive with patterns.
|
|
||||||
//
|
//
|
||||||
// \param recursive search parent dictionaries
|
// \param matchOpt the default search is non-recursive with patterns
|
||||||
// \param patternMatch use regular expressions
|
|
||||||
//
|
|
||||||
// \deprecated - same as the get() method
|
|
||||||
template<class T>
|
|
||||||
T lookupType
|
|
||||||
(
|
|
||||||
const word& keyword,
|
|
||||||
bool recursive = false,
|
|
||||||
bool patternMatch = true
|
|
||||||
) const;
|
|
||||||
|
|
||||||
//- Find and return a T, or return the given default value
|
|
||||||
//- FatalIOError if it is found and there are excess tokens.
|
|
||||||
// Default search: non-recursive with patterns.
|
|
||||||
//
|
|
||||||
// \param recursive search parent dictionaries
|
|
||||||
// \param patternMatch use regular expressions
|
|
||||||
template<class T>
|
template<class T>
|
||||||
T lookupOrDefault
|
T lookupOrDefault
|
||||||
(
|
(
|
||||||
const word& keyword,
|
const word& keyword,
|
||||||
const T& deflt,
|
const T& deflt,
|
||||||
bool recursive = false,
|
enum keyType::option matchOpt = keyType::REGEX
|
||||||
bool patternMatch = true
|
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Find and return a T, or return the given default value
|
//- Find and return a T, or return the given default value
|
||||||
//- and add it to dictionary.
|
//- and add it to dictionary.
|
||||||
//- FatalIOError if it is found and there are excess tokens.
|
//- FatalIOError if it is found and the number of tokens is incorrect.
|
||||||
// Default search: non-recursive with patterns.
|
|
||||||
//
|
//
|
||||||
// \param recursive search parent dictionaries
|
// \param matchOpt the default search is non-recursive with patterns
|
||||||
// \param patternMatch use regular expressions
|
|
||||||
template<class T>
|
template<class T>
|
||||||
T lookupOrAddDefault
|
T lookupOrAddDefault
|
||||||
(
|
(
|
||||||
const word& keyword,
|
const word& keyword,
|
||||||
const T& deflt,
|
const T& deflt,
|
||||||
bool recursive = false,
|
enum keyType::option matchOpt = keyType::REGEX
|
||||||
bool patternMatch = true
|
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Find entry and assign to T val.
|
//- Find entry and assign to T val.
|
||||||
//- FatalIOError if it is found and there are excess tokens.
|
//- FatalIOError if it is found and the number of tokens is incorrect,
|
||||||
// Default search: non-recursive with patterns.
|
//- or it is mandatory and not found.
|
||||||
//
|
//
|
||||||
// \param recursive search parent dictionaries
|
// \param val the value to read into
|
||||||
// \param patternMatch use regular expressions
|
// \param matchOpt the default search is non-recursive with patterns
|
||||||
|
// \param mandatory the keyword is mandatory
|
||||||
//
|
//
|
||||||
// \return true if the entry was found.
|
// \return true if the entry was found.
|
||||||
template<class T>
|
template<class T>
|
||||||
@ -614,18 +617,16 @@ public:
|
|||||||
(
|
(
|
||||||
const word& keyword,
|
const word& keyword,
|
||||||
T& val,
|
T& val,
|
||||||
bool recursive = false,
|
enum keyType::option matchOpt = keyType::REGEX,
|
||||||
bool patternMatch = true,
|
|
||||||
bool mandatory = true
|
bool mandatory = true
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Find an entry if present, and assign to T val.
|
//- Find an entry if present, and assign to T val.
|
||||||
//- FatalIOError if it is found and there are excess tokens.
|
//- FatalIOError if it is found and the number of tokens is incorrect.
|
||||||
// Default search: non-recursive with patterns.
|
// Default search: non-recursive with patterns.
|
||||||
//
|
//
|
||||||
// \param val the value to read
|
// \param val the value to read into
|
||||||
// \param recursive search parent dictionaries
|
// \param matchOpt the default search is non-recursive with patterns
|
||||||
// \param patternMatch use regular expressions
|
|
||||||
//
|
//
|
||||||
// \return true if the entry was found.
|
// \return true if the entry was found.
|
||||||
template<class T>
|
template<class T>
|
||||||
@ -633,41 +634,14 @@ public:
|
|||||||
(
|
(
|
||||||
const word& keyword,
|
const word& keyword,
|
||||||
T& val,
|
T& val,
|
||||||
bool recursive = false,
|
enum keyType::option matchOpt = keyType::REGEX
|
||||||
bool patternMatch = true
|
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Find and return an entry pointer if present, or return a nullptr.
|
//- Check if entry is found and and is a sub-dictionary.
|
||||||
// Allows scoping using '.'.
|
|
||||||
// Special handling for an absolute anchor (^) at start of the keyword
|
|
||||||
// and for '..' to ascend into the parent dictionaries.
|
|
||||||
//
|
|
||||||
// \param recursive search parent dictionaries
|
|
||||||
// \param patternMatch use regular expressions
|
|
||||||
const entry* lookupScopedEntryPtr
|
|
||||||
(
|
|
||||||
const word& keyword,
|
|
||||||
bool recursive,
|
|
||||||
bool patternMatch
|
|
||||||
) const;
|
|
||||||
|
|
||||||
//- Check if entry exists and is a sub-dictionary.
|
|
||||||
//
|
//
|
||||||
// Search type: non-recursive with patterns.
|
// Search type: non-recursive with patterns.
|
||||||
bool isDict(const word& keyword) const;
|
bool isDict(const word& keyword) const;
|
||||||
|
|
||||||
//- Find and return a sub-dictionary pointer if present
|
|
||||||
// (and a sub-dictionary) otherwise return nullptr.
|
|
||||||
//
|
|
||||||
// Search type: non-recursive with patterns.
|
|
||||||
const dictionary* subDictPtr(const word& keyword) const;
|
|
||||||
|
|
||||||
//- Find and return a sub-dictionary pointer if present
|
|
||||||
// (and a sub-dictionary) otherwise return nullptr.
|
|
||||||
//
|
|
||||||
// Search type: non-recursive with patterns.
|
|
||||||
dictionary* subDictPtr(const word& keyword);
|
|
||||||
|
|
||||||
//- Find and return a sub-dictionary.
|
//- Find and return a sub-dictionary.
|
||||||
// Fatal if the entry does not exist or is not a sub-dictionary.
|
// Fatal if the entry does not exist or is not a sub-dictionary.
|
||||||
//
|
//
|
||||||
@ -856,8 +830,7 @@ public:
|
|||||||
const_searcher csearch
|
const_searcher csearch
|
||||||
(
|
(
|
||||||
const word& keyword,
|
const word& keyword,
|
||||||
bool recursive = false,
|
enum keyType::option = keyType::REGEX
|
||||||
bool patternMatch = true
|
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Search dictionary for given keyword
|
//- Search dictionary for given keyword
|
||||||
@ -868,8 +841,7 @@ public:
|
|||||||
const_searcher search
|
const_searcher search
|
||||||
(
|
(
|
||||||
const word& keyword,
|
const word& keyword,
|
||||||
bool recursive = false,
|
enum keyType::option = keyType::REGEX
|
||||||
bool patternMatch = true
|
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Search dictionary for given keyword
|
//- Search dictionary for given keyword
|
||||||
@ -880,8 +852,7 @@ public:
|
|||||||
searcher search
|
searcher search
|
||||||
(
|
(
|
||||||
const word& keyword,
|
const word& keyword,
|
||||||
bool recursive = false,
|
enum keyType::option = keyType::REGEX
|
||||||
bool patternMatch = true
|
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Search using scoping.
|
//- Search using scoping.
|
||||||
@ -910,8 +881,7 @@ public:
|
|||||||
const_searcher csearchScoped
|
const_searcher csearchScoped
|
||||||
(
|
(
|
||||||
const word& keyword,
|
const word& keyword,
|
||||||
bool recursive,
|
enum keyType::option
|
||||||
bool patternMatch
|
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Search using dot or slash scoping.
|
//- Search using dot or slash scoping.
|
||||||
@ -921,8 +891,7 @@ public:
|
|||||||
const_searcher searchScoped
|
const_searcher searchScoped
|
||||||
(
|
(
|
||||||
const word& keyword,
|
const word& keyword,
|
||||||
bool recursive,
|
enum keyType::option
|
||||||
bool patternMatch
|
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Search using dot or slash scoping.
|
//- Search using dot or slash scoping.
|
||||||
@ -932,25 +901,24 @@ public:
|
|||||||
searcher searchScoped
|
searcher searchScoped
|
||||||
(
|
(
|
||||||
const word& keyword,
|
const word& keyword,
|
||||||
bool recursive,
|
enum keyType::option
|
||||||
bool patternMatch
|
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Locate a sub-dictionary using slash-scoping
|
//- Locate a sub-dictionary using slash-scoping
|
||||||
// \return nullptr if the dictionary path does not exist
|
// \return nullptr if the dictionary path does not exist
|
||||||
const dictionary* cfindScopedDictPtr(const fileName& dictPath) const;
|
const dictionary* cfindScopedDict(const fileName& dictPath) const;
|
||||||
|
|
||||||
//- Locate a sub-dictionary using slash-scoping
|
//- Locate a sub-dictionary using slash-scoping
|
||||||
// \return nullptr if the dictionary path does not exist
|
// \return nullptr if the dictionary path does not exist
|
||||||
const dictionary* findScopedDictPtr(const fileName& dictPath) const;
|
const dictionary* findScopedDict(const fileName& dictPath) const;
|
||||||
|
|
||||||
//- Locate a sub-dictionary using slash-scoping
|
//- Locate a sub-dictionary using slash-scoping
|
||||||
// \return nullptr if the dictionary path does not exist
|
// \return nullptr if the dictionary path does not exist
|
||||||
dictionary* findScopedDictPtr(const fileName& dictPath);
|
dictionary* findScopedDict(const fileName& dictPath);
|
||||||
|
|
||||||
//- Locate existing or create sub-dictionary using slash-scoping
|
//- Locate existing or create sub-dictionary using slash-scoping
|
||||||
// \return nullptr if the dictionary path could not be created
|
// \return nullptr if the dictionary path could not be created
|
||||||
dictionary* makeScopedDictPtr(const fileName& dictPath);
|
dictionary* makeScopedDict(const fileName& dictPath);
|
||||||
|
|
||||||
|
|
||||||
// Compatibility helpers
|
// Compatibility helpers
|
||||||
@ -969,8 +937,7 @@ public:
|
|||||||
(
|
(
|
||||||
const word& keyword,
|
const word& keyword,
|
||||||
std::initializer_list<std::pair<const char*,int>> compat,
|
std::initializer_list<std::pair<const char*,int>> compat,
|
||||||
bool recursive = false,
|
enum keyType::option = keyType::REGEX
|
||||||
bool patternMatch = true
|
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Search dictionary for given keyword and any compatibility names
|
//- Search dictionary for given keyword and any compatibility names
|
||||||
@ -984,8 +951,7 @@ public:
|
|||||||
(
|
(
|
||||||
const word& keyword,
|
const word& keyword,
|
||||||
std::initializer_list<std::pair<const char*,int>> compat,
|
std::initializer_list<std::pair<const char*,int>> compat,
|
||||||
bool recursive = false,
|
enum keyType::option = keyType::REGEX
|
||||||
bool patternMatch = true
|
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Find and return an entry pointer if present, or return a nullptr,
|
//- Find and return an entry pointer if present, or return a nullptr,
|
||||||
@ -995,12 +961,11 @@ public:
|
|||||||
// OpenFOAM version for which they were used.
|
// OpenFOAM version for which they were used.
|
||||||
// \param recursive search parent dictionaries
|
// \param recursive search parent dictionaries
|
||||||
// \param patternMatch use regular expressions
|
// \param patternMatch use regular expressions
|
||||||
const entry* lookupEntryPtrCompat
|
const entry* findCompat
|
||||||
(
|
(
|
||||||
const word& keyword,
|
const word& keyword,
|
||||||
std::initializer_list<std::pair<const char*,int>> compat,
|
std::initializer_list<std::pair<const char*,int>> compat,
|
||||||
bool recursive,
|
enum keyType::option
|
||||||
bool patternMatch
|
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Find and return an entry if present, otherwise FatalIOError,
|
//- Find and return an entry if present, otherwise FatalIOError,
|
||||||
@ -1014,8 +979,7 @@ public:
|
|||||||
(
|
(
|
||||||
const word& keyword,
|
const word& keyword,
|
||||||
std::initializer_list<std::pair<const char*,int>> compat,
|
std::initializer_list<std::pair<const char*,int>> compat,
|
||||||
bool recursive,
|
enum keyType::option
|
||||||
bool patternMatch
|
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Find and return a T
|
//- Find and return a T
|
||||||
@ -1032,8 +996,7 @@ public:
|
|||||||
(
|
(
|
||||||
const word& keyword,
|
const word& keyword,
|
||||||
std::initializer_list<std::pair<const char*,int>> compat,
|
std::initializer_list<std::pair<const char*,int>> compat,
|
||||||
bool recursive = false,
|
enum keyType::option = keyType::REGEX
|
||||||
bool patternMatch = true
|
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Find and return an entry data stream,
|
//- Find and return an entry data stream,
|
||||||
@ -1048,8 +1011,7 @@ public:
|
|||||||
(
|
(
|
||||||
const word& keyword,
|
const word& keyword,
|
||||||
std::initializer_list<std::pair<const char*,int>> compat,
|
std::initializer_list<std::pair<const char*,int>> compat,
|
||||||
bool recursive = false,
|
enum keyType::option = keyType::REGEX
|
||||||
bool patternMatch = true
|
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Find and return a T, or return the given default value
|
//- Find and return a T, or return the given default value
|
||||||
@ -1066,8 +1028,7 @@ public:
|
|||||||
const word& keyword,
|
const word& keyword,
|
||||||
std::initializer_list<std::pair<const char*,int>> compat,
|
std::initializer_list<std::pair<const char*,int>> compat,
|
||||||
const T& deflt,
|
const T& deflt,
|
||||||
bool recursive = false,
|
enum keyType::option = keyType::REGEX
|
||||||
bool patternMatch = true
|
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Find entry and assign to T val
|
//- Find entry and assign to T val
|
||||||
@ -1088,8 +1049,7 @@ public:
|
|||||||
const word& keyword,
|
const word& keyword,
|
||||||
std::initializer_list<std::pair<const char*,int>> compat,
|
std::initializer_list<std::pair<const char*,int>> compat,
|
||||||
T& val,
|
T& val,
|
||||||
bool recursive = false,
|
enum keyType::option = keyType::REGEX,
|
||||||
bool patternMatch = true,
|
|
||||||
bool mandatory = true
|
bool mandatory = true
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
@ -1111,22 +1071,12 @@ public:
|
|||||||
const word& keyword,
|
const word& keyword,
|
||||||
std::initializer_list<std::pair<const char*,int>> compat,
|
std::initializer_list<std::pair<const char*,int>> compat,
|
||||||
T& val,
|
T& val,
|
||||||
bool recursive = false,
|
enum keyType::option = keyType::REGEX
|
||||||
bool patternMatch = true
|
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
|
||||||
// Member Operators
|
// Member Operators
|
||||||
|
|
||||||
//- Find and return an entry data stream (identical to #lookup method).
|
|
||||||
// Search: non-recursive with patterns.
|
|
||||||
//
|
|
||||||
// \deprecated use lookup() method instead (deprecated JUL-2018)
|
|
||||||
ITstream& operator[](const word& keyword) const
|
|
||||||
{
|
|
||||||
return lookup(keyword);
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Copy assignment
|
//- Copy assignment
|
||||||
void operator=(const dictionary& rhs);
|
void operator=(const dictionary& rhs);
|
||||||
|
|
||||||
@ -1152,7 +1102,185 @@ public:
|
|||||||
friend Ostream& operator<<(Ostream& os, const dictionary& dict);
|
friend Ostream& operator<<(Ostream& os, const dictionary& dict);
|
||||||
|
|
||||||
|
|
||||||
// Shortcuts - may be more useable in templated code
|
// Housekeeping
|
||||||
|
|
||||||
|
//- Find and return an entry data stream (identical to #lookup method).
|
||||||
|
//
|
||||||
|
// \deprecated use lookup() method instead (JUL-2018)
|
||||||
|
ITstream& operator[](const word& keyword) const
|
||||||
|
{
|
||||||
|
return lookup(keyword);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Find and return a T.
|
||||||
|
// \deprecated - same as the get() method (OCT-2018)
|
||||||
|
template<class T>
|
||||||
|
T lookupType
|
||||||
|
(
|
||||||
|
const word& keyword,
|
||||||
|
bool recursive = false,
|
||||||
|
bool patternMatch = true
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return get<T>(keyword, matchOpt(recursive, patternMatch));
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Search dictionary for given keyword.
|
||||||
|
// \deprecated - use keyType::option version instead (OCT-2018)
|
||||||
|
bool found
|
||||||
|
(
|
||||||
|
const word& keyword,
|
||||||
|
bool recursive,
|
||||||
|
bool patternMatch = true
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return found(keyword, matchOpt(recursive, patternMatch));
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Find and return an entry pointer for manipulation if present,
|
||||||
|
//- or return a nullptr.
|
||||||
|
//
|
||||||
|
// \deprecated - use keyType::option version instead (OCT-2018)
|
||||||
|
entry* lookupEntryPtr
|
||||||
|
(
|
||||||
|
const word& keyword,
|
||||||
|
bool recursive,
|
||||||
|
bool patternMatch
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return findEntry(keyword, matchOpt(recursive, patternMatch));
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Find and return an entry pointer if present, or return a nullptr.
|
||||||
|
// \deprecated - use keyType::option version instead (OCT-2018)
|
||||||
|
const entry* lookupEntryPtr
|
||||||
|
(
|
||||||
|
const word& keyword,
|
||||||
|
bool recursive,
|
||||||
|
bool patternMatch
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return findEntry(keyword, matchOpt(recursive, patternMatch));
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Find and return an entry pointer if present, or return a nullptr.
|
||||||
|
// Allows scoping using '.'.
|
||||||
|
// Special handling for an absolute anchor (^) at start of the keyword
|
||||||
|
// and for '..' to ascend into the parent dictionaries.
|
||||||
|
//
|
||||||
|
// \deprecated - use keyType::option version instead (OCT-2018)
|
||||||
|
const entry* lookupScopedEntryPtr
|
||||||
|
(
|
||||||
|
const word& keyword,
|
||||||
|
bool recursive,
|
||||||
|
bool patternMatch
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return findScoped(keyword, matchOpt(recursive, patternMatch));
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Find and return a sub-dictionary pointer if present
|
||||||
|
// (and a sub-dictionary) otherwise return nullptr.
|
||||||
|
//
|
||||||
|
// Search type: non-recursive with patterns.
|
||||||
|
const dictionary* subDictPtr(const word& keyword) const
|
||||||
|
{
|
||||||
|
return findDict(keyword, keyType::REGEX);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Find and return a sub-dictionary pointer if present
|
||||||
|
// (and a sub-dictionary) otherwise return nullptr.
|
||||||
|
//
|
||||||
|
// Search type: non-recursive with patterns.
|
||||||
|
dictionary* subDictPtr(const word& keyword)
|
||||||
|
{
|
||||||
|
return findDict(keyword, keyType::REGEX);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Find and return an entry if present, otherwise FatalIOError.
|
||||||
|
//
|
||||||
|
// \deprecated - use keyType::option version instead (OCT-2018)
|
||||||
|
const entry& lookupEntry
|
||||||
|
(
|
||||||
|
const word& keyword,
|
||||||
|
bool recursive,
|
||||||
|
bool patternMatch
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return lookupEntry(keyword, matchOpt(recursive, patternMatch));
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Find and return an entry data stream.
|
||||||
|
// Default search: non-recursive with patterns.
|
||||||
|
//
|
||||||
|
// \deprecated - use keyType::option version instead (OCT-2018)
|
||||||
|
ITstream& lookup
|
||||||
|
(
|
||||||
|
const word& keyword,
|
||||||
|
bool recursive,
|
||||||
|
bool patternMatch = true
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return lookup(keyword, matchOpt(recursive, patternMatch));
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Find and return a T, or return the given default value
|
||||||
|
//- FatalIOError if it is found and there are excess tokens.
|
||||||
|
//
|
||||||
|
// \deprecated - use keyType::option version instead (OCT-2018)
|
||||||
|
template<class T>
|
||||||
|
T lookupOrDefault
|
||||||
|
(
|
||||||
|
const word& keyword,
|
||||||
|
const T& deflt,
|
||||||
|
bool recursive,
|
||||||
|
bool patternMatch = true
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return
|
||||||
|
lookupOrDefault
|
||||||
|
(keyword, matchOpt(recursive, patternMatch));
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Find and return a T, or return the given default value
|
||||||
|
//- and add it to dictionary.
|
||||||
|
//- FatalIOError if it is found and there are excess tokens.
|
||||||
|
//
|
||||||
|
// \deprecated - use keyType::option version instead (OCT-2018)
|
||||||
|
template<class T>
|
||||||
|
T lookupOrAddDefault
|
||||||
|
(
|
||||||
|
const word& keyword,
|
||||||
|
const T& deflt,
|
||||||
|
bool recursive,
|
||||||
|
bool patternMatch = true
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return
|
||||||
|
lookupOrAddDefault
|
||||||
|
(keyword, deflt, matchOpt(recursive, patternMatch));
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Find an entry if present, and assign to T val.
|
||||||
|
//- FatalIOError if it is found and there are excess tokens.
|
||||||
|
//
|
||||||
|
// \deprecated - use keyType::option version instead (OCT-2018)
|
||||||
|
template<class T>
|
||||||
|
bool readIfPresent
|
||||||
|
(
|
||||||
|
const word& keyword,
|
||||||
|
T& val,
|
||||||
|
bool recursive,
|
||||||
|
bool patternMatch = true
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return
|
||||||
|
readIfPresent
|
||||||
|
(keyword, val, matchOpt(recursive, patternMatch));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Shortcuts - when a templated classes also inherits from a dictionary
|
||||||
|
|
||||||
#undef defineDictionaryGetter
|
#undef defineDictionaryGetter
|
||||||
#define defineDictionaryGetter(Func, Type) \
|
#define defineDictionaryGetter(Func, Type) \
|
||||||
@ -1160,11 +1288,10 @@ public:
|
|||||||
Type Func \
|
Type Func \
|
||||||
( \
|
( \
|
||||||
const word& keyword, \
|
const word& keyword, \
|
||||||
bool recursive = false, \
|
enum keyType::option matchOpt = keyType::REGEX \
|
||||||
bool patternMatch = true \
|
|
||||||
) const \
|
) const \
|
||||||
{ \
|
{ \
|
||||||
return get<Type>(keyword, recursive, patternMatch); \
|
return get<Type>(keyword, matchOpt); \
|
||||||
}
|
}
|
||||||
|
|
||||||
defineDictionaryGetter(getBool, bool);
|
defineDictionaryGetter(getBool, bool);
|
||||||
|
|||||||
@ -49,11 +49,10 @@ Foam::dictionary::const_searcher Foam::dictionary::csearchCompat
|
|||||||
(
|
(
|
||||||
const word& keyword,
|
const word& keyword,
|
||||||
std::initializer_list<std::pair<const char*,int>> compat,
|
std::initializer_list<std::pair<const char*,int>> compat,
|
||||||
bool recursive,
|
enum keyType::option matchOpt
|
||||||
bool patternMatch
|
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
const_searcher finder(csearch(keyword, recursive, patternMatch));
|
const_searcher finder(csearch(keyword, matchOpt));
|
||||||
|
|
||||||
if (finder.found())
|
if (finder.found())
|
||||||
{
|
{
|
||||||
@ -62,7 +61,7 @@ Foam::dictionary::const_searcher Foam::dictionary::csearchCompat
|
|||||||
|
|
||||||
for (const std::pair<const char*,int>& iter : compat)
|
for (const std::pair<const char*,int>& iter : compat)
|
||||||
{
|
{
|
||||||
finder = csearch(word::validate(iter.first), recursive, patternMatch);
|
finder = csearch(word::validate(iter.first), matchOpt);
|
||||||
|
|
||||||
if (finder.found())
|
if (finder.found())
|
||||||
{
|
{
|
||||||
@ -99,23 +98,21 @@ bool Foam::dictionary::foundCompat
|
|||||||
(
|
(
|
||||||
const word& keyword,
|
const word& keyword,
|
||||||
std::initializer_list<std::pair<const char*,int>> compat,
|
std::initializer_list<std::pair<const char*,int>> compat,
|
||||||
bool recursive,
|
enum keyType::option matchOpt
|
||||||
bool patternMatch
|
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
return csearchCompat(keyword, compat, recursive, patternMatch).found();
|
return csearchCompat(keyword, compat, matchOpt).found();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const Foam::entry* Foam::dictionary::lookupEntryPtrCompat
|
const Foam::entry* Foam::dictionary::findCompat
|
||||||
(
|
(
|
||||||
const word& keyword,
|
const word& keyword,
|
||||||
std::initializer_list<std::pair<const char*,int>> compat,
|
std::initializer_list<std::pair<const char*,int>> compat,
|
||||||
bool recursive,
|
enum keyType::option matchOpt
|
||||||
bool patternMatch
|
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
return csearchCompat(keyword, compat, recursive, patternMatch).ptr();
|
return csearchCompat(keyword, compat, matchOpt).ptr();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -123,12 +120,10 @@ const Foam::entry& Foam::dictionary::lookupEntryCompat
|
|||||||
(
|
(
|
||||||
const word& keyword,
|
const word& keyword,
|
||||||
std::initializer_list<std::pair<const char*,int>> compat,
|
std::initializer_list<std::pair<const char*,int>> compat,
|
||||||
bool recursive,
|
enum keyType::option matchOpt
|
||||||
bool patternMatch
|
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
const const_searcher
|
const const_searcher finder(csearchCompat(keyword, compat, matchOpt));
|
||||||
finder(csearchCompat(keyword, compat, recursive, patternMatch));
|
|
||||||
|
|
||||||
if (!finder.found())
|
if (!finder.found())
|
||||||
{
|
{
|
||||||
@ -146,12 +141,10 @@ Foam::ITstream& Foam::dictionary::lookupCompat
|
|||||||
(
|
(
|
||||||
const word& keyword,
|
const word& keyword,
|
||||||
std::initializer_list<std::pair<const char*,int>> compat,
|
std::initializer_list<std::pair<const char*,int>> compat,
|
||||||
bool recursive,
|
enum keyType::option matchOpt
|
||||||
bool patternMatch
|
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
return
|
return lookupEntryCompat(keyword, compat, matchOpt).stream();
|
||||||
lookupEntryCompat(keyword, compat, recursive, patternMatch).stream();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -33,31 +33,26 @@ Foam::dictionary::dictionary
|
|||||||
(
|
(
|
||||||
const fileName& name,
|
const fileName& name,
|
||||||
const dictionary& parentDict,
|
const dictionary& parentDict,
|
||||||
Istream& is
|
Istream& is,
|
||||||
|
bool keepHeader
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
dictionaryName(parentDict.name() + '.' + name),
|
name_(parentDict.name() + '.' + name),
|
||||||
parent_(parentDict)
|
parent_(parentDict)
|
||||||
{
|
{
|
||||||
read(is);
|
read(is, keepHeader);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::dictionary::dictionary(Istream& is)
|
Foam::dictionary::dictionary(Istream& is)
|
||||||
:
|
:
|
||||||
dictionaryName(is.name()),
|
dictionary(is, false)
|
||||||
parent_(dictionary::null)
|
{}
|
||||||
{
|
|
||||||
// Reset input mode as this is a "top-level" dictionary
|
|
||||||
entry::resetInputMode();
|
|
||||||
|
|
||||||
read(is);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::dictionary::dictionary(Istream& is, bool keepHeader)
|
Foam::dictionary::dictionary(Istream& is, bool keepHeader)
|
||||||
:
|
:
|
||||||
dictionaryName(is.name()),
|
name_(is.name()),
|
||||||
parent_(dictionary::null)
|
parent_(dictionary::null)
|
||||||
{
|
{
|
||||||
// Reset input mode as this is a "top-level" dictionary
|
// Reset input mode as this is a "top-level" dictionary
|
||||||
|
|||||||
@ -69,8 +69,7 @@ namespace
|
|||||||
Foam::dictionary::const_searcher Foam::dictionary::csearchDotScoped
|
Foam::dictionary::const_searcher Foam::dictionary::csearchDotScoped
|
||||||
(
|
(
|
||||||
const word& keyword,
|
const word& keyword,
|
||||||
bool recursive,
|
enum keyType::option matchOpt
|
||||||
bool patternMatch
|
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
auto scopePos = keyword.find('.');
|
auto scopePos = keyword.find('.');
|
||||||
@ -78,9 +77,12 @@ Foam::dictionary::const_searcher Foam::dictionary::csearchDotScoped
|
|||||||
if (scopePos == string::npos)
|
if (scopePos == string::npos)
|
||||||
{
|
{
|
||||||
// Normal, non-scoped search
|
// Normal, non-scoped search
|
||||||
return csearch(keyword, recursive, patternMatch);
|
return csearch(keyword, matchOpt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// It is '.' scoped - force non-recusive searching
|
||||||
|
matchOpt = keyType::option(matchOpt & ~(keyType::RECURSIVE));
|
||||||
|
|
||||||
if (scopePos == 0)
|
if (scopePos == 0)
|
||||||
{
|
{
|
||||||
// Starting with a '.' -> go up for every further '.' found
|
// Starting with a '.' -> go up for every further '.' found
|
||||||
@ -113,8 +115,7 @@ Foam::dictionary::const_searcher Foam::dictionary::csearchDotScoped
|
|||||||
return dictPtr->csearchDotScoped
|
return dictPtr->csearchDotScoped
|
||||||
(
|
(
|
||||||
keyword.substr(scopePos),
|
keyword.substr(scopePos),
|
||||||
false,
|
matchOpt
|
||||||
patternMatch
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,8 +123,7 @@ Foam::dictionary::const_searcher Foam::dictionary::csearchDotScoped
|
|||||||
const_searcher finder = csearchDotScoped
|
const_searcher finder = csearchDotScoped
|
||||||
(
|
(
|
||||||
keyword.substr(0, scopePos),
|
keyword.substr(0, scopePos),
|
||||||
false,
|
matchOpt
|
||||||
patternMatch
|
|
||||||
);
|
);
|
||||||
|
|
||||||
// Fall back to finding key with '.' so e.g. if keyword is
|
// Fall back to finding key with '.' so e.g. if keyword is
|
||||||
@ -137,7 +137,7 @@ Foam::dictionary::const_searcher Foam::dictionary::csearchDotScoped
|
|||||||
scopePos = keyword.find('.', scopePos+1);
|
scopePos = keyword.find('.', scopePos+1);
|
||||||
|
|
||||||
// Local entry:
|
// Local entry:
|
||||||
finder = csearch(keyword.substr(0, scopePos), false, patternMatch);
|
finder = csearch(keyword.substr(0, scopePos), matchOpt);
|
||||||
|
|
||||||
if (scopePos == string::npos)
|
if (scopePos == string::npos)
|
||||||
{
|
{
|
||||||
@ -152,8 +152,7 @@ Foam::dictionary::const_searcher Foam::dictionary::csearchDotScoped
|
|||||||
return finder.dict().csearchDotScoped
|
return finder.dict().csearchDotScoped
|
||||||
(
|
(
|
||||||
keyword.substr(scopePos),
|
keyword.substr(scopePos),
|
||||||
false,
|
matchOpt
|
||||||
patternMatch
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -164,9 +163,13 @@ Foam::dictionary::const_searcher Foam::dictionary::csearchDotScoped
|
|||||||
Foam::dictionary::const_searcher Foam::dictionary::csearchSlashScoped
|
Foam::dictionary::const_searcher Foam::dictionary::csearchSlashScoped
|
||||||
(
|
(
|
||||||
const word& keyword,
|
const word& keyword,
|
||||||
bool patternMatch
|
enum keyType::option matchOpt
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// With '/' scoping - recursive is never allowed
|
||||||
|
matchOpt = keyType::option(matchOpt & ~(keyType::RECURSIVE));
|
||||||
|
|
||||||
const dictionary* dictPtr = this;
|
const dictionary* dictPtr = this;
|
||||||
|
|
||||||
const auto slash = keyword.find('/');
|
const auto slash = keyword.find('/');
|
||||||
@ -175,7 +178,7 @@ Foam::dictionary::const_searcher Foam::dictionary::csearchSlashScoped
|
|||||||
{
|
{
|
||||||
// No slashes:
|
// No slashes:
|
||||||
// Can use normal (non-scoped) search at the current dictionary level
|
// Can use normal (non-scoped) search at the current dictionary level
|
||||||
return csearch(keyword, false, patternMatch);
|
return csearch(keyword, matchOpt);
|
||||||
}
|
}
|
||||||
else if (slash == 0)
|
else if (slash == 0)
|
||||||
{
|
{
|
||||||
@ -220,7 +223,7 @@ Foam::dictionary::const_searcher Foam::dictionary::csearchSlashScoped
|
|||||||
// Find entry
|
// Find entry
|
||||||
const word key = word::validate(cmpt);
|
const word key = word::validate(cmpt);
|
||||||
|
|
||||||
auto finder = dictPtr->csearch(key, false, patternMatch);
|
auto finder = dictPtr->csearch(key, matchOpt);
|
||||||
|
|
||||||
if (finder.found())
|
if (finder.found())
|
||||||
{
|
{
|
||||||
@ -259,8 +262,7 @@ Foam::dictionary::const_searcher Foam::dictionary::csearchSlashScoped
|
|||||||
Foam::dictionary::const_searcher Foam::dictionary::csearch
|
Foam::dictionary::const_searcher Foam::dictionary::csearch
|
||||||
(
|
(
|
||||||
const word& keyword,
|
const word& keyword,
|
||||||
bool recursive,
|
enum keyType::option matchOpt
|
||||||
bool patternMatch
|
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
const_searcher finder(this);
|
const_searcher finder(this);
|
||||||
@ -273,27 +275,22 @@ Foam::dictionary::const_searcher Foam::dictionary::csearch
|
|||||||
return finder;
|
return finder;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (patternMatch && patterns_.size())
|
if ((matchOpt & keyType::REGEX) && patterns_.size())
|
||||||
{
|
{
|
||||||
pattern_const_iterator wcLink = patterns_.begin();
|
pattern_const_iterator wcLink = patterns_.begin();
|
||||||
regexp_const_iterator reLink = regexps_.begin();
|
regexp_const_iterator reLink = regexps_.begin();
|
||||||
|
|
||||||
// Find in patterns using regular expressions only
|
// Find in patterns using regular expressions only
|
||||||
if (findInPatterns(patternMatch, keyword, wcLink, reLink))
|
if (findInPatterns(true, keyword, wcLink, reLink))
|
||||||
{
|
{
|
||||||
finder.set(*wcLink);
|
finder.set(*wcLink);
|
||||||
return finder;
|
return finder;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (recursive && &parent_ != &dictionary::null)
|
if ((matchOpt & keyType::RECURSIVE) && &parent_ != &dictionary::null)
|
||||||
{
|
{
|
||||||
return parent_.csearch
|
return parent_.csearch(keyword, matchOpt);
|
||||||
(
|
|
||||||
keyword,
|
|
||||||
recursive,
|
|
||||||
patternMatch
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return finder;
|
return finder;
|
||||||
@ -303,22 +300,20 @@ Foam::dictionary::const_searcher Foam::dictionary::csearch
|
|||||||
Foam::dictionary::const_searcher Foam::dictionary::search
|
Foam::dictionary::const_searcher Foam::dictionary::search
|
||||||
(
|
(
|
||||||
const word& keyword,
|
const word& keyword,
|
||||||
bool recursive,
|
enum keyType::option matchOpt
|
||||||
bool patternMatch
|
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
return csearch(keyword, recursive, patternMatch);
|
return csearch(keyword, matchOpt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::dictionary::searcher Foam::dictionary::search
|
Foam::dictionary::searcher Foam::dictionary::search
|
||||||
(
|
(
|
||||||
const word& keyword,
|
const word& keyword,
|
||||||
bool recursive,
|
enum keyType::option matchOpt
|
||||||
bool patternMatch
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const_searcher finder = csearch(keyword, recursive, patternMatch);
|
const_searcher finder = csearch(keyword, matchOpt);
|
||||||
|
|
||||||
return static_cast<const searcher&>(finder);
|
return static_cast<const searcher&>(finder);
|
||||||
}
|
}
|
||||||
@ -327,17 +322,19 @@ Foam::dictionary::searcher Foam::dictionary::search
|
|||||||
Foam::dictionary::const_searcher Foam::dictionary::csearchScoped
|
Foam::dictionary::const_searcher Foam::dictionary::csearchScoped
|
||||||
(
|
(
|
||||||
const word& keyword,
|
const word& keyword,
|
||||||
bool recursive,
|
enum keyType::option matchOpt
|
||||||
bool patternMatch
|
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
if (keyword.find('/') != string::npos)
|
if (keyword.find('/') != string::npos)
|
||||||
{
|
{
|
||||||
return csearchSlashScoped(keyword, patternMatch);
|
return csearchSlashScoped(keyword, matchOpt);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (keyword[0] == ':' || keyword[0] == '^')
|
if (keyword[0] == ':' || keyword[0] == '^')
|
||||||
{
|
{
|
||||||
|
// It is ':' scoped - force non-recusive searching
|
||||||
|
matchOpt = keyType::option(matchOpt & ~(keyType::RECURSIVE));
|
||||||
|
|
||||||
// Ascend to top-level
|
// Ascend to top-level
|
||||||
const dictionary* dictPtr = this;
|
const dictionary* dictPtr = this;
|
||||||
while (&dictPtr->parent_ != &dictionary::null)
|
while (&dictPtr->parent_ != &dictionary::null)
|
||||||
@ -345,43 +342,36 @@ Foam::dictionary::const_searcher Foam::dictionary::csearchScoped
|
|||||||
dictPtr = &dictPtr->parent_;
|
dictPtr = &dictPtr->parent_;
|
||||||
}
|
}
|
||||||
|
|
||||||
return dictPtr->csearchDotScoped
|
return dictPtr->csearchDotScoped(keyword.substr(1), matchOpt);
|
||||||
(
|
|
||||||
keyword.substr(1),
|
|
||||||
false,
|
|
||||||
patternMatch
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return csearchDotScoped(keyword, recursive, patternMatch);
|
return csearchDotScoped(keyword, matchOpt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::dictionary::const_searcher Foam::dictionary::searchScoped
|
Foam::dictionary::const_searcher Foam::dictionary::searchScoped
|
||||||
(
|
(
|
||||||
const word& keyword,
|
const word& keyword,
|
||||||
bool recursive,
|
enum keyType::option matchOpt
|
||||||
bool patternMatch
|
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
return csearchScoped(keyword, recursive, patternMatch);
|
return csearchScoped(keyword, matchOpt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::dictionary::searcher Foam::dictionary::searchScoped
|
Foam::dictionary::searcher Foam::dictionary::searchScoped
|
||||||
(
|
(
|
||||||
const word& keyword,
|
const word& keyword,
|
||||||
bool recursive,
|
enum keyType::option matchOpt
|
||||||
bool patternMatch
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const_searcher finder = csearchScoped(keyword, recursive, patternMatch);
|
const_searcher finder = csearchScoped(keyword, matchOpt);
|
||||||
|
|
||||||
return static_cast<const searcher&>(finder);
|
return static_cast<const searcher&>(finder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const Foam::dictionary* Foam::dictionary::cfindScopedDictPtr
|
const Foam::dictionary* Foam::dictionary::cfindScopedDict
|
||||||
(
|
(
|
||||||
const fileName& dictPath
|
const fileName& dictPath
|
||||||
) const
|
) const
|
||||||
@ -466,26 +456,26 @@ const Foam::dictionary* Foam::dictionary::cfindScopedDictPtr
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const Foam::dictionary* Foam::dictionary::findScopedDictPtr
|
const Foam::dictionary* Foam::dictionary::findScopedDict
|
||||||
(
|
(
|
||||||
const fileName& dictPath
|
const fileName& dictPath
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
return cfindScopedDictPtr(dictPath);
|
return cfindScopedDict(dictPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::dictionary* Foam::dictionary::findScopedDictPtr
|
Foam::dictionary* Foam::dictionary::findScopedDict
|
||||||
(
|
(
|
||||||
const fileName& dictPath
|
const fileName& dictPath
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const dictionary* ptr = cfindScopedDictPtr(dictPath);
|
const dictionary* ptr = cfindScopedDict(dictPath);
|
||||||
return const_cast<dictionary*>(ptr);
|
return const_cast<dictionary*>(ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::dictionary* Foam::dictionary::makeScopedDictPtr(const fileName& dictPath)
|
Foam::dictionary* Foam::dictionary::makeScopedDict(const fileName& dictPath)
|
||||||
{
|
{
|
||||||
// Or warning
|
// Or warning
|
||||||
if (dictPath.empty())
|
if (dictPath.empty())
|
||||||
@ -536,7 +526,8 @@ Foam::dictionary* Foam::dictionary::makeScopedDictPtr(const fileName& dictPath)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Non-recursive, no patternMatch
|
// Non-recursive, no patternMatch
|
||||||
// -> can do direct lookup, without csearch(cmptName, false, false);
|
// -> can do direct lookup,
|
||||||
|
// without csearch(cmptName, keyType::LITERAL);
|
||||||
const word cmptName(cmpt.str(), false);
|
const word cmptName(cmpt.str(), false);
|
||||||
|
|
||||||
auto iter = dictPtr->hashedEntries_.find(cmptName);
|
auto iter = dictPtr->hashedEntries_.find(cmptName);
|
||||||
|
|||||||
@ -53,12 +53,11 @@ template<class T>
|
|||||||
T Foam::dictionary::get
|
T Foam::dictionary::get
|
||||||
(
|
(
|
||||||
const word& keyword,
|
const word& keyword,
|
||||||
bool recursive,
|
enum keyType::option matchOpt
|
||||||
bool patternMatch
|
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
T val;
|
T val;
|
||||||
readEntry<T>(keyword, val, recursive, patternMatch);
|
readEntry<T>(keyword, val, matchOpt);
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,12 +67,11 @@ T Foam::dictionary::getCompat
|
|||||||
(
|
(
|
||||||
const word& keyword,
|
const word& keyword,
|
||||||
std::initializer_list<std::pair<const char*,int>> compat,
|
std::initializer_list<std::pair<const char*,int>> compat,
|
||||||
bool recursive,
|
enum keyType::option matchOpt
|
||||||
bool patternMatch
|
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
T val;
|
T val;
|
||||||
readCompat<T>(keyword, compat, val, recursive, patternMatch);
|
readCompat<T>(keyword, compat, val, matchOpt);
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,13 +82,11 @@ bool Foam::dictionary::readCompat
|
|||||||
const word& keyword,
|
const word& keyword,
|
||||||
std::initializer_list<std::pair<const char*,int>> compat,
|
std::initializer_list<std::pair<const char*,int>> compat,
|
||||||
T& val,
|
T& val,
|
||||||
bool recursive,
|
enum keyType::option matchOpt,
|
||||||
bool patternMatch,
|
|
||||||
bool mandatory
|
bool mandatory
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
const const_searcher
|
const const_searcher finder(csearchCompat(keyword, compat, matchOpt));
|
||||||
finder(csearchCompat(keyword, compat, recursive, patternMatch));
|
|
||||||
|
|
||||||
if (finder.found())
|
if (finder.found())
|
||||||
{
|
{
|
||||||
@ -113,29 +109,15 @@ bool Foam::dictionary::readCompat
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// older name
|
|
||||||
template<class T>
|
|
||||||
T Foam::dictionary::lookupType
|
|
||||||
(
|
|
||||||
const word& keyword,
|
|
||||||
bool recursive,
|
|
||||||
bool patternMatch
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
return get<T>(keyword, recursive, patternMatch);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
T Foam::dictionary::lookupOrDefault
|
T Foam::dictionary::lookupOrDefault
|
||||||
(
|
(
|
||||||
const word& keyword,
|
const word& keyword,
|
||||||
const T& deflt,
|
const T& deflt,
|
||||||
bool recursive,
|
enum keyType::option matchOpt
|
||||||
bool patternMatch
|
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
const const_searcher finder(csearch(keyword, recursive, patternMatch));
|
const const_searcher finder(csearch(keyword, matchOpt));
|
||||||
|
|
||||||
if (finder.found())
|
if (finder.found())
|
||||||
{
|
{
|
||||||
@ -165,11 +147,10 @@ T Foam::dictionary::lookupOrAddDefault
|
|||||||
(
|
(
|
||||||
const word& keyword,
|
const word& keyword,
|
||||||
const T& deflt,
|
const T& deflt,
|
||||||
bool recursive,
|
enum keyType::option matchOpt
|
||||||
bool patternMatch
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const const_searcher finder(csearch(keyword, recursive, patternMatch));
|
const const_searcher finder(csearch(keyword, matchOpt));
|
||||||
|
|
||||||
if (finder.found())
|
if (finder.found())
|
||||||
{
|
{
|
||||||
@ -200,12 +181,11 @@ bool Foam::dictionary::readEntry
|
|||||||
(
|
(
|
||||||
const word& keyword,
|
const word& keyword,
|
||||||
T& val,
|
T& val,
|
||||||
bool recursive,
|
enum keyType::option matchOpt,
|
||||||
bool patternMatch,
|
|
||||||
bool mandatory
|
bool mandatory
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
const const_searcher finder(csearch(keyword, recursive, patternMatch));
|
const const_searcher finder(csearch(keyword, matchOpt));
|
||||||
|
|
||||||
if (finder.found())
|
if (finder.found())
|
||||||
{
|
{
|
||||||
@ -233,12 +213,11 @@ bool Foam::dictionary::readIfPresent
|
|||||||
(
|
(
|
||||||
const word& keyword,
|
const word& keyword,
|
||||||
T& val,
|
T& val,
|
||||||
bool recursive,
|
enum keyType::option matchOpt
|
||||||
bool patternMatch
|
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
// Read is non-mandatory
|
// Read is non-mandatory
|
||||||
return readEntry<T>(keyword, val, recursive, patternMatch, false);
|
return readEntry<T>(keyword, val, matchOpt, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -248,12 +227,10 @@ T Foam::dictionary::lookupOrDefaultCompat
|
|||||||
const word& keyword,
|
const word& keyword,
|
||||||
std::initializer_list<std::pair<const char*,int>> compat,
|
std::initializer_list<std::pair<const char*,int>> compat,
|
||||||
const T& deflt,
|
const T& deflt,
|
||||||
bool recursive,
|
enum keyType::option matchOpt
|
||||||
bool patternMatch
|
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
const const_searcher
|
const const_searcher finder(csearchCompat(keyword, compat, matchOpt));
|
||||||
finder(csearchCompat(keyword, compat, recursive, patternMatch));
|
|
||||||
|
|
||||||
if (finder.found())
|
if (finder.found())
|
||||||
{
|
{
|
||||||
@ -284,12 +261,11 @@ bool Foam::dictionary::readIfPresentCompat
|
|||||||
const word& keyword,
|
const word& keyword,
|
||||||
std::initializer_list<std::pair<const char*,int>> compat,
|
std::initializer_list<std::pair<const char*,int>> compat,
|
||||||
T& val,
|
T& val,
|
||||||
bool recursive,
|
enum keyType::option matchOpt
|
||||||
bool patternMatch
|
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
// Read is non-mandatory
|
// Read is non-mandatory
|
||||||
return readCompat<T>(keyword, compat, val, recursive, patternMatch, false);
|
return readCompat<T>(keyword, compat, val, matchOpt, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -241,7 +241,8 @@ bool Foam::entry::New
|
|||||||
const word varName = keyword.substr(1);
|
const word varName = keyword.substr(1);
|
||||||
|
|
||||||
// Lookup the variable name in the given dictionary
|
// Lookup the variable name in the given dictionary
|
||||||
const auto finder = parentDict.csearchScoped(varName, true, true);
|
const auto finder =
|
||||||
|
parentDict.csearchScoped(varName, keyType::REGEX_RECURSIVE);
|
||||||
|
|
||||||
if (finder.found())
|
if (finder.found())
|
||||||
{
|
{
|
||||||
@ -301,8 +302,8 @@ bool Foam::entry::New
|
|||||||
auto finder =
|
auto finder =
|
||||||
(
|
(
|
||||||
scoped
|
scoped
|
||||||
? parentDict.searchScoped(keyword, false, false)
|
? parentDict.searchScoped(keyword, keyType::LITERAL)
|
||||||
: parentDict.search(keyword, false, false)
|
: parentDict.search(keyword, keyType::LITERAL)
|
||||||
);
|
);
|
||||||
|
|
||||||
// How to manage duplicate entries
|
// How to manage duplicate entries
|
||||||
@ -387,10 +388,7 @@ bool Foam::entry::New
|
|||||||
// Get or create the dictionary-path.
|
// Get or create the dictionary-path.
|
||||||
// fileName::path == dictionary-path
|
// fileName::path == dictionary-path
|
||||||
dictionary* subDictPtr =
|
dictionary* subDictPtr =
|
||||||
parentDict.makeScopedDictPtr
|
parentDict.makeScopedDict(fileName::path(fullPath));
|
||||||
(
|
|
||||||
fileName::path(fullPath)
|
|
||||||
);
|
|
||||||
|
|
||||||
if (subDictPtr)
|
if (subDictPtr)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -61,8 +61,7 @@ bool Foam::functionEntries::removeEntry::execute
|
|||||||
if (key.isLiteral() && key.find('/') != string::npos)
|
if (key.isLiteral() && key.find('/') != string::npos)
|
||||||
{
|
{
|
||||||
// Remove scoped keyword, or keyword in the local scope
|
// Remove scoped keyword, or keyword in the local scope
|
||||||
dictionary::searcher finder =
|
auto finder(parentDict.searchScoped(key, keyType::LITERAL));
|
||||||
parentDict.searchScoped(key, false, false);
|
|
||||||
|
|
||||||
if (finder.found())
|
if (finder.found())
|
||||||
{
|
{
|
||||||
|
|||||||
@ -78,7 +78,8 @@ bool Foam::primitiveEntry::expandVariable
|
|||||||
// The $internalField would be matched by the ".*" !!!
|
// The $internalField would be matched by the ".*" !!!
|
||||||
|
|
||||||
// Recursive, non-patterns
|
// Recursive, non-patterns
|
||||||
const entry* eptr = dict.lookupScopedEntryPtr(varName, true, false);
|
const entry* eptr = dict.findScoped(varName, keyType::LITERAL_RECURSIVE);
|
||||||
|
|
||||||
if (!eptr)
|
if (!eptr)
|
||||||
{
|
{
|
||||||
// Not found - revert to environment variable
|
// Not found - revert to environment variable
|
||||||
|
|||||||
@ -55,14 +55,14 @@ static inline void writeEntryIfPresent
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
// non-recursive like dictionary::found, but no pattern-match either
|
// non-recursive like dictionary::found, but no pattern-match either
|
||||||
const entry* ptr = dict.lookupEntryPtr(key, false, false);
|
const entry* eptr = dict.findEntry(key, keyType::LITERAL);
|
||||||
|
|
||||||
if (ptr)
|
if (eptr)
|
||||||
{
|
{
|
||||||
os.writeKeyword(key)
|
os.writeKeyword(key)
|
||||||
<< token::HASH << token::BEGIN_BLOCK;
|
<< token::HASH << token::BEGIN_BLOCK;
|
||||||
|
|
||||||
os.writeQuoted(string(ptr->stream()), false)
|
os.writeQuoted(string(eptr->stream()), false)
|
||||||
<< token::HASH << token::END_BLOCK
|
<< token::HASH << token::END_BLOCK
|
||||||
<< token::END_STATEMENT << nl;
|
<< token::END_STATEMENT << nl;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -44,50 +44,40 @@ Foam::dynamicCodeContext::dynamicCodeContext(const dictionary& dict)
|
|||||||
// - necessary for compilation options, convenient for includes
|
// - necessary for compilation options, convenient for includes
|
||||||
// and body.
|
// and body.
|
||||||
|
|
||||||
const entry* codePtr = dict.lookupEntryPtr
|
const entry* codePtr = dict.findEntry("code", keyType::LITERAL);
|
||||||
(
|
|
||||||
"code",
|
|
||||||
false,
|
|
||||||
false
|
|
||||||
);
|
|
||||||
if (codePtr)
|
if (codePtr)
|
||||||
{
|
{
|
||||||
code_ = stringOps::trim(codePtr->stream());
|
code_ = stringOps::trim(codePtr->stream());
|
||||||
stringOps::inplaceExpand(code_, dict);
|
stringOps::inplaceExpand(code_, dict);
|
||||||
}
|
}
|
||||||
|
|
||||||
const entry* includePtr = dict.lookupEntryPtr
|
const entry* includePtr = dict.findEntry("codeInclude", keyType::LITERAL);
|
||||||
(
|
|
||||||
"codeInclude",
|
|
||||||
false,
|
|
||||||
false
|
|
||||||
);
|
|
||||||
if (includePtr)
|
if (includePtr)
|
||||||
{
|
{
|
||||||
include_ = stringOps::trim(includePtr->stream());
|
include_ = stringOps::trim(includePtr->stream());
|
||||||
stringOps::inplaceExpand(include_, dict);
|
stringOps::inplaceExpand(include_, dict);
|
||||||
}
|
}
|
||||||
|
|
||||||
const entry* optionsPtr = dict.lookupEntryPtr
|
const entry* optionsPtr = dict.findEntry("codeOptions", keyType::LITERAL);
|
||||||
(
|
|
||||||
"codeOptions",
|
|
||||||
false,
|
|
||||||
false
|
|
||||||
);
|
|
||||||
if (optionsPtr)
|
if (optionsPtr)
|
||||||
{
|
{
|
||||||
options_ = stringOps::trim(optionsPtr->stream());
|
options_ = stringOps::trim(optionsPtr->stream());
|
||||||
stringOps::inplaceExpand(options_, dict);
|
stringOps::inplaceExpand(options_, dict);
|
||||||
}
|
}
|
||||||
|
|
||||||
const entry* libsPtr = dict.lookupEntryPtr("codeLibs", false, false);
|
const entry* libsPtr = dict.findEntry("codeLibs", keyType::LITERAL);
|
||||||
|
|
||||||
if (libsPtr)
|
if (libsPtr)
|
||||||
{
|
{
|
||||||
libs_ = stringOps::trim(libsPtr->stream());
|
libs_ = stringOps::trim(libsPtr->stream());
|
||||||
stringOps::inplaceExpand(libs_, dict);
|
stringOps::inplaceExpand(libs_, dict);
|
||||||
}
|
}
|
||||||
|
|
||||||
const entry* localPtr = dict.lookupEntryPtr("localCode", false, false);
|
const entry* localPtr = dict.findEntry("localCode", keyType::LITERAL);
|
||||||
|
|
||||||
if (localPtr)
|
if (localPtr)
|
||||||
{
|
{
|
||||||
localCode_ = stringOps::trim(localPtr->stream());
|
localCode_ = stringOps::trim(localPtr->stream());
|
||||||
|
|||||||
@ -706,12 +706,8 @@ bool Foam::functionObjectList::read()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Update existing and add new functionObjects
|
// Update existing and add new functionObjects
|
||||||
const entry* entryPtr = parentDict_.lookupEntryPtr
|
const entry* entryPtr =
|
||||||
(
|
parentDict_.findEntry("functions", keyType::LITERAL);
|
||||||
"functions",
|
|
||||||
false,
|
|
||||||
false
|
|
||||||
);
|
|
||||||
|
|
||||||
if (entryPtr)
|
if (entryPtr)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -135,12 +135,9 @@ Foam::dictionary& Foam::debug::switchSet
|
|||||||
{
|
{
|
||||||
if (!subDictPtr)
|
if (!subDictPtr)
|
||||||
{
|
{
|
||||||
entry* ePtr = controlDict().lookupEntryPtr
|
entry* eptr = controlDict().findEntry(subDictName, keyType::LITERAL);
|
||||||
(
|
|
||||||
subDictName, false, false
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!ePtr || !ePtr->isDict())
|
if (!eptr || !eptr->isDict())
|
||||||
{
|
{
|
||||||
cerr<< "debug::switchSet(const char*, dictionary*&):\n"
|
cerr<< "debug::switchSet(const char*, dictionary*&):\n"
|
||||||
<< " Cannot find " << subDictName << " in dictionary "
|
<< " Cannot find " << subDictName << " in dictionary "
|
||||||
@ -150,7 +147,7 @@ Foam::dictionary& Foam::debug::switchSet
|
|||||||
::exit(1);
|
::exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
subDictPtr = &ePtr->dict();
|
subDictPtr = &(eptr->dict());
|
||||||
}
|
}
|
||||||
|
|
||||||
return *subDictPtr;
|
return *subDictPtr;
|
||||||
@ -179,7 +176,7 @@ int Foam::debug::debugSwitch(const char* name, const int defaultValue)
|
|||||||
{
|
{
|
||||||
return debugSwitches().lookupOrAddDefault
|
return debugSwitches().lookupOrAddDefault
|
||||||
(
|
(
|
||||||
name, defaultValue, false, false
|
name, defaultValue, keyType::LITERAL
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -188,7 +185,7 @@ int Foam::debug::infoSwitch(const char* name, const int defaultValue)
|
|||||||
{
|
{
|
||||||
return infoSwitches().lookupOrAddDefault
|
return infoSwitches().lookupOrAddDefault
|
||||||
(
|
(
|
||||||
name, defaultValue, false, false
|
name, defaultValue, keyType::LITERAL
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -197,7 +194,7 @@ int Foam::debug::optimisationSwitch(const char* name, const int defaultValue)
|
|||||||
{
|
{
|
||||||
return optimisationSwitches().lookupOrAddDefault
|
return optimisationSwitches().lookupOrAddDefault
|
||||||
(
|
(
|
||||||
name, defaultValue, false, false
|
name, defaultValue, keyType::LITERAL
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -210,7 +207,7 @@ float Foam::debug::floatOptimisationSwitch
|
|||||||
{
|
{
|
||||||
return optimisationSwitches().lookupOrAddDefault
|
return optimisationSwitches().lookupOrAddDefault
|
||||||
(
|
(
|
||||||
name, defaultValue, false, false
|
name, defaultValue, keyType::LITERAL
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -412,17 +409,17 @@ void listSwitches
|
|||||||
|
|
||||||
wordHashSet controlDictDebug
|
wordHashSet controlDictDebug
|
||||||
(
|
(
|
||||||
controlDict.subDict("DebugSwitches").sortedToc()
|
controlDict.subDict("DebugSwitches").toc()
|
||||||
);
|
);
|
||||||
|
|
||||||
wordHashSet controlDictInfo
|
wordHashSet controlDictInfo
|
||||||
(
|
(
|
||||||
controlDict.subDict("InfoSwitches").sortedToc()
|
controlDict.subDict("InfoSwitches").toc()
|
||||||
);
|
);
|
||||||
|
|
||||||
wordHashSet controlDictOpt
|
wordHashSet controlDictOpt
|
||||||
(
|
(
|
||||||
controlDict.subDict("OptimisationSwitches").sortedToc()
|
controlDict.subDict("OptimisationSwitches").toc()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -50,8 +50,7 @@ namespace Foam
|
|||||||
"fileHandler",
|
"fileHandler",
|
||||||
//Foam::fileOperations::uncollatedFileOperation::typeName,
|
//Foam::fileOperations::uncollatedFileOperation::typeName,
|
||||||
"uncollated",
|
"uncollated",
|
||||||
false,
|
keyType::LITERAL
|
||||||
false
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -43,8 +43,10 @@ Foam::word Foam::lduMatrix::preconditioner::getName
|
|||||||
{
|
{
|
||||||
word name;
|
word name;
|
||||||
|
|
||||||
// handle primitive or dictionary entry
|
// Handle primitive or dictionary entry
|
||||||
const entry& e = solverControls.lookupEntry("preconditioner", false, false);
|
const entry& e =
|
||||||
|
solverControls.lookupEntry("preconditioner", keyType::LITERAL);
|
||||||
|
|
||||||
if (e.isDict())
|
if (e.isDict())
|
||||||
{
|
{
|
||||||
e.dict().readEntry("preconditioner", name);
|
e.dict().readEntry("preconditioner", name);
|
||||||
@ -67,8 +69,11 @@ Foam::lduMatrix::preconditioner::New
|
|||||||
{
|
{
|
||||||
word name;
|
word name;
|
||||||
|
|
||||||
// handle primitive or dictionary entry
|
// Handle primitive or dictionary entry
|
||||||
const entry& e = solverControls.lookupEntry("preconditioner", false, false);
|
|
||||||
|
const entry& e =
|
||||||
|
solverControls.lookupEntry("preconditioner", keyType::LITERAL);
|
||||||
|
|
||||||
if (e.isDict())
|
if (e.isDict())
|
||||||
{
|
{
|
||||||
e.dict().readEntry("preconditioner", name);
|
e.dict().readEntry("preconditioner", name);
|
||||||
|
|||||||
@ -43,8 +43,10 @@ Foam::lduMatrix::smoother::getName
|
|||||||
{
|
{
|
||||||
word name;
|
word name;
|
||||||
|
|
||||||
// handle primitive or dictionary entry
|
// Handle primitive or dictionary entry
|
||||||
const entry& e = solverControls.lookupEntry("smoother", false, false);
|
const entry& e =
|
||||||
|
solverControls.lookupEntry("smoother", keyType::LITERAL);
|
||||||
|
|
||||||
if (e.isDict())
|
if (e.isDict())
|
||||||
{
|
{
|
||||||
e.dict().readEntry("smoother", name);
|
e.dict().readEntry("smoother", name);
|
||||||
@ -70,8 +72,10 @@ Foam::autoPtr<Foam::lduMatrix::smoother> Foam::lduMatrix::smoother::New
|
|||||||
{
|
{
|
||||||
word name;
|
word name;
|
||||||
|
|
||||||
// handle primitive or dictionary entry
|
// Handle primitive or dictionary entry
|
||||||
const entry& e = solverControls.lookupEntry("smoother", false, false);
|
const entry& e =
|
||||||
|
solverControls.lookupEntry("smoother", keyType::LITERAL);
|
||||||
|
|
||||||
if (e.isDict())
|
if (e.isDict())
|
||||||
{
|
{
|
||||||
e.dict().readEntry("smoother", name);
|
e.dict().readEntry("smoother", name);
|
||||||
|
|||||||
@ -35,9 +35,9 @@ namespace Foam
|
|||||||
|
|
||||||
// List of sub-dictionaries to rewrite
|
// List of sub-dictionaries to rewrite
|
||||||
static const Foam::List<Foam::word> subDictNames
|
static const Foam::List<Foam::word> subDictNames
|
||||||
{
|
({
|
||||||
"preconditioner", "smoother"
|
"preconditioner", "smoother"
|
||||||
};
|
});
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||||
@ -184,14 +184,13 @@ Foam::label Foam::solution::upgradeSolverDict
|
|||||||
// 1) primitiveEntry w/o settings,
|
// 1) primitiveEntry w/o settings,
|
||||||
// 2) or a dictionaryEntry.
|
// 2) or a dictionaryEntry.
|
||||||
// transform primitiveEntry with settings -> dictionaryEntry
|
// transform primitiveEntry with settings -> dictionaryEntry
|
||||||
forAll(subDictNames, dictI)
|
for (const word& dictName : subDictNames)
|
||||||
{
|
{
|
||||||
const word& dictName = subDictNames[dictI];
|
entry* eptr = subdict.findEntry(dictName, keyType::LITERAL);
|
||||||
entry* ePtr = subdict.lookupEntryPtr(dictName,false,false);
|
|
||||||
|
|
||||||
if (ePtr && !ePtr->isDict())
|
if (eptr && !eptr->isDict())
|
||||||
{
|
{
|
||||||
Istream& is = ePtr->stream();
|
Istream& is = eptr->stream();
|
||||||
is >> name;
|
is >> name;
|
||||||
|
|
||||||
if (!is.eof())
|
if (!is.eof())
|
||||||
@ -234,11 +233,9 @@ bool Foam::solution::cache(const word& name) const
|
|||||||
|
|
||||||
return cache_.found(name);
|
return cache_.found(name);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool Foam::solution::relaxField(const word& name) const
|
bool Foam::solution::relaxField(const word& name) const
|
||||||
|
|||||||
@ -57,7 +57,7 @@ Foam::autoPtr<Foam::Function1<Type>> Foam::Function1<Type>::New
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Istream& is(dict.lookup(entryName, false));
|
Istream& is = dict.lookup(entryName); // non-recursive, allow patterns
|
||||||
|
|
||||||
token firstToken(is);
|
token firstToken(is);
|
||||||
word Function1Type;
|
word Function1Type;
|
||||||
|
|||||||
@ -82,6 +82,20 @@ public:
|
|||||||
static const keyType null;
|
static const keyType null;
|
||||||
|
|
||||||
|
|
||||||
|
// Public data types
|
||||||
|
|
||||||
|
//- Enumeration for search/match modes as bitmask
|
||||||
|
// eg, (keyType::REGEX | keyType::RECURSIVE)
|
||||||
|
enum option
|
||||||
|
{
|
||||||
|
LITERAL = 0, //!< String literal
|
||||||
|
REGEX = 1, //!< Regular expression
|
||||||
|
RECURSIVE = 0x10, //!< Recursive search (eg, in dictionary)
|
||||||
|
LITERAL_RECURSIVE = (LITERAL | RECURSIVE),
|
||||||
|
REGEX_RECURSIVE = (REGEX | RECURSIVE)
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct null
|
//- Construct null
|
||||||
@ -100,19 +114,19 @@ public:
|
|||||||
inline keyType(const char* s);
|
inline keyType(const char* s);
|
||||||
|
|
||||||
//- Copy construct from std::string with specified treatment
|
//- Copy construct from std::string with specified treatment
|
||||||
inline keyType(const std::string& s, const bool isPattern);
|
inline keyType(const std::string& s, bool isPattern);
|
||||||
|
|
||||||
//- Move construct, retaining type (literal or regex)
|
//- Move construct, retaining type (literal or regex)
|
||||||
inline keyType(keyType&& s);
|
inline keyType(keyType&& s);
|
||||||
|
|
||||||
//- Move construct from word. Not treated as a regular expression
|
//- Move construct from word, treat as literal.
|
||||||
inline keyType(word&& s);
|
inline keyType(word&& s);
|
||||||
|
|
||||||
//- Move construct from string. Treat as regular expression.
|
//- Move construct from string, treat as regular expression.
|
||||||
inline keyType(string&& s);
|
inline keyType(string&& s);
|
||||||
|
|
||||||
//- Move construct from std::string with specified treatment
|
//- Move construct from std::string with specified treatment
|
||||||
inline keyType(std::string&& s, const bool isPattern);
|
inline keyType(std::string&& s, bool isPattern);
|
||||||
|
|
||||||
//- Construct from Istream
|
//- Construct from Istream
|
||||||
// Treat as regular expression if surrounded by quotation marks.
|
// Treat as regular expression if surrounded by quotation marks.
|
||||||
|
|||||||
@ -77,7 +77,7 @@ inline Foam::keyType::keyType(const char* s)
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
inline Foam::keyType::keyType(const std::string& s, const bool isPattern)
|
inline Foam::keyType::keyType(const std::string& s, bool isPattern)
|
||||||
:
|
:
|
||||||
word(s, false),
|
word(s, false),
|
||||||
isPattern_(isPattern)
|
isPattern_(isPattern)
|
||||||
@ -107,7 +107,7 @@ inline Foam::keyType::keyType(string&& s)
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
inline Foam::keyType::keyType(std::string&& s, const bool isPattern)
|
inline Foam::keyType::keyType(std::string&& s, bool isPattern)
|
||||||
:
|
:
|
||||||
word(std::move(s), false),
|
word(std::move(s), false),
|
||||||
isPattern_(isPattern)
|
isPattern_(isPattern)
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2017-2018 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -437,7 +437,7 @@ Foam::string Foam::stringOps::getVariable
|
|||||||
{
|
{
|
||||||
string value;
|
string value;
|
||||||
|
|
||||||
const entry* eptr = dict.lookupScopedEntryPtr(name, true, false);
|
const entry* eptr = dict.findScoped(name, keyType::LITERAL_RECURSIVE);
|
||||||
|
|
||||||
if (eptr)
|
if (eptr)
|
||||||
{
|
{
|
||||||
@ -720,20 +720,16 @@ void Foam::stringOps::inplaceExpand
|
|||||||
varBeg + 1 + delim,
|
varBeg + 1 + delim,
|
||||||
varEnd - varBeg - 2*delim
|
varEnd - varBeg - 2*delim
|
||||||
),
|
),
|
||||||
false
|
false // Already validated
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
// Lookup in the dictionary without wildcards.
|
// Lookup in the dictionary without wildcards.
|
||||||
// See note in primitiveEntry
|
// See note in primitiveEntry
|
||||||
const entry* eptr = dict.lookupScopedEntryPtr
|
const entry* eptr =
|
||||||
(
|
dict.findScoped(varName, keyType::LITERAL_RECURSIVE);
|
||||||
varName,
|
|
||||||
true,
|
|
||||||
false
|
|
||||||
);
|
|
||||||
|
|
||||||
// if defined - copy its entries
|
// Copy its entries if defined
|
||||||
if (eptr)
|
if (eptr)
|
||||||
{
|
{
|
||||||
OStringStream buf;
|
OStringStream buf;
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2017-2018 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -96,14 +96,14 @@ public:
|
|||||||
// Note that 'REGEX' is implicit if 'ICASE' is specified alone.
|
// Note that 'REGEX' is implicit if 'ICASE' is specified alone.
|
||||||
enum compOption
|
enum compOption
|
||||||
{
|
{
|
||||||
LITERAL = 0, //!< Treat as a string literal
|
LITERAL = 0, //!< String literal
|
||||||
DETECT = 1, //!< Detect if the string contains meta-characters
|
REGEX = 1, //!< Regular expression
|
||||||
UNKNOWN = 1, //!< Unknown content.
|
ICASE = 2, //!< Ignore case in regular expression
|
||||||
REGEX = 2, //!< Treat as regular expression
|
NOCASE = 2, //!< \deprecated Alias for ICASE (deprecated APR-2018)
|
||||||
ICASE = 4, //!< Ignore case in regular expression
|
DETECT = 4, //!< Detect if the string contains meta-characters
|
||||||
NOCASE = 4, //!< \deprecated Alias for ICASE (deprecated APR-2018)
|
UNKNOWN = 4, //!< Unknown content.
|
||||||
|
REGEX_ICASE = (REGEX|ICASE), //!< Combined REGEX and ICASE
|
||||||
DETECT_ICASE = (DETECT|ICASE), //!< Combined DETECT and ICASE
|
DETECT_ICASE = (DETECT|ICASE), //!< Combined DETECT and ICASE
|
||||||
REGEX_ICASE = (REGEX|ICASE) //!< Combined REGEX and ICASE
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -62,53 +62,59 @@ bool Foam::motionSmootherAlgo::checkMesh
|
|||||||
{
|
{
|
||||||
const scalar maxNonOrtho
|
const scalar maxNonOrtho
|
||||||
(
|
(
|
||||||
dict.get<scalar>("maxNonOrtho", true)
|
dict.get<scalar>("maxNonOrtho", keyType::REGEX_RECURSIVE)
|
||||||
);
|
);
|
||||||
const scalar minVol
|
const scalar minVol
|
||||||
(
|
(
|
||||||
dict.get<scalar>("minVol", true)
|
dict.get<scalar>("minVol", keyType::REGEX_RECURSIVE)
|
||||||
);
|
);
|
||||||
const scalar minTetQuality
|
const scalar minTetQuality
|
||||||
(
|
(
|
||||||
dict.get<scalar>("minTetQuality", true)
|
dict.get<scalar>("minTetQuality", keyType::REGEX_RECURSIVE)
|
||||||
);
|
);
|
||||||
const scalar maxConcave
|
const scalar maxConcave
|
||||||
(
|
(
|
||||||
dict.get<scalar>("maxConcave", true)
|
dict.get<scalar>("maxConcave", keyType::REGEX_RECURSIVE)
|
||||||
);
|
);
|
||||||
const scalar minArea
|
const scalar minArea
|
||||||
(
|
(
|
||||||
dict.get<scalar>("minArea", true)
|
dict.get<scalar>("minArea", keyType::REGEX_RECURSIVE)
|
||||||
);
|
);
|
||||||
const scalar maxIntSkew
|
const scalar maxIntSkew
|
||||||
(
|
(
|
||||||
dict.get<scalar>("maxInternalSkewness", true)
|
dict.get<scalar>("maxInternalSkewness", keyType::REGEX_RECURSIVE)
|
||||||
);
|
);
|
||||||
const scalar maxBounSkew
|
const scalar maxBounSkew
|
||||||
(
|
(
|
||||||
dict.get<scalar>("maxBoundarySkewness", true)
|
dict.get<scalar>("maxBoundarySkewness", keyType::REGEX_RECURSIVE)
|
||||||
);
|
);
|
||||||
const scalar minWeight
|
const scalar minWeight
|
||||||
(
|
(
|
||||||
dict.get<scalar>("minFaceWeight", true)
|
dict.get<scalar>("minFaceWeight", keyType::REGEX_RECURSIVE)
|
||||||
);
|
);
|
||||||
const scalar minVolRatio
|
const scalar minVolRatio
|
||||||
(
|
(
|
||||||
dict.get<scalar>("minVolRatio", true)
|
dict.get<scalar>("minVolRatio", keyType::REGEX_RECURSIVE)
|
||||||
);
|
);
|
||||||
const scalar minTwist
|
const scalar minTwist
|
||||||
(
|
(
|
||||||
dict.get<scalar>("minTwist", true)
|
dict.get<scalar>("minTwist", keyType::REGEX_RECURSIVE)
|
||||||
);
|
);
|
||||||
const scalar minTriangleTwist
|
const scalar minTriangleTwist
|
||||||
(
|
(
|
||||||
dict.get<scalar>("minTriangleTwist", true)
|
dict.get<scalar>("minTriangleTwist", keyType::REGEX_RECURSIVE)
|
||||||
|
);
|
||||||
|
|
||||||
|
const scalar minFaceFlatness
|
||||||
|
(
|
||||||
|
dict.lookupOrDefault<scalar>
|
||||||
|
(
|
||||||
|
"minFaceFlatness", -1, keyType::REGEX_RECURSIVE
|
||||||
|
)
|
||||||
);
|
);
|
||||||
scalar minFaceFlatness = -1.0;
|
|
||||||
dict.readIfPresent("minFaceFlatness", minFaceFlatness, true);
|
|
||||||
const scalar minDet
|
const scalar minDet
|
||||||
(
|
(
|
||||||
dict.get<scalar>("minDeterminant", true)
|
dict.get<scalar>("minDeterminant", keyType::REGEX_RECURSIVE)
|
||||||
);
|
);
|
||||||
label nWrongFaces = 0;
|
label nWrongFaces = 0;
|
||||||
|
|
||||||
@ -467,53 +473,58 @@ bool Foam::motionSmootherAlgo::checkMesh
|
|||||||
{
|
{
|
||||||
const scalar maxNonOrtho
|
const scalar maxNonOrtho
|
||||||
(
|
(
|
||||||
dict.get<scalar>("maxNonOrtho", true)
|
dict.get<scalar>("maxNonOrtho", keyType::REGEX_RECURSIVE)
|
||||||
);
|
);
|
||||||
const scalar minVol
|
const scalar minVol
|
||||||
(
|
(
|
||||||
dict.get<scalar>("minVol", true)
|
dict.get<scalar>("minVol", keyType::REGEX_RECURSIVE)
|
||||||
);
|
);
|
||||||
const scalar minTetQuality
|
const scalar minTetQuality
|
||||||
(
|
(
|
||||||
dict.get<scalar>("minTetQuality", true)
|
dict.get<scalar>("minTetQuality", keyType::REGEX_RECURSIVE)
|
||||||
);
|
);
|
||||||
const scalar maxConcave
|
const scalar maxConcave
|
||||||
(
|
(
|
||||||
dict.get<scalar>("maxConcave", true)
|
dict.get<scalar>("maxConcave", keyType::REGEX_RECURSIVE)
|
||||||
);
|
);
|
||||||
const scalar minArea
|
const scalar minArea
|
||||||
(
|
(
|
||||||
dict.get<scalar>("minArea", true)
|
dict.get<scalar>("minArea", keyType::REGEX_RECURSIVE)
|
||||||
);
|
);
|
||||||
const scalar maxIntSkew
|
const scalar maxIntSkew
|
||||||
(
|
(
|
||||||
dict.get<scalar>("maxInternalSkewness", true)
|
dict.get<scalar>("maxInternalSkewness", keyType::REGEX_RECURSIVE)
|
||||||
);
|
);
|
||||||
const scalar maxBounSkew
|
const scalar maxBounSkew
|
||||||
(
|
(
|
||||||
dict.get<scalar>("maxBoundarySkewness", true)
|
dict.get<scalar>("maxBoundarySkewness", keyType::REGEX_RECURSIVE)
|
||||||
);
|
);
|
||||||
const scalar minWeight
|
const scalar minWeight
|
||||||
(
|
(
|
||||||
dict.get<scalar>("minFaceWeight", true)
|
dict.get<scalar>("minFaceWeight", keyType::REGEX_RECURSIVE)
|
||||||
);
|
);
|
||||||
const scalar minVolRatio
|
const scalar minVolRatio
|
||||||
(
|
(
|
||||||
dict.get<scalar>("minVolRatio", true)
|
dict.get<scalar>("minVolRatio", keyType::REGEX_RECURSIVE)
|
||||||
);
|
);
|
||||||
const scalar minTwist
|
const scalar minTwist
|
||||||
(
|
(
|
||||||
dict.get<scalar>("minTwist", true)
|
dict.get<scalar>("minTwist", keyType::REGEX_RECURSIVE)
|
||||||
);
|
);
|
||||||
const scalar minTriangleTwist
|
const scalar minTriangleTwist
|
||||||
(
|
(
|
||||||
dict.get<scalar>("minTriangleTwist", true)
|
dict.get<scalar>("minTriangleTwist", keyType::REGEX_RECURSIVE)
|
||||||
|
);
|
||||||
|
const scalar minFaceFlatness
|
||||||
|
(
|
||||||
|
dict.lookupOrDefault<scalar>
|
||||||
|
(
|
||||||
|
"minFaceFlatness", -1, keyType::REGEX_RECURSIVE
|
||||||
|
)
|
||||||
);
|
);
|
||||||
scalar minFaceFlatness = -1.0;
|
|
||||||
dict.readIfPresent("minFaceFlatness", minFaceFlatness, true);
|
|
||||||
const scalar minDet
|
const scalar minDet
|
||||||
(
|
(
|
||||||
dict.get<scalar>("minDeterminant", true)
|
dict.get<scalar>("minDeterminant", keyType::REGEX_RECURSIVE)
|
||||||
);
|
);
|
||||||
label nWrongFaces = 0;
|
label nWrongFaces = 0;
|
||||||
|
|
||||||
|
|||||||
@ -170,7 +170,7 @@ Foam::loopControl::loopControl
|
|||||||
loopControl(runTime, 0, dictName)
|
loopControl(runTime, 0, dictName)
|
||||||
{
|
{
|
||||||
// The loop sub-dictionary
|
// The loop sub-dictionary
|
||||||
const dictionary* dictptr = algorithmDict.subDictPtr(dictName);
|
const dictionary* dictptr = algorithmDict.findDict(dictName);
|
||||||
|
|
||||||
if (dictptr)
|
if (dictptr)
|
||||||
{
|
{
|
||||||
@ -192,13 +192,12 @@ Foam::loopControl::loopControl
|
|||||||
fvSolution fvsol(time_);
|
fvSolution fvsol(time_);
|
||||||
|
|
||||||
// Eg, PIMPLE or SIMPLE from <system/fvSolution>
|
// Eg, PIMPLE or SIMPLE from <system/fvSolution>
|
||||||
const dictionary* dictptr =
|
const dictionary* dictptr = fvsol.solutionDict().findDict(algorithmName);
|
||||||
fvsol.solutionDict().subDictPtr(algorithmName);
|
|
||||||
|
|
||||||
if (dictptr)
|
if (dictptr)
|
||||||
{
|
{
|
||||||
// The loop sub-dictionary
|
// The loop sub-dictionary
|
||||||
dictptr = dictptr->subDictPtr(dictName);
|
dictptr = dictptr->findDict(dictName);
|
||||||
|
|
||||||
if (dictptr)
|
if (dictptr)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -193,12 +193,7 @@ bool Foam::functionObjects::codedFunctionObject::read(const dictionary& dict)
|
|||||||
|
|
||||||
dict.readCompat<word>("name", {{"redirectType", 1706}}, name_);
|
dict.readCompat<word>("name", {{"redirectType", 1706}}, name_);
|
||||||
|
|
||||||
const entry* dataPtr = dict.lookupEntryPtr
|
const entry* dataPtr = dict.findEntry("codeData", keyType::LITERAL);
|
||||||
(
|
|
||||||
"codeData",
|
|
||||||
false,
|
|
||||||
false
|
|
||||||
);
|
|
||||||
if (dataPtr)
|
if (dataPtr)
|
||||||
{
|
{
|
||||||
codeData_ = stringOps::trim(dataPtr->stream());
|
codeData_ = stringOps::trim(dataPtr->stream());
|
||||||
@ -211,12 +206,7 @@ bool Foam::functionObjects::codedFunctionObject::read(const dictionary& dict)
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const entry* readPtr = dict.lookupEntryPtr
|
const entry* readPtr = dict.findEntry("codeRead", keyType::LITERAL);
|
||||||
(
|
|
||||||
"codeRead",
|
|
||||||
false,
|
|
||||||
false
|
|
||||||
);
|
|
||||||
if (readPtr)
|
if (readPtr)
|
||||||
{
|
{
|
||||||
codeRead_ = stringOps::trim(readPtr->stream());
|
codeRead_ = stringOps::trim(readPtr->stream());
|
||||||
@ -229,12 +219,7 @@ bool Foam::functionObjects::codedFunctionObject::read(const dictionary& dict)
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const entry* execPtr = dict.lookupEntryPtr
|
const entry* execPtr = dict.findEntry("codeExecute", keyType::LITERAL);
|
||||||
(
|
|
||||||
"codeExecute",
|
|
||||||
false,
|
|
||||||
false
|
|
||||||
);
|
|
||||||
if (execPtr)
|
if (execPtr)
|
||||||
{
|
{
|
||||||
codeExecute_ = stringOps::trim(execPtr->stream());
|
codeExecute_ = stringOps::trim(execPtr->stream());
|
||||||
@ -247,12 +232,7 @@ bool Foam::functionObjects::codedFunctionObject::read(const dictionary& dict)
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const entry* writePtr = dict.lookupEntryPtr
|
const entry* writePtr = dict.findEntry("codeWrite", keyType::LITERAL);
|
||||||
(
|
|
||||||
"codeWrite",
|
|
||||||
false,
|
|
||||||
false
|
|
||||||
);
|
|
||||||
if (writePtr)
|
if (writePtr)
|
||||||
{
|
{
|
||||||
codeWrite_ = stringOps::trim(writePtr->stream());
|
codeWrite_ = stringOps::trim(writePtr->stream());
|
||||||
@ -265,12 +245,7 @@ bool Foam::functionObjects::codedFunctionObject::read(const dictionary& dict)
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const entry* endPtr = dict.lookupEntryPtr
|
const entry* endPtr = dict.findEntry("codeEnd", keyType::LITERAL);
|
||||||
(
|
|
||||||
"codeEnd",
|
|
||||||
false,
|
|
||||||
false
|
|
||||||
);
|
|
||||||
if (endPtr)
|
if (endPtr)
|
||||||
{
|
{
|
||||||
codeEnd_ = stringOps::trim(endPtr->stream());
|
codeEnd_ = stringOps::trim(endPtr->stream());
|
||||||
|
|||||||
@ -40,12 +40,9 @@ bool Foam::fv::CodedSource<Type>::read(const dictionary& dict)
|
|||||||
|
|
||||||
// Code snippets
|
// Code snippets
|
||||||
{
|
{
|
||||||
const entry& e = coeffs_.lookupEntry
|
const entry& e =
|
||||||
(
|
coeffs_.lookupEntry("codeCorrect", keyType::LITERAL);
|
||||||
"codeCorrect",
|
|
||||||
false,
|
|
||||||
false
|
|
||||||
);
|
|
||||||
codeCorrect_ = stringOps::trim(e.stream());
|
codeCorrect_ = stringOps::trim(e.stream());
|
||||||
stringOps::inplaceExpand(codeCorrect_, coeffs_);
|
stringOps::inplaceExpand(codeCorrect_, coeffs_);
|
||||||
dynamicCodeContext::addLineDirective
|
dynamicCodeContext::addLineDirective
|
||||||
@ -57,12 +54,9 @@ bool Foam::fv::CodedSource<Type>::read(const dictionary& dict)
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
const entry& e = coeffs_.lookupEntry
|
const entry& e =
|
||||||
(
|
coeffs_.lookupEntry("codeAddSup", keyType::LITERAL);
|
||||||
"codeAddSup",
|
|
||||||
false,
|
|
||||||
false
|
|
||||||
);
|
|
||||||
codeAddSup_ = stringOps::trim(e.stream());
|
codeAddSup_ = stringOps::trim(e.stream());
|
||||||
stringOps::inplaceExpand(codeAddSup_, coeffs_);
|
stringOps::inplaceExpand(codeAddSup_, coeffs_);
|
||||||
dynamicCodeContext::addLineDirective
|
dynamicCodeContext::addLineDirective
|
||||||
@ -74,12 +68,9 @@ bool Foam::fv::CodedSource<Type>::read(const dictionary& dict)
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
const entry& e = coeffs_.lookupEntry
|
const entry& e =
|
||||||
(
|
coeffs_.lookupEntry("codeSetValue", keyType::LITERAL);
|
||||||
"codeSetValue",
|
|
||||||
false,
|
|
||||||
false
|
|
||||||
);
|
|
||||||
codeSetValue_ = stringOps::trim(e.stream());
|
codeSetValue_ = stringOps::trim(e.stream());
|
||||||
stringOps::inplaceExpand(codeSetValue_, coeffs_);
|
stringOps::inplaceExpand(codeSetValue_, coeffs_);
|
||||||
dynamicCodeContext::addLineDirective
|
dynamicCodeContext::addLineDirective
|
||||||
|
|||||||
@ -300,7 +300,7 @@ void Foam::lumpedPointMovement::readDict(const dictionary& dict)
|
|||||||
|
|
||||||
const dictionary* scaleDict = nullptr;
|
const dictionary* scaleDict = nullptr;
|
||||||
|
|
||||||
if ((scaleDict = commDict.subDictPtr("scaleInput")))
|
if ((scaleDict = commDict.findDict("scaleInput")))
|
||||||
{
|
{
|
||||||
for (int i=0; i < scaleInput_.size(); ++i)
|
for (int i=0; i < scaleInput_.size(); ++i)
|
||||||
{
|
{
|
||||||
@ -318,7 +318,7 @@ void Foam::lumpedPointMovement::readDict(const dictionary& dict)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((scaleDict = commDict.subDictPtr("scaleOutput")))
|
if ((scaleDict = commDict.findDict("scaleOutput")))
|
||||||
{
|
{
|
||||||
for (int i=0; i < scaleOutput_.size(); ++i)
|
for (int i=0; i < scaleOutput_.size(); ++i)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -369,7 +369,7 @@ void Foam::blockDescriptor::write
|
|||||||
const dictionary& d
|
const dictionary& d
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const dictionary* varDictPtr = d.subDictPtr("namedBlocks");
|
const dictionary* varDictPtr = d.findDict("namedBlocks");
|
||||||
if (varDictPtr)
|
if (varDictPtr)
|
||||||
{
|
{
|
||||||
blockMeshTools::write(os, val, *varDictPtr);
|
blockMeshTools::write(os, val, *varDictPtr);
|
||||||
|
|||||||
@ -350,7 +350,7 @@ Foam::autoPtr<Foam::polyMesh> Foam::blockMesh::createTopology
|
|||||||
// Read the names/types for the unassigned patch faces
|
// Read the names/types for the unassigned patch faces
|
||||||
// this is a bit heavy handed (and ugly), but there is currently
|
// this is a bit heavy handed (and ugly), but there is currently
|
||||||
// no easy way to rename polyMesh patches subsequently
|
// no easy way to rename polyMesh patches subsequently
|
||||||
if (const dictionary* dictPtr = meshDescription.subDictPtr("defaultPatch"))
|
if (const dictionary* dictPtr = meshDescription.findDict("defaultPatch"))
|
||||||
{
|
{
|
||||||
dictPtr->readIfPresent("name", defaultPatchName);
|
dictPtr->readIfPresent("name", defaultPatchName);
|
||||||
dictPtr->readIfPresent("type", defaultPatchType);
|
dictPtr->readIfPresent("type", defaultPatchType);
|
||||||
|
|||||||
@ -42,16 +42,13 @@ void Foam::blockMeshTools::read
|
|||||||
else if (t.isWord())
|
else if (t.isWord())
|
||||||
{
|
{
|
||||||
const word& varName = t.wordToken();
|
const word& varName = t.wordToken();
|
||||||
const entry* ePtr = dict.lookupScopedEntryPtr
|
const entry* eptr =
|
||||||
(
|
dict.findScoped(varName, keyType::REGEX_RECURSIVE);
|
||||||
varName,
|
|
||||||
true,
|
if (eptr)
|
||||||
true
|
|
||||||
);
|
|
||||||
if (ePtr)
|
|
||||||
{
|
{
|
||||||
// Read as label
|
// Read as label
|
||||||
val = Foam::readLabel(ePtr->stream());
|
val = Foam::readLabel(eptr->stream());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -104,7 +104,7 @@ Foam::autoPtr<Foam::blockVertex> Foam::blockVertex::New
|
|||||||
|
|
||||||
Foam::label Foam::blockVertex::read(Istream& is, const dictionary& dict)
|
Foam::label Foam::blockVertex::read(Istream& is, const dictionary& dict)
|
||||||
{
|
{
|
||||||
const dictionary* varDictPtr = dict.subDictPtr("namedVertices");
|
const dictionary* varDictPtr = dict.findDict("namedVertices");
|
||||||
if (varDictPtr)
|
if (varDictPtr)
|
||||||
{
|
{
|
||||||
return blockMeshTools::read(is, *varDictPtr);
|
return blockMeshTools::read(is, *varDictPtr);
|
||||||
@ -120,7 +120,7 @@ void Foam::blockVertex::write
|
|||||||
const dictionary& d
|
const dictionary& d
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const dictionary* varDictPtr = d.subDictPtr("namedVertices");
|
const dictionary* varDictPtr = d.findDict("namedVertices");
|
||||||
if (varDictPtr)
|
if (varDictPtr)
|
||||||
{
|
{
|
||||||
blockMeshTools::write(os, val, *varDictPtr);
|
blockMeshTools::write(os, val, *varDictPtr);
|
||||||
|
|||||||
@ -53,10 +53,10 @@ Foam::blockVertices::namedVertex::namedVertex
|
|||||||
{
|
{
|
||||||
dictionary& d = const_cast<dictionary&>(dict);
|
dictionary& d = const_cast<dictionary&>(dict);
|
||||||
|
|
||||||
dictionary* varDictPtr = d.subDictPtr("namedVertices");
|
dictionary* varDictPtr = d.findDict("namedVertices");
|
||||||
if (varDictPtr)
|
if (varDictPtr)
|
||||||
{
|
{
|
||||||
const_cast<dictionary&>(*varDictPtr).add(name_, index);
|
varDictPtr->add(name_, index);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -54,10 +54,10 @@ Foam::blocks::namedBlock::namedBlock
|
|||||||
block(dict, index, vertices, edges, faces, is)
|
block(dict, index, vertices, edges, faces, is)
|
||||||
{
|
{
|
||||||
dictionary& d = const_cast<dictionary&>(dict);
|
dictionary& d = const_cast<dictionary&>(dict);
|
||||||
dictionary* varDictPtr = d.subDictPtr("namedBlocks");
|
dictionary* varDictPtr = d.findDict("namedBlocks");
|
||||||
if (varDictPtr)
|
if (varDictPtr)
|
||||||
{
|
{
|
||||||
const_cast<dictionary&>(*varDictPtr).add(*this, index);
|
varDictPtr->add(*this, index);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1205,7 +1205,8 @@ Foam::labelList Foam::meshRefinement::markFacesOnProblemCellsGeometric
|
|||||||
const labelList allFaces(identity(mesh_.nFaces()));
|
const labelList allFaces(identity(mesh_.nFaces()));
|
||||||
label nWrongFaces = 0;
|
label nWrongFaces = 0;
|
||||||
|
|
||||||
//const scalar minV(motionDict.get<scalar>("minVol", true));
|
//const scalar minV
|
||||||
|
//(motionDict.get<scalar>("minVol", keyType::REGEX_RECURSIVE));
|
||||||
//if (minV > -GREAT)
|
//if (minV > -GREAT)
|
||||||
//{
|
//{
|
||||||
// polyMeshGeometry::checkFacePyramids
|
// polyMeshGeometry::checkFacePyramids
|
||||||
|
|||||||
@ -184,7 +184,8 @@ Foam::refinementSurfaces::refinementSurfaces
|
|||||||
{
|
{
|
||||||
const word& geomName = allGeometry_.names()[geomI];
|
const word& geomName = allGeometry_.names()[geomI];
|
||||||
|
|
||||||
const entry* ePtr = surfacesDict.lookupEntryPtr(geomName, false, true);
|
const entry* ePtr =
|
||||||
|
surfacesDict.findEntry(geomName, keyType::LITERAL);
|
||||||
|
|
||||||
if (ePtr)
|
if (ePtr)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -578,13 +578,11 @@ Foam::shellSurfaces::shellSurfaces
|
|||||||
|
|
||||||
// Count number of shells.
|
// Count number of shells.
|
||||||
label shellI = 0;
|
label shellI = 0;
|
||||||
forAll(allGeometry.names(), geomI)
|
for (const word& geomName : allGeometry_.names())
|
||||||
{
|
{
|
||||||
const word& geomName = allGeometry_.names()[geomI];
|
|
||||||
|
|
||||||
if (shellsDict.found(geomName))
|
if (shellsDict.found(geomName))
|
||||||
{
|
{
|
||||||
shellI++;
|
++shellI;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -615,12 +613,12 @@ Foam::shellSurfaces::shellSurfaces
|
|||||||
{
|
{
|
||||||
const word& geomName = allGeometry_.names()[geomI];
|
const word& geomName = allGeometry_.names()[geomI];
|
||||||
|
|
||||||
const entry* ePtr = shellsDict.lookupEntryPtr(geomName, false, true);
|
const entry* eptr = shellsDict.findEntry(geomName, keyType::LITERAL);
|
||||||
|
|
||||||
if (ePtr)
|
if (eptr)
|
||||||
{
|
{
|
||||||
const dictionary& dict = ePtr->dict();
|
const dictionary& dict = eptr->dict();
|
||||||
unmatchedKeys.erase(ePtr->keyword());
|
unmatchedKeys.erase(eptr->keyword());
|
||||||
|
|
||||||
shells_[shellI] = geomI;
|
shells_[shellI] = geomI;
|
||||||
modes_[shellI] = refineModeNames_.lookup("mode", dict);
|
modes_[shellI] = refineModeNames_.lookup("mode", dict);
|
||||||
@ -637,12 +635,9 @@ Foam::shellSurfaces::shellSurfaces
|
|||||||
labelPair(labelMax, labelMin),
|
labelPair(labelMax, labelMin),
|
||||||
labelVector::zero
|
labelVector::zero
|
||||||
);
|
);
|
||||||
const entry* levelPtr = dict.lookupEntryPtr
|
const entry* levelPtr =
|
||||||
(
|
dict.findEntry("levelIncrement", keyType::REGEX);
|
||||||
"levelIncrement",
|
|
||||||
false,
|
|
||||||
true
|
|
||||||
);
|
|
||||||
if (levelPtr)
|
if (levelPtr)
|
||||||
{
|
{
|
||||||
// Do reading ourselves since using labelPair would require
|
// Do reading ourselves since using labelPair would require
|
||||||
|
|||||||
@ -78,7 +78,7 @@ void Foam::coordinateSystem::assign(const dictionary& dict)
|
|||||||
const auto finder = dict.csearchCompat
|
const auto finder = dict.csearchCompat
|
||||||
(
|
(
|
||||||
"rotation", {{"coordinateRotation", -1806}},
|
"rotation", {{"coordinateRotation", -1806}},
|
||||||
false, false
|
keyType::LITERAL
|
||||||
);
|
);
|
||||||
|
|
||||||
if (finder.isDict())
|
if (finder.isDict())
|
||||||
|
|||||||
@ -42,7 +42,7 @@ const Foam::dictionary* Foam::coordinateSystem::subDictCompat
|
|||||||
{
|
{
|
||||||
// Non-recursive, no pattern matching in the search
|
// Non-recursive, no pattern matching in the search
|
||||||
const auto finder =
|
const auto finder =
|
||||||
dictPtr->csearch(coordinateSystem::typeName_(), false, false);
|
dictPtr->csearch(coordinateSystem::typeName_(), keyType::LITERAL);
|
||||||
|
|
||||||
if (finder.isDict())
|
if (finder.isDict())
|
||||||
{
|
{
|
||||||
|
|||||||
@ -100,7 +100,7 @@ Foam::fileName Foam::triSurfaceMesh::checkFile
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
fileName fName;
|
fileName fName;
|
||||||
if (dict.readIfPresent("file", fName, false, false))
|
if (dict.readIfPresent("file", fName, keyType::LITERAL))
|
||||||
{
|
{
|
||||||
fName = relativeFilePath(io, fName, isGlobal);
|
fName = relativeFilePath(io, fName, isGlobal);
|
||||||
|
|
||||||
@ -318,7 +318,7 @@ Foam::triSurfaceMesh::triSurfaceMesh
|
|||||||
outsideVolType_(volumeType::UNKNOWN)
|
outsideVolType_(volumeType::UNKNOWN)
|
||||||
{
|
{
|
||||||
// Reading from supplied file name instead of objectPath/filePath
|
// Reading from supplied file name instead of objectPath/filePath
|
||||||
if (dict.readIfPresent("file", fName_, false, false))
|
if (dict.readIfPresent("file", fName_, keyType::LITERAL))
|
||||||
{
|
{
|
||||||
fName_ = relativeFilePath
|
fName_ = relativeFilePath
|
||||||
(
|
(
|
||||||
@ -418,7 +418,7 @@ Foam::triSurfaceMesh::triSurfaceMesh
|
|||||||
outsideVolType_(volumeType::UNKNOWN)
|
outsideVolType_(volumeType::UNKNOWN)
|
||||||
{
|
{
|
||||||
// Reading from supplied file name instead of objectPath/filePath
|
// Reading from supplied file name instead of objectPath/filePath
|
||||||
if (dict.readIfPresent("file", fName_, false, false))
|
if (dict.readIfPresent("file", fName_, keyType::LITERAL))
|
||||||
{
|
{
|
||||||
fName_ = relativeFilePath
|
fName_ = relativeFilePath
|
||||||
(
|
(
|
||||||
|
|||||||
@ -306,11 +306,11 @@ bool Foam::dynamicOversetFvMesh::interpolateFields()
|
|||||||
// Use whatever the solver has set up as suppression list
|
// Use whatever the solver has set up as suppression list
|
||||||
const dictionary* dictPtr
|
const dictionary* dictPtr
|
||||||
(
|
(
|
||||||
this->schemesDict().subDictPtr("oversetInterpolationSuppressed")
|
this->schemesDict().findDict("oversetInterpolationSuppressed")
|
||||||
);
|
);
|
||||||
if (dictPtr)
|
if (dictPtr)
|
||||||
{
|
{
|
||||||
suppressed.insert(dictPtr->sortedToc());
|
suppressed.insert(dictPtr->toc());
|
||||||
}
|
}
|
||||||
|
|
||||||
interpolate<volScalarField>(suppressed);
|
interpolate<volScalarField>(suppressed);
|
||||||
|
|||||||
@ -136,12 +136,12 @@ void Foam::oversetFvPatchField<Type>::initEvaluate
|
|||||||
|
|
||||||
const dictionary* dictPtr
|
const dictionary* dictPtr
|
||||||
(
|
(
|
||||||
fvSchemes.subDictPtr("oversetInterpolationSuppressed")
|
fvSchemes.findDict("oversetInterpolationSuppressed")
|
||||||
);
|
);
|
||||||
|
|
||||||
if (dictPtr)
|
if (dictPtr)
|
||||||
{
|
{
|
||||||
suppressed.insert(dictPtr->sortedToc());
|
suppressed.insert(dictPtr->toc());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!suppressed.found(fldName))
|
if (!suppressed.found(fldName))
|
||||||
|
|||||||
@ -121,7 +121,7 @@ void Foam::decompositionMethod::readConstraints()
|
|||||||
// Read any constraints
|
// Read any constraints
|
||||||
wordList constraintTypes;
|
wordList constraintTypes;
|
||||||
|
|
||||||
const dictionary* dictptr = decompositionDict_.subDictPtr("constraints");
|
const dictionary* dictptr = decompositionDict_.findDict("constraints");
|
||||||
|
|
||||||
if (dictptr)
|
if (dictptr)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -68,9 +68,9 @@ void Foam::multiLevelDecomp::createMethodsDict()
|
|||||||
if
|
if
|
||||||
(
|
(
|
||||||
// non-recursive, no patterns
|
// non-recursive, no patterns
|
||||||
coeffsDict_.readIfPresent("method", defaultMethod, false, false)
|
coeffsDict_.readIfPresent("method", defaultMethod, keyType::LITERAL)
|
||||||
// non-recursive, no patterns
|
// non-recursive, no patterns
|
||||||
&& coeffsDict_.readIfPresent("domains", domains, false, false)
|
&& coeffsDict_.readIfPresent("domains", domains, keyType::LITERAL)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// Short-cut version specified by method, domains only
|
// Short-cut version specified by method, domains only
|
||||||
@ -169,14 +169,14 @@ void Foam::multiLevelDecomp::createMethodsDict()
|
|||||||
(
|
(
|
||||||
iter().isDict()
|
iter().isDict()
|
||||||
// non-recursive, no patterns
|
// non-recursive, no patterns
|
||||||
&& iter().dict().found("numberOfSubdomains", false, false)
|
&& iter().dict().found("numberOfSubdomains", keyType::LITERAL)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// No method specified? can use a default method?
|
// No method specified? can use a default method?
|
||||||
|
|
||||||
const bool addDefaultMethod
|
const bool addDefaultMethod
|
||||||
(
|
(
|
||||||
!(iter().dict().found("method", false, false))
|
!(iter().dict().found("method", keyType::LITERAL))
|
||||||
&& !defaultMethod.empty()
|
&& !defaultMethod.empty()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -72,7 +72,7 @@ Foam::label Foam::metisDecomp::decomposeSerial
|
|||||||
word method("recursive");
|
word method("recursive");
|
||||||
|
|
||||||
const dictionary* coeffsDictPtr =
|
const dictionary* coeffsDictPtr =
|
||||||
decompositionDict_.subDictPtr("metisCoeffs");
|
decompositionDict_.findDict("metisCoeffs");
|
||||||
|
|
||||||
label numCells = xadj.size()-1;
|
label numCells = xadj.size()-1;
|
||||||
|
|
||||||
|
|||||||
@ -149,9 +149,9 @@ bool Foam::regionModels::regionModel::read()
|
|||||||
{
|
{
|
||||||
if (active_)
|
if (active_)
|
||||||
{
|
{
|
||||||
if (const dictionary* dictPtr = subDictPtr(modelName_ + "Coeffs"))
|
if (const dictionary* dictptr = findDict(modelName_ + "Coeffs"))
|
||||||
{
|
{
|
||||||
coeffs_ <<= *dictPtr;
|
coeffs_ <<= *dictptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
infoOutput_.readIfPresent("infoOutput", *this);
|
infoOutput_.readIfPresent("infoOutput", *this);
|
||||||
@ -159,30 +159,26 @@ bool Foam::regionModels::regionModel::read()
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool Foam::regionModels::regionModel::read(const dictionary& dict)
|
bool Foam::regionModels::regionModel::read(const dictionary& dict)
|
||||||
{
|
{
|
||||||
if (active_)
|
if (active_)
|
||||||
{
|
{
|
||||||
if (const dictionary* dictPtr = dict.subDictPtr(modelName_ + "Coeffs"))
|
if (const dictionary* dictptr = dict.findDict(modelName_ + "Coeffs"))
|
||||||
{
|
{
|
||||||
coeffs_ <<= *dictPtr;
|
coeffs_ <<= *dictptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
infoOutput_.readIfPresent("infoOutput", dict);
|
infoOutput_.readIfPresent("infoOutput", dict);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const Foam::AMIPatchToPatchInterpolation&
|
const Foam::AMIPatchToPatchInterpolation&
|
||||||
|
|||||||
Reference in New Issue
Block a user