mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: dictionary::found : optionally disable wildcards
This commit is contained in:
@ -300,19 +300,23 @@ void rewriteField
|
||||
|
||||
Info<< "Looking for entry for patch " << patchName << endl;
|
||||
|
||||
if (boundaryField.found(patchName) && !boundaryField.found(newName))
|
||||
// Find old patch name either direct or through wildcards
|
||||
// Find new patch name direct only
|
||||
|
||||
if
|
||||
(
|
||||
boundaryField.found(patchName)
|
||||
&& !boundaryField.found(newName, false, false)
|
||||
)
|
||||
{
|
||||
Info<< " Changing entry " << patchName << " to " << newName
|
||||
<< endl;
|
||||
|
||||
dictionary patchDict(boundaryField.subDict(patchName));
|
||||
dictionary& patchDict = boundaryField.subDict(patchName);
|
||||
|
||||
if (patchDict.found("value"))
|
||||
{
|
||||
IOWarningIn("rewriteField(..)", patchDict)
|
||||
<< "Cyclic patch " << patchName
|
||||
<< " has value entry. This will be removed."
|
||||
<< endl;
|
||||
// Remove any value field since wrong size.
|
||||
patchDict.remove("value");
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -260,7 +260,12 @@ Foam::SHA1Digest Foam::dictionary::digest() const
|
||||
}
|
||||
|
||||
|
||||
bool Foam::dictionary::found(const word& keyword, bool recursive) const
|
||||
bool Foam::dictionary::found
|
||||
(
|
||||
const word& keyword,
|
||||
bool recursive,
|
||||
bool patternMatch
|
||||
) const
|
||||
{
|
||||
if (hashedEntries_.found(keyword))
|
||||
{
|
||||
@ -268,7 +273,7 @@ bool Foam::dictionary::found(const word& keyword, bool recursive) const
|
||||
}
|
||||
else
|
||||
{
|
||||
if (patternEntries_.size())
|
||||
if (patternMatch && patternEntries_.size())
|
||||
{
|
||||
DLList<entry*>::const_iterator wcLink =
|
||||
patternEntries_.begin();
|
||||
@ -276,7 +281,7 @@ bool Foam::dictionary::found(const word& keyword, bool recursive) const
|
||||
patternRegexps_.begin();
|
||||
|
||||
// Find in patterns using regular expressions only
|
||||
if (findInPatterns(true, keyword, wcLink, reLink))
|
||||
if (findInPatterns(patternMatch, keyword, wcLink, reLink))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -284,7 +289,7 @@ bool Foam::dictionary::found(const word& keyword, bool recursive) const
|
||||
|
||||
if (recursive && &parent_ != &dictionary::null)
|
||||
{
|
||||
return parent_.found(keyword, recursive);
|
||||
return parent_.found(keyword, recursive, patternMatch);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -264,7 +264,13 @@ public:
|
||||
|
||||
//- Search dictionary for given keyword
|
||||
// If recursive, search parent dictionaries
|
||||
bool found(const word&, bool recursive=false) const;
|
||||
// If patternMatch, use regular expressions
|
||||
bool found
|
||||
(
|
||||
const word&,
|
||||
bool recursive=false,
|
||||
bool patternMatch = true
|
||||
) const;
|
||||
|
||||
//- Find and return an entry data stream pointer if present
|
||||
// otherwise return NULL.
|
||||
|
||||
Reference in New Issue
Block a user