From e17c87d876a6879740a7409a1ead99bc5999f9ea Mon Sep 17 00:00:00 2001
From: mattijs <mattijs@hunt.opencfd.co.uk>
Date: Wed, 1 Jul 2009 13:54:48 +0100
Subject: [PATCH] wildcards for patch spec

---
 .../manipulation/createPatch/createPatch.C    | 25 +++----------------
 .../manipulation/createPatch/createPatchDict  |  4 +--
 2 files changed, 5 insertions(+), 24 deletions(-)

diff --git a/applications/utilities/mesh/manipulation/createPatch/createPatch.C b/applications/utilities/mesh/manipulation/createPatch/createPatch.C
index 3c799ca5a4b..7d74e7208c2 100644
--- a/applications/utilities/mesh/manipulation/createPatch/createPatch.C
+++ b/applications/utilities/mesh/manipulation/createPatch/createPatch.C
@@ -73,23 +73,6 @@ public:
 };
 
 
-
-label getPatch(const polyBoundaryMesh& patches, const word& patchName)
-{
-    label patchI = patches.findPatchID(patchName);
-
-    if (patchI == -1)
-    {
-        FatalErrorIn("createPatch(const polyBoundaryMesh&, const word&)")
-            << "Cannot find source patch " << patchName
-            << endl << "Valid patch names are " << patches.names()
-            << exit(FatalError);
-    }
-
-    return patchI;
-}
-
-
 void changePatchID
 (
     const polyMesh& mesh,
@@ -704,14 +687,12 @@ int main(int argc, char *argv[])
 
         if (sourceType == "patches")
         {
-            wordList patchSources(dict.lookup("patches"));
+            labelHashSet patchSources(patches.patchSet(dict.lookup("patches")));
 
             // Repatch faces of the patches.
-            forAll(patchSources, sourceI)
+            forAllConstIter(labelHashSet, patchSources, iter)
             {
-                label patchI = getPatch(patches, patchSources[sourceI]);
-
-                const polyPatch& pp = patches[patchI];
+                const polyPatch& pp = patches[iter.key()];
 
                 Info<< "Moving faces from patch " << pp.name()
                     << " to patch " << destPatchI << endl;
diff --git a/applications/utilities/mesh/manipulation/createPatch/createPatchDict b/applications/utilities/mesh/manipulation/createPatch/createPatchDict
index 9052daa0a8d..7dc93d5abaf 100644
--- a/applications/utilities/mesh/manipulation/createPatch/createPatchDict
+++ b/applications/utilities/mesh/manipulation/createPatch/createPatchDict
@@ -69,8 +69,8 @@ patches
         // How to construct: either from 'patches' or 'set'
         constructFrom patches;
 
-        // If constructFrom = patches : names of patches
-        patches (periodic-1 periodic-2);
+        // If constructFrom = patches : names of patches. Wildcards allowed.
+        patches ("periodic.*");
 
         // If constructFrom = set : name of faceSet
         set f0;
-- 
GitLab