From c2e58dca64a86f8e32347a916fc8c6ee8090f830 Mon Sep 17 00:00:00 2001
From: Mark Olesen <Mark.Olesen@esi-group.com>
Date: Mon, 29 Oct 2018 12:54:30 +0000
Subject: [PATCH] ENH: support multiple zones for topo set sources (#1060)

- uses the keywords 'zones' and 'zone' to avoid potential conflicts
  with a named topoSet action, but accepts 'name' for compatibility.
---
 .../mesh/manipulation/topoSet/topoSetDict     |  4 ++-
 .../faceZoneToCell/faceZoneToCell.C           | 33 ++++++++++++------
 .../faceZoneToCell/faceZoneToCell.H           | 21 +++++++-----
 .../sets/cellSources/zoneToCell/zoneToCell.C  | 31 +++++++++++------
 .../sets/cellSources/zoneToCell/zoneToCell.H  | 27 ++++++++-------
 .../setToCellZone/setToCellZone.H             |  2 +-
 .../sets/faceSources/zoneToFace/zoneToFace.C  | 34 ++++++++++++-------
 .../sets/faceSources/zoneToFace/zoneToFace.H  | 27 ++++++++-------
 .../pointSources/zoneToPoint/zoneToPoint.C    | 31 +++++++++++------
 .../pointSources/zoneToPoint/zoneToPoint.H    | 27 ++++++++-------
 .../sets/topoSetSource/topoSetSource.C        |  6 +---
 .../heatExchanger/system/air/topoSetDict.1    |  2 +-
 .../heatExchanger/system/air/topoSetDict.2    | 12 +------
 .../flange/system/topoSetDict-background      | 10 +++---
 .../laminar/sphereDrop/system/topoSetDict     |  6 ++--
 .../RAS/mixerVessel2D/system/topoSetDict      |  2 +-
 .../laminar/mixerVessel2D/system/topoSetDict  |  2 +-
 .../mixerVessel2D/system/topoSetDict          |  2 +-
 .../laminar/mixerVessel2D/system/topoSetDict  |  2 +-
 .../boatAndPropeller/system/topoSetDictHull   | 22 ++++++------
 .../system/topoSetDictPropeller               | 22 ++++++------
 .../boatAndPropeller/system/topoSetDictRudder | 22 ++++++------
 .../laminar/mixerVessel2D/system/topoSetDict  |  2 +-
 .../laminar/mixerVessel2D/system/topoSetDict  |  2 +-
 .../laminar/mixerVessel2D/system/topoSetDict  |  2 +-
 25 files changed, 195 insertions(+), 158 deletions(-)

diff --git a/applications/utilities/mesh/manipulation/topoSet/topoSetDict b/applications/utilities/mesh/manipulation/topoSet/topoSetDict
index 66302acdfa8..d3eb9f805ff 100644
--- a/applications/utilities/mesh/manipulation/topoSet/topoSetDict
+++ b/applications/utilities/mesh/manipulation/topoSet/topoSetDict
@@ -63,7 +63,9 @@ FoamFile
 //    source faceZoneToCell;
 //    sourceInfo
 //    {
-//        name ".*Zone";      // Name of faceZone, regular expressions allowed
+//        zones (".*Zone");   // Name of faceZone, regular expressions allowed
+//  // OR zone ".*Zone";      // Name of faceZone, regular expressions allowed
+//  // OR name ".*Zone";      // Name of faceZone, regular expressions allowed
 //        option master;      // master/slave
 //    }
 //
diff --git a/src/meshTools/sets/cellSources/faceZoneToCell/faceZoneToCell.C b/src/meshTools/sets/cellSources/faceZoneToCell/faceZoneToCell.C
index 8b10efb06a8..68c81f2267d 100644
--- a/src/meshTools/sets/cellSources/faceZoneToCell/faceZoneToCell.C
+++ b/src/meshTools/sets/cellSources/faceZoneToCell/faceZoneToCell.C
@@ -65,7 +65,7 @@ void Foam::faceZoneToCell::combine(topoSet& set, const bool add) const
 
     for (const faceZone& zone : mesh_.faceZones())
     {
-        if (zoneName_.match(zone.name()))
+        if (selectedZones_.match(zone.name()))
         {
             hasMatched = true;
 
@@ -77,8 +77,8 @@ void Foam::faceZoneToCell::combine(topoSet& set, const bool add) const
             );
 
             Info<< "    Found matching zone " << zone.name()
-                << " with " << cellLabels.size() << " cells on selected side."
-                << endl;
+                << " with " << cellLabels.size() << " cells on "
+                << faceActionNames_[option_] << " side" << endl;
 
             for (const label celli : cellLabels)
             {
@@ -94,7 +94,8 @@ void Foam::faceZoneToCell::combine(topoSet& set, const bool add) const
     if (!hasMatched)
     {
         WarningInFunction
-            << "Cannot find any faceZone named " << zoneName_ << nl
+            << "Cannot find any faceZone matching "
+            << flatOutput(selectedZones_) << nl
             << "Valid names: " << flatOutput(mesh_.faceZones().names())
             << endl;
     }
@@ -106,12 +107,12 @@ void Foam::faceZoneToCell::combine(topoSet& set, const bool add) const
 Foam::faceZoneToCell::faceZoneToCell
 (
     const polyMesh& mesh,
-    const word& zoneName,
+    const wordRe& zoneName,
     const faceAction option
 )
 :
     topoSetSource(mesh),
-    zoneName_(zoneName),
+    selectedZones_(one(), zoneName),
     option_(option)
 {}
 
@@ -123,9 +124,17 @@ Foam::faceZoneToCell::faceZoneToCell
 )
 :
     topoSetSource(mesh),
-    zoneName_(dict.get<wordRe>("name")),
+    selectedZones_(),
     option_(faceActionNames_.get("option", dict))
-{}
+{
+    // Look for 'zones' and 'zone', but accept 'name' as well
+    if (!dict.readIfPresent("zones", selectedZones_))
+    {
+        selectedZones_.resize(1);
+        selectedZones_.first() =
+            dict.getCompat<wordRe>("zone", {{"name", 1806}});
+    }
+}
 
 
 Foam::faceZoneToCell::faceZoneToCell
@@ -135,7 +144,7 @@ Foam::faceZoneToCell::faceZoneToCell
 )
 :
     topoSetSource(mesh),
-    zoneName_(checkIs(is)),
+    selectedZones_(one(), wordRe(checkIs(is))),
     option_(faceActionNames_.read(checkIs(is)))
 {}
 
@@ -151,14 +160,16 @@ void Foam::faceZoneToCell::applyToSet
     if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
     {
         Info<< "    Adding all " << faceActionNames_[option_]
-            << " cells of faceZone " << zoneName_ << " ..." << endl;
+            << " cells of face zones "
+            << flatOutput(selectedZones_) << " ..." << endl;
 
         combine(set, true);
     }
     else if (action == topoSetSource::DELETE)
     {
         Info<< "    Removing all " << faceActionNames_[option_]
-            << " cells of faceZone " << zoneName_ << " ..." << endl;
+            << " cells of face zones "
+            << flatOutput(selectedZones_) << " ..." << endl;
 
         combine(set, false);
     }
diff --git a/src/meshTools/sets/cellSources/faceZoneToCell/faceZoneToCell.H b/src/meshTools/sets/cellSources/faceZoneToCell/faceZoneToCell.H
index 3096d7ddf75..33f24e706b9 100644
--- a/src/meshTools/sets/cellSources/faceZoneToCell/faceZoneToCell.H
+++ b/src/meshTools/sets/cellSources/faceZoneToCell/faceZoneToCell.H
@@ -29,11 +29,16 @@ Description
 
     \heading Dictionary parameters
     \table
-        Property    | Description                       | Required  | Default
-        name        | The face zone name or regex       | yes   |
-        option      | Selection type (master / slave)   | yes   |
+        Property    | Description                           | Required | Default
+        option      | Selection type (master / slave)       | yes   |
+        zone        | The face zone name or regex           | possibly |
+        zones       | The face zone names or regexs         | possibly |
+        name        | Older specification for 'zone'        | no    |
     \endtable
 
+Note
+    Selection of multiple zones has precedence.
+
 SourceFiles
     faceZoneToCell.C
 
@@ -43,7 +48,7 @@ SourceFiles
 #define faceZoneToCell_H
 
 #include "topoSetSource.H"
-#include "wordRe.H"
+#include "wordRes.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
@@ -75,8 +80,8 @@ private:
         //- Add usage string
         static addToUsageTable usage_;
 
-        //- Name/regular expression of faceZone
-        wordRe zoneName_;
+        //- Matcher for face zones
+        wordRes selectedZones_;
 
         //- Option
         faceAction option_;
@@ -98,7 +103,7 @@ public:
         faceZoneToCell
         (
             const polyMesh& mesh,
-            const word& zoneName,
+            const wordRe& zoneName,
             const faceAction option
         );
 
@@ -115,7 +120,7 @@ public:
 
     // Member Functions
 
-        virtual sourceType setType() const
+        virtual topoSetSource::sourceType setType() const
         {
             return CELLSETSOURCE;
         }
diff --git a/src/meshTools/sets/cellSources/zoneToCell/zoneToCell.C b/src/meshTools/sets/cellSources/zoneToCell/zoneToCell.C
index ee3e616b251..8170f94c13e 100644
--- a/src/meshTools/sets/cellSources/zoneToCell/zoneToCell.C
+++ b/src/meshTools/sets/cellSources/zoneToCell/zoneToCell.C
@@ -54,7 +54,7 @@ void Foam::zoneToCell::combine(topoSet& set, const bool add) const
 
     for (const cellZone& zone : mesh_.cellZones())
     {
-        if (zoneName_.match(zone.name()))
+        if (selectedZones_.match(zone.name()))
         {
             hasMatched = true;
 
@@ -77,7 +77,8 @@ void Foam::zoneToCell::combine(topoSet& set, const bool add) const
     if (!hasMatched)
     {
         WarningInFunction
-            << "Cannot find any cellZone named " << zoneName_ << nl
+            << "Cannot find any cellZone matching "
+            << flatOutput(selectedZones_) << nl
             << "Valid names: " << flatOutput(mesh_.cellZones().names())
             << endl;
     }
@@ -89,11 +90,11 @@ void Foam::zoneToCell::combine(topoSet& set, const bool add) const
 Foam::zoneToCell::zoneToCell
 (
     const polyMesh& mesh,
-    const word& zoneName
+    const wordRe& zoneName
 )
 :
     topoSetSource(mesh),
-    zoneName_(zoneName)
+    selectedZones_(one(), zoneName)
 {}
 
 
@@ -104,8 +105,16 @@ Foam::zoneToCell::zoneToCell
 )
 :
     topoSetSource(mesh),
-    zoneName_(dict.get<wordRe>("name"))
-{}
+    selectedZones_()
+{
+    // Look for 'zones' and 'zone', but accept 'name' as well
+    if (!dict.readIfPresent("zones", selectedZones_))
+    {
+        selectedZones_.resize(1);
+        selectedZones_.first() =
+            dict.getCompat<wordRe>("zone", {{"name", 1806}});
+    }
+}
 
 
 Foam::zoneToCell::zoneToCell
@@ -115,7 +124,7 @@ Foam::zoneToCell::zoneToCell
 )
 :
     topoSetSource(mesh),
-    zoneName_(checkIs(is))
+    selectedZones_(one(), wordRe(checkIs(is)))
 {}
 
 
@@ -129,15 +138,15 @@ void Foam::zoneToCell::applyToSet
 {
     if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
     {
-        Info<< "    Adding all cells of cellZone " << zoneName_ << " ..."
-            << endl;
+        Info<< "    Adding all cells of cell zones "
+            << flatOutput(selectedZones_) << " ..." << endl;
 
         combine(set, true);
     }
     else if (action == topoSetSource::DELETE)
     {
-        Info<< "    Removing all cells of cellZone " << zoneName_ << " ..."
-            << endl;
+        Info<< "    Removing all cells of cell zones "
+            << flatOutput(selectedZones_) << " ..." << endl;
 
         combine(set, false);
     }
diff --git a/src/meshTools/sets/cellSources/zoneToCell/zoneToCell.H b/src/meshTools/sets/cellSources/zoneToCell/zoneToCell.H
index d6872267980..fe86baaccc6 100644
--- a/src/meshTools/sets/cellSources/zoneToCell/zoneToCell.H
+++ b/src/meshTools/sets/cellSources/zoneToCell/zoneToCell.H
@@ -25,14 +25,19 @@ Class
     Foam::zoneToCell
 
 Description
-    A topoSetSource to select cells based on cellZone.
+    A topoSetSource to select cells based on one or more cellZones.
 
     \heading Dictionary parameters
     \table
-        Property    | Description                       | Required  | Default
-        name        | The cell zone name or regex       | yes   |
+        Property    | Description                           | Required | Default
+        zone        | The cell zone name or regex           | possibly |
+        zones       | The cell zone names or regexs         | possibly |
+        name        | Older specification for 'zone'        | no    |
     \endtable
 
+Note
+    Selection of multiple zones has precedence.
+
 SourceFiles
     zoneToCell.C
 
@@ -42,7 +47,7 @@ SourceFiles
 #define zoneToCell_H
 
 #include "topoSetSource.H"
-#include "wordRe.H"
+#include "wordRes.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
@@ -50,7 +55,7 @@ namespace Foam
 {
 
 /*---------------------------------------------------------------------------*\
-                        Class zoneToCell Declaration
+                         Class zoneToCell Declaration
 \*---------------------------------------------------------------------------*/
 
 class zoneToCell
@@ -63,8 +68,8 @@ class zoneToCell
         //- Add usage string
         static addToUsageTable usage_;
 
-        //- Name/regular expression of cellZone
-        wordRe zoneName_;
+        //- Matcher for zones
+        wordRes selectedZones_;
 
 
     // Private Member Functions
@@ -80,11 +85,7 @@ public:
     // Constructors
 
         //- Construct from components
-        zoneToCell
-        (
-            const polyMesh& mesh,
-            const word& zoneName
-        );
+        zoneToCell(const polyMesh& mesh, const wordRe& zoneName);
 
         //- Construct from dictionary
         zoneToCell(const polyMesh& mesh, const dictionary& dict);
@@ -99,7 +100,7 @@ public:
 
     // Member Functions
 
-        virtual sourceType setType() const
+        virtual topoSetSource::sourceType setType() const
         {
             return CELLSETSOURCE;
         }
diff --git a/src/meshTools/sets/cellZoneSources/setToCellZone/setToCellZone.H b/src/meshTools/sets/cellZoneSources/setToCellZone/setToCellZone.H
index aadde9c799c..af0695ec321 100644
--- a/src/meshTools/sets/cellZoneSources/setToCellZone/setToCellZone.H
+++ b/src/meshTools/sets/cellZoneSources/setToCellZone/setToCellZone.H
@@ -82,7 +82,7 @@ public:
         setToCellZone(const polyMesh& mesh, const dictionary& dict);
 
         //- Construct from Istream
-        setToCellZone(const polyMesh& mesh, Istream& is );
+        setToCellZone(const polyMesh& mesh, Istream& is);
 
 
     //- Destructor
diff --git a/src/meshTools/sets/faceSources/zoneToFace/zoneToFace.C b/src/meshTools/sets/faceSources/zoneToFace/zoneToFace.C
index ea9090c0562..b19f28403c1 100644
--- a/src/meshTools/sets/faceSources/zoneToFace/zoneToFace.C
+++ b/src/meshTools/sets/faceSources/zoneToFace/zoneToFace.C
@@ -54,7 +54,7 @@ void Foam::zoneToFace::combine(topoSet& set, const bool add) const
 
     for (const faceZone& zone : mesh_.faceZones())
     {
-        if (zoneName_.match(zone.name()))
+        if (selectedZones_.match(zone.name()))
         {
             hasMatched = true;
 
@@ -77,8 +77,10 @@ void Foam::zoneToFace::combine(topoSet& set, const bool add) const
     if (!hasMatched)
     {
         WarningInFunction
-            << "Cannot find any faceZone named " << zoneName_ << endl
-            << "Valid names are " << mesh_.faceZones().names() << endl;
+            << "Cannot find any faceZone matching "
+            << flatOutput(selectedZones_) << nl
+            << "Valid names are " << flatOutput(mesh_.faceZones().names())
+            << endl;
     }
 }
 
@@ -88,11 +90,11 @@ void Foam::zoneToFace::combine(topoSet& set, const bool add) const
 Foam::zoneToFace::zoneToFace
 (
     const polyMesh& mesh,
-    const word& zoneName
+    const wordRe& zoneName
 )
 :
     topoSetSource(mesh),
-    zoneName_(zoneName)
+    selectedZones_(one(), zoneName)
 {}
 
 
@@ -103,8 +105,16 @@ Foam::zoneToFace::zoneToFace
 )
 :
     topoSetSource(mesh),
-    zoneName_(dict.get<wordRe>("name"))
-{}
+    selectedZones_()
+{
+    // Look for 'zones' and 'zone', but accept 'name' as well
+    if (!dict.readIfPresent("zones", selectedZones_))
+    {
+        selectedZones_.resize(1);
+        selectedZones_.first() =
+            dict.getCompat<wordRe>("zone", {{"name", 1806}});
+    }
+}
 
 
 Foam::zoneToFace::zoneToFace
@@ -114,7 +124,7 @@ Foam::zoneToFace::zoneToFace
 )
 :
     topoSetSource(mesh),
-    zoneName_(checkIs(is))
+    selectedZones_(one(), wordRe(checkIs(is)))
 {}
 
 
@@ -128,15 +138,15 @@ void Foam::zoneToFace::applyToSet
 {
     if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
     {
-        Info<< "    Adding all faces of faceZone " << zoneName_ << " ..."
-            << endl;
+        Info<< "    Adding all faces of face zones "
+            << flatOutput(selectedZones_) << " ..." << endl;
 
         combine(set, true);
     }
     else if (action == topoSetSource::DELETE)
     {
-        Info<< "    Removing all faces of faceZone " << zoneName_ << " ..."
-            << endl;
+        Info<< "    Removing all faces of face zones "
+            << flatOutput(selectedZones_) << " ..." << endl;
 
         combine(set, false);
     }
diff --git a/src/meshTools/sets/faceSources/zoneToFace/zoneToFace.H b/src/meshTools/sets/faceSources/zoneToFace/zoneToFace.H
index 35d9c23ebe0..f236d3e8707 100644
--- a/src/meshTools/sets/faceSources/zoneToFace/zoneToFace.H
+++ b/src/meshTools/sets/faceSources/zoneToFace/zoneToFace.H
@@ -25,14 +25,19 @@ Class
     Foam::zoneToFace
 
 Description
-    A topoSetSource to select faces based on faceZone.
+    A topoSetSource to select faces based on one of more faceZones.
 
     \heading Dictionary parameters
     \table
-        Property    | Description                       | Required  | Default
-        name        | The face zone name or regex       | yes   |
+        Property    | Description                           | Required | Default
+        zone        | The face zone name or regex           | possibly |
+        zones       | The face zone names or regexs         | possibly |
+        name        | Older specification for 'zone'        | no    |
     \endtable
 
+Note
+    Selection of multiple zones has precedence.
+
 SourceFiles
     zoneToFace.C
 
@@ -42,7 +47,7 @@ SourceFiles
 #define zoneToFace_H
 
 #include "topoSetSource.H"
-#include "wordRe.H"
+#include "wordRes.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
@@ -50,7 +55,7 @@ namespace Foam
 {
 
 /*---------------------------------------------------------------------------*\
-                        Class zoneToFace Declaration
+                         Class zoneToFace Declaration
 \*---------------------------------------------------------------------------*/
 
 class zoneToFace
@@ -63,8 +68,8 @@ class zoneToFace
         //- Add usage string
         static addToUsageTable usage_;
 
-        //- Name/regular expression of the faceZone
-        wordRe zoneName_;
+        //- Matcher for zones
+        wordRes selectedZones_;
 
 
     // Private Member Functions
@@ -80,11 +85,7 @@ public:
     // Constructors
 
         //- Construct from components
-        zoneToFace
-        (
-            const polyMesh& mesh,
-            const word& zoneName
-        );
+        zoneToFace(const polyMesh& mesh, const wordRe& zoneName);
 
         //- Construct from dictionary
         zoneToFace(const polyMesh& mesh, const dictionary& dict);
@@ -99,7 +100,7 @@ public:
 
     // Member Functions
 
-        virtual sourceType setType() const
+        virtual topoSetSource::sourceType setType() const
         {
             return FACESETSOURCE;
         }
diff --git a/src/meshTools/sets/pointSources/zoneToPoint/zoneToPoint.C b/src/meshTools/sets/pointSources/zoneToPoint/zoneToPoint.C
index 69d6ab31af3..99e45aefdbb 100644
--- a/src/meshTools/sets/pointSources/zoneToPoint/zoneToPoint.C
+++ b/src/meshTools/sets/pointSources/zoneToPoint/zoneToPoint.C
@@ -54,7 +54,7 @@ void Foam::zoneToPoint::combine(topoSet& set, const bool add) const
 
     for (const pointZone& zone : mesh_.pointZones())
     {
-        if (zoneName_.match(zone.name()))
+        if (selectedZones_.match(zone.name()))
         {
             hasMatched = true;
 
@@ -77,7 +77,8 @@ void Foam::zoneToPoint::combine(topoSet& set, const bool add) const
     if (!hasMatched)
     {
         WarningInFunction
-            << "Cannot find any pointZone named " << zoneName_ << nl
+            << "Cannot find any pointZone matching "
+            << flatOutput(selectedZones_) << nl
             << "Valid names: " << flatOutput(mesh_.pointZones().names())
             << endl;
     }
@@ -89,11 +90,11 @@ void Foam::zoneToPoint::combine(topoSet& set, const bool add) const
 Foam::zoneToPoint::zoneToPoint
 (
     const polyMesh& mesh,
-    const word& zoneName
+    const wordRe& zoneName
 )
 :
     topoSetSource(mesh),
-    zoneName_(zoneName)
+    selectedZones_(one(), zoneName)
 {}
 
 
@@ -104,8 +105,16 @@ Foam::zoneToPoint::zoneToPoint
 )
 :
     topoSetSource(mesh),
-    zoneName_(dict.get<wordRe>("name"))
-{}
+    selectedZones_()
+{
+    // Look for 'zones' and 'zone', but accept 'name' as well
+    if (!dict.readIfPresent("zones", selectedZones_))
+    {
+        selectedZones_.resize(1);
+        selectedZones_.first() =
+            dict.getCompat<wordRe>("zone", {{"name", 1806}});
+    }
+}
 
 
 Foam::zoneToPoint::zoneToPoint
@@ -115,7 +124,7 @@ Foam::zoneToPoint::zoneToPoint
 )
 :
     topoSetSource(mesh),
-    zoneName_(checkIs(is))
+    selectedZones_(one(), wordRe(checkIs(is)))
 {}
 
 
@@ -129,15 +138,15 @@ void Foam::zoneToPoint::applyToSet
 {
     if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
     {
-        Info<< "    Adding all points of pointZone " << zoneName_ << " ..."
-            << endl;
+        Info<< "    Adding all points of point zones "
+            << flatOutput(selectedZones_) << " ..." << endl;
 
         combine(set, true);
     }
     else if (action == topoSetSource::DELETE)
     {
-        Info<< "    Removing all points of pointZone " << zoneName_ << " ..."
-            << endl;
+        Info<< "    Removing all points of point zones "
+            << flatOutput(selectedZones_) << " ..." << endl;
 
         combine(set, false);
     }
diff --git a/src/meshTools/sets/pointSources/zoneToPoint/zoneToPoint.H b/src/meshTools/sets/pointSources/zoneToPoint/zoneToPoint.H
index ea7c0eaee13..89330520767 100644
--- a/src/meshTools/sets/pointSources/zoneToPoint/zoneToPoint.H
+++ b/src/meshTools/sets/pointSources/zoneToPoint/zoneToPoint.H
@@ -25,14 +25,19 @@ Class
     Foam::zoneToPoint
 
 Description
-    A topoSetSource to select points based on pointZone.
+    A topoSetSource to select points based on one or more pointZones.
 
     \heading Dictionary parameters
     \table
-        Property    | Description                       | Required  | Default
-        name        | The point zone name or regex      | yes   |
+        Property    | Description                           | Required | Default
+        zone        | The point zone name or regex          | possibly |
+        zones       | The point zone names or regexs        | possibly |
+        name        | Older specification for 'zone'        | no    |
     \endtable
 
+Note
+    Selection of multiple zones has precedence.
+
 SourceFiles
     zoneToPoint.C
 
@@ -42,7 +47,7 @@ SourceFiles
 #define zoneToPoint_H
 
 #include "topoSetSource.H"
-#include "wordRe.H"
+#include "wordRes.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
@@ -50,7 +55,7 @@ namespace Foam
 {
 
 /*---------------------------------------------------------------------------*\
-                        Class zoneToPoint Declaration
+                         Class zoneToPoint Declaration
 \*---------------------------------------------------------------------------*/
 
 class zoneToPoint
@@ -63,8 +68,8 @@ class zoneToPoint
         //- Add usage string
         static addToUsageTable usage_;
 
-        //- Name/regular expression of zone
-        wordRe zoneName_;
+        //- Matcher for zones
+        wordRes selectedZones_;
 
 
     // Private Member Functions
@@ -80,11 +85,7 @@ public:
     // Constructors
 
         //- Construct from components
-        zoneToPoint
-        (
-            const polyMesh& mesh,
-            const word& zoneName
-        );
+        zoneToPoint(const polyMesh& mesh, const wordRe& zoneName);
 
         //- Construct from dictionary
         zoneToPoint(const polyMesh& mesh, const dictionary& dict);
@@ -99,7 +100,7 @@ public:
 
     // Member Functions
 
-        virtual sourceType setType() const
+        virtual topoSetSource::sourceType setType() const
         {
             return POINTSETSOURCE;
         }
diff --git a/src/meshTools/sets/topoSetSource/topoSetSource.C b/src/meshTools/sets/topoSetSource/topoSetSource.C
index 2bd6225e198..fa95d9d27b8 100644
--- a/src/meshTools/sets/topoSetSource/topoSetSource.C
+++ b/src/meshTools/sets/topoSetSource/topoSetSource.C
@@ -148,11 +148,7 @@ Foam::autoPtr<Foam::topoSetSource> Foam::topoSetSource::New
 
 Foam::Istream& Foam::topoSetSource::checkIs(Istream& is)
 {
-    if (is.good() && !is.eof())
-    {
-        return is;
-    }
-    else
+    if (!is.good() || is.eof())
     {
         FatalErrorInFunction
             << exit(FatalError);
diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/system/air/topoSetDict.1 b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/system/air/topoSetDict.1
index 55431121f36..73cbe27a8da 100644
--- a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/system/air/topoSetDict.1
+++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/system/air/topoSetDict.1
@@ -25,7 +25,7 @@ actions
         source  zoneToCell;
         sourceInfo
         {
-            name    cylinder;
+            zone    cylinder;
         }
     }
     {
diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/system/air/topoSetDict.2 b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/system/air/topoSetDict.2
index c49ab1e2d8c..2ab44cc7d5c 100644
--- a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/system/air/topoSetDict.2
+++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/system/air/topoSetDict.2
@@ -25,17 +25,7 @@ actions
         source  zoneToCell;
         sourceInfo
         {
-            name    cylinder;
-        }
-    }
-    {
-        name    rotorCells;
-        type    cellSet;
-        action  add;
-        source  zoneToCell;
-        sourceInfo
-        {
-            name    innerCylinder;
+            zones (cylinder innerCylinder);
         }
     }
     {
diff --git a/tutorials/mesh/foamyHexMesh/flange/system/topoSetDict-background b/tutorials/mesh/foamyHexMesh/flange/system/topoSetDict-background
index 1ce14c127ce..141b615cce0 100644
--- a/tutorials/mesh/foamyHexMesh/flange/system/topoSetDict-background
+++ b/tutorials/mesh/foamyHexMesh/flange/system/topoSetDict-background
@@ -46,13 +46,15 @@ FoamFile
 //    // Cells in cell zone
 //    source zoneToCell;
 //    {
-//        name ".*Zone";      // Name of cellZone, regular expressions allowed
+//        zones (".*Zone");   // Name of cellZones, regular expressions allowed
+//        zone ".*Zone";      // Name of cellZone, regular expressions allowed
 //    }
 //
 //    // Cells on master or slave side of faceZone
 //    source faceZoneToCell;
 //    {
-//        name ".*Zone";      // Name of faceZone, regular expressions allowed
+//        zones (".*Zone");   // Name of faceZones, regular expressions allowed
+//        zone ".*Zone";      // Name of faceZone, regular expressions allowed
 //        option master;      // master/slave
 //    }
 //
@@ -190,7 +192,7 @@ FoamFile
 //    // All faces of faceZone
 //    source zoneToFace;
 //    {
-//        name ".*Zone1";     // Name of faceZone, regular expressions allowed
+//        zone ".*Zone1";     // Name of faceZone, regular expressions allowed
 //    }
 //
 //    // Faces with face centre within box
@@ -240,7 +242,7 @@ FoamFile
 //    // All points in pointzone
 //    source zoneToPoint;
 //    {
-//        name ".*Zone";      // name of pointZone, regular expressions allowed
+//        zone ".*Zone";      // name of pointZone, regular expressions allowed
 //    }
 //
 //    // Points nearest to coordinates
diff --git a/tutorials/multiphase/compressibleInterDyMFoam/laminar/sphereDrop/system/topoSetDict b/tutorials/multiphase/compressibleInterDyMFoam/laminar/sphereDrop/system/topoSetDict
index 562cea07464..40cd58f308f 100644
--- a/tutorials/multiphase/compressibleInterDyMFoam/laminar/sphereDrop/system/topoSetDict
+++ b/tutorials/multiphase/compressibleInterDyMFoam/laminar/sphereDrop/system/topoSetDict
@@ -27,7 +27,7 @@ actions
         source  zoneToCell;
         sourceInfo
         {
-            name    topBlock;
+            zone    topBlock;
         }
     }
 
@@ -39,7 +39,7 @@ actions
         source  zoneToCell;
         sourceInfo
         {
-            name    centralBlock;
+            zone    centralBlock;
         }
     }
 
@@ -51,7 +51,7 @@ actions
         source zoneToCell;
         sourceInfo
         {
-            name    bottomBlock;
+            zone    bottomBlock;
         }
     }
 
diff --git a/tutorials/multiphase/driftFluxFoam/RAS/mixerVessel2D/system/topoSetDict b/tutorials/multiphase/driftFluxFoam/RAS/mixerVessel2D/system/topoSetDict
index 00bdad762d9..1aa54cc8196 100644
--- a/tutorials/multiphase/driftFluxFoam/RAS/mixerVessel2D/system/topoSetDict
+++ b/tutorials/multiphase/driftFluxFoam/RAS/mixerVessel2D/system/topoSetDict
@@ -24,7 +24,7 @@ actions
         source  zoneToCell;
         sourceInfo
         {
-            name rotor;
+            zone rotor;
         }
     }
 );
diff --git a/tutorials/multiphase/interFoam/laminar/mixerVessel2D/system/topoSetDict b/tutorials/multiphase/interFoam/laminar/mixerVessel2D/system/topoSetDict
index 00bdad762d9..1aa54cc8196 100644
--- a/tutorials/multiphase/interFoam/laminar/mixerVessel2D/system/topoSetDict
+++ b/tutorials/multiphase/interFoam/laminar/mixerVessel2D/system/topoSetDict
@@ -24,7 +24,7 @@ actions
         source  zoneToCell;
         sourceInfo
         {
-            name rotor;
+            zone rotor;
         }
     }
 );
diff --git a/tutorials/multiphase/multiphaseEulerFoam/mixerVessel2D/system/topoSetDict b/tutorials/multiphase/multiphaseEulerFoam/mixerVessel2D/system/topoSetDict
index 00bdad762d9..1aa54cc8196 100644
--- a/tutorials/multiphase/multiphaseEulerFoam/mixerVessel2D/system/topoSetDict
+++ b/tutorials/multiphase/multiphaseEulerFoam/mixerVessel2D/system/topoSetDict
@@ -24,7 +24,7 @@ actions
         source  zoneToCell;
         sourceInfo
         {
-            name rotor;
+            zone rotor;
         }
     }
 );
diff --git a/tutorials/multiphase/multiphaseInterFoam/laminar/mixerVessel2D/system/topoSetDict b/tutorials/multiphase/multiphaseInterFoam/laminar/mixerVessel2D/system/topoSetDict
index 00bdad762d9..1aa54cc8196 100644
--- a/tutorials/multiphase/multiphaseInterFoam/laminar/mixerVessel2D/system/topoSetDict
+++ b/tutorials/multiphase/multiphaseInterFoam/laminar/mixerVessel2D/system/topoSetDict
@@ -24,7 +24,7 @@ actions
         source  zoneToCell;
         sourceInfo
         {
-            name rotor;
+            zone rotor;
         }
     }
 );
diff --git a/tutorials/multiphase/overInterDyMFoam/boatAndPropeller/system/topoSetDictHull b/tutorials/multiphase/overInterDyMFoam/boatAndPropeller/system/topoSetDictHull
index 5533f402e59..13a0176bd45 100644
--- a/tutorials/multiphase/overInterDyMFoam/boatAndPropeller/system/topoSetDictHull
+++ b/tutorials/multiphase/overInterDyMFoam/boatAndPropeller/system/topoSetDictHull
@@ -17,14 +17,14 @@ FoamFile
 actions
 (
     {
-      name    bgr0;       // all around bgr
-      type    cellSet;
-      action  new;
-      source  zoneToCell;
-      sourceInfo
-      {
-          name    background;
-      }
+        name    bgr0;       // all around bgr
+        type    cellSet;
+        action  new;
+        source  zoneToCell;
+        sourceInfo
+        {
+            zone    background;
+        }
     }
     {
         name    hullBox0;       // all around bgr
@@ -33,7 +33,7 @@ actions
         source  zoneToCell;
         sourceInfo
         {
-            name    hullBox;
+            zone    hullBox;
         }
     }
     {
@@ -43,7 +43,7 @@ actions
         source  zoneToCell;
         sourceInfo
         {
-            name    propeller;
+            zone    propeller;
         }
     }
     {
@@ -53,7 +53,7 @@ actions
         source  zoneToCell;
         sourceInfo
         {
-            name    rudder;
+            zone    rudder;
         }
     }
 
diff --git a/tutorials/multiphase/overInterDyMFoam/boatAndPropeller/system/topoSetDictPropeller b/tutorials/multiphase/overInterDyMFoam/boatAndPropeller/system/topoSetDictPropeller
index f1dd3a613dc..cd94103ab28 100644
--- a/tutorials/multiphase/overInterDyMFoam/boatAndPropeller/system/topoSetDictPropeller
+++ b/tutorials/multiphase/overInterDyMFoam/boatAndPropeller/system/topoSetDictPropeller
@@ -17,14 +17,14 @@ FoamFile
 actions
 (
     {
-      name    bgr0;       // all around bgr
-      type    cellSet;
-      action  new;
-      source  zoneToCell;
-      sourceInfo
-      {
-          name    background;
-      }
+        name    bgr0;       // all around bgr
+        type    cellSet;
+        action  new;
+        source  zoneToCell;
+        sourceInfo
+        {
+            zone    background;
+        }
     }
     {
         name    hullBox0;       // all around hull
@@ -33,7 +33,7 @@ actions
         source  zoneToCell;
         sourceInfo
         {
-            name    hullBox;
+            zone    hullBox;
         }
     }
     {
@@ -43,7 +43,7 @@ actions
         source  zoneToCell;
         sourceInfo
         {
-            name    propeller;
+            zone    propeller;
         }
     }
     {
@@ -53,7 +53,7 @@ actions
         source  zoneToCell;
         sourceInfo
         {
-            name    rudder;
+            zone    rudder;
         }
     }
 
diff --git a/tutorials/multiphase/overInterDyMFoam/boatAndPropeller/system/topoSetDictRudder b/tutorials/multiphase/overInterDyMFoam/boatAndPropeller/system/topoSetDictRudder
index 4e79efeb1dc..b70cb4fee3b 100644
--- a/tutorials/multiphase/overInterDyMFoam/boatAndPropeller/system/topoSetDictRudder
+++ b/tutorials/multiphase/overInterDyMFoam/boatAndPropeller/system/topoSetDictRudder
@@ -17,14 +17,14 @@ FoamFile
 actions
 (
     {
-      name    bgr0;       // all around bgr
-      type    cellSet;
-      action  new;
-      source  zoneToCell;
-      sourceInfo
-      {
-          name    background;
-      }
+        name    bgr0;       // all around bgr
+        type    cellSet;
+        action  new;
+        source  zoneToCell;
+        sourceInfo
+        {
+            zone    background;
+        }
     }
     {
         name    hullBox0;       // all around hull
@@ -33,7 +33,7 @@ actions
         source  zoneToCell;
         sourceInfo
         {
-            name    hullBox;
+            zone    hullBox;
         }
     }
     {
@@ -43,7 +43,7 @@ actions
         source  zoneToCell;
         sourceInfo
         {
-            name    propeller;
+            zone    propeller;
         }
     }
     {
@@ -53,7 +53,7 @@ actions
         source  zoneToCell;
         sourceInfo
         {
-            name    rudder;
+            zone    rudder;
         }
     }
 
diff --git a/tutorials/multiphase/reactingMultiphaseEulerFoam/laminar/mixerVessel2D/system/topoSetDict b/tutorials/multiphase/reactingMultiphaseEulerFoam/laminar/mixerVessel2D/system/topoSetDict
index 00bdad762d9..1aa54cc8196 100644
--- a/tutorials/multiphase/reactingMultiphaseEulerFoam/laminar/mixerVessel2D/system/topoSetDict
+++ b/tutorials/multiphase/reactingMultiphaseEulerFoam/laminar/mixerVessel2D/system/topoSetDict
@@ -24,7 +24,7 @@ actions
         source  zoneToCell;
         sourceInfo
         {
-            name rotor;
+            zone rotor;
         }
     }
 );
diff --git a/tutorials/multiphase/reactingTwoPhaseEulerFoam/laminar/mixerVessel2D/system/topoSetDict b/tutorials/multiphase/reactingTwoPhaseEulerFoam/laminar/mixerVessel2D/system/topoSetDict
index 00bdad762d9..1aa54cc8196 100644
--- a/tutorials/multiphase/reactingTwoPhaseEulerFoam/laminar/mixerVessel2D/system/topoSetDict
+++ b/tutorials/multiphase/reactingTwoPhaseEulerFoam/laminar/mixerVessel2D/system/topoSetDict
@@ -24,7 +24,7 @@ actions
         source  zoneToCell;
         sourceInfo
         {
-            name rotor;
+            zone rotor;
         }
     }
 );
diff --git a/tutorials/multiphase/twoPhaseEulerFoam/laminar/mixerVessel2D/system/topoSetDict b/tutorials/multiphase/twoPhaseEulerFoam/laminar/mixerVessel2D/system/topoSetDict
index 00bdad762d9..1aa54cc8196 100644
--- a/tutorials/multiphase/twoPhaseEulerFoam/laminar/mixerVessel2D/system/topoSetDict
+++ b/tutorials/multiphase/twoPhaseEulerFoam/laminar/mixerVessel2D/system/topoSetDict
@@ -24,7 +24,7 @@ actions
         source  zoneToCell;
         sourceInfo
         {
-            name rotor;
+            zone rotor;
         }
     }
 );
-- 
GitLab