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;
|
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
|
Info<< " Changing entry " << patchName << " to " << newName
|
||||||
<< endl;
|
<< endl;
|
||||||
|
|
||||||
dictionary patchDict(boundaryField.subDict(patchName));
|
dictionary& patchDict = boundaryField.subDict(patchName);
|
||||||
|
|
||||||
if (patchDict.found("value"))
|
if (patchDict.found("value"))
|
||||||
{
|
{
|
||||||
IOWarningIn("rewriteField(..)", patchDict)
|
// Remove any value field since wrong size.
|
||||||
<< "Cyclic patch " << patchName
|
|
||||||
<< " has value entry. This will be removed."
|
|
||||||
<< endl;
|
|
||||||
patchDict.remove("value");
|
patchDict.remove("value");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,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) 2004-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
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))
|
if (hashedEntries_.found(keyword))
|
||||||
{
|
{
|
||||||
@ -268,7 +273,7 @@ bool Foam::dictionary::found(const word& keyword, bool recursive) const
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (patternEntries_.size())
|
if (patternMatch && patternEntries_.size())
|
||||||
{
|
{
|
||||||
DLList<entry*>::const_iterator wcLink =
|
DLList<entry*>::const_iterator wcLink =
|
||||||
patternEntries_.begin();
|
patternEntries_.begin();
|
||||||
@ -276,7 +281,7 @@ bool Foam::dictionary::found(const word& keyword, bool recursive) const
|
|||||||
patternRegexps_.begin();
|
patternRegexps_.begin();
|
||||||
|
|
||||||
// Find in patterns using regular expressions only
|
// Find in patterns using regular expressions only
|
||||||
if (findInPatterns(true, keyword, wcLink, reLink))
|
if (findInPatterns(patternMatch, keyword, wcLink, reLink))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -284,7 +289,7 @@ bool Foam::dictionary::found(const word& keyword, bool recursive) const
|
|||||||
|
|
||||||
if (recursive && &parent_ != &dictionary::null)
|
if (recursive && &parent_ != &dictionary::null)
|
||||||
{
|
{
|
||||||
return parent_.found(keyword, recursive);
|
return parent_.found(keyword, recursive, patternMatch);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -2,7 +2,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) 2004-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -264,7 +264,13 @@ public:
|
|||||||
|
|
||||||
//- Search dictionary for given keyword
|
//- Search dictionary for given keyword
|
||||||
// If recursive, search parent dictionaries
|
// 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
|
//- Find and return an entry data stream pointer if present
|
||||||
// otherwise return NULL.
|
// otherwise return NULL.
|
||||||
|
|||||||
Reference in New Issue
Block a user