diff --git a/applications/utilities/preProcessing/foamUpgradeCyclics/foamUpgradeCyclics.C b/applications/utilities/preProcessing/foamUpgradeCyclics/foamUpgradeCyclics.C index 84f3c5652b..b3f5e7baab 100644 --- a/applications/utilities/preProcessing/foamUpgradeCyclics/foamUpgradeCyclics.C +++ b/applications/utilities/preProcessing/foamUpgradeCyclics/foamUpgradeCyclics.C @@ -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"); } diff --git a/src/OpenFOAM/db/dictionary/dictionary.C b/src/OpenFOAM/db/dictionary/dictionary.C index cc8550bab9..7539f6d7de 100644 --- a/src/OpenFOAM/db/dictionary/dictionary.C +++ b/src/OpenFOAM/db/dictionary/dictionary.C @@ -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::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 { diff --git a/src/OpenFOAM/db/dictionary/dictionary.H b/src/OpenFOAM/db/dictionary/dictionary.H index 023ea225eb..ebd0dc9ea1 100644 --- a/src/OpenFOAM/db/dictionary/dictionary.H +++ b/src/OpenFOAM/db/dictionary/dictionary.H @@ -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.