From b0433d93f8c1154c222c1d2b7f1413480128600d Mon Sep 17 00:00:00 2001
From: Mark Olesen <Mark.Olesen@Germany>
Date: Thu, 15 Dec 2016 00:16:51 +0100
Subject: [PATCH] ENH: add ZoneMesh names(), sortedNames() methods

- similar to functionality available for IOobjectList, objectRegistry
---
 .../meshes/polyMesh/zones/ZoneMesh/ZoneMesh.C | 62 +++++++++++++++++++
 .../meshes/polyMesh/zones/ZoneMesh/ZoneMesh.H | 25 ++++++--
 2 files changed, 83 insertions(+), 4 deletions(-)

diff --git a/src/OpenFOAM/meshes/polyMesh/zones/ZoneMesh/ZoneMesh.C b/src/OpenFOAM/meshes/polyMesh/zones/ZoneMesh/ZoneMesh.C
index 63fa357bc9b..94f1c23a752 100644
--- a/src/OpenFOAM/meshes/polyMesh/zones/ZoneMesh/ZoneMesh.C
+++ b/src/OpenFOAM/meshes/polyMesh/zones/ZoneMesh/ZoneMesh.C
@@ -263,6 +263,68 @@ Foam::wordList Foam::ZoneMesh<ZoneType, MeshType>::names() const
 }
 
 
+template<class ZoneType, class MeshType>
+Foam::wordList Foam::ZoneMesh<ZoneType, MeshType>::names
+(
+    const wordRe& matcher
+) const
+{
+    wordList lst = this->names();
+
+    return wordList(lst, findStrings(matcher, lst));
+}
+
+
+template<class ZoneType, class MeshType>
+Foam::wordList Foam::ZoneMesh<ZoneType, MeshType>::names
+(
+    const wordReList& matcher
+)
+const
+{
+    wordList lst = this->names();
+
+    return wordList(lst, findStrings(matcher, lst));
+}
+
+
+template<class ZoneType, class MeshType>
+Foam::wordList Foam::ZoneMesh<ZoneType, MeshType>::sortedNames() const
+{
+    wordList sortedLst = this->names();
+    sort(sortedLst);
+
+    return sortedLst;
+}
+
+
+template<class ZoneType, class MeshType>
+Foam::wordList Foam::ZoneMesh<ZoneType, MeshType>::sortedNames
+(
+    const wordRe& matcher
+) const
+{
+    wordList sortedLst = this->names(matcher);
+    sort(sortedLst);
+
+    return sortedLst;
+}
+
+
+template<class ZoneType, class MeshType>
+Foam::wordList Foam::ZoneMesh<ZoneType, MeshType>::sortedNames
+(
+    const wordReList& matcher
+)
+const
+{
+    wordList sortedLst = this->names(matcher);
+    sort(sortedLst);
+
+    return sortedLst;
+}
+
+
 template<class ZoneType, class MeshType>
 Foam::labelList Foam::ZoneMesh<ZoneType, MeshType>::findIndices
 (
diff --git a/src/OpenFOAM/meshes/polyMesh/zones/ZoneMesh/ZoneMesh.H b/src/OpenFOAM/meshes/polyMesh/zones/ZoneMesh/ZoneMesh.H
index 06ee30f5e97..7d79a37a1e8 100644
--- a/src/OpenFOAM/meshes/polyMesh/zones/ZoneMesh/ZoneMesh.H
+++ b/src/OpenFOAM/meshes/polyMesh/zones/ZoneMesh/ZoneMesh.H
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
-     \\/     M anipulation  |
+     \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -40,6 +40,7 @@ SourceFiles
 #include "pointField.H"
 #include "Map.H"
 #include "PackedBoolList.H"
+#include "wordReList.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
@@ -80,10 +81,10 @@ class ZoneMesh
         bool read();
 
         //- Disallow construct as copy
-        ZoneMesh(const ZoneMesh&);
+        ZoneMesh(const ZoneMesh&) = delete;
 
         //- Disallow assignment
-        void operator=(const ZoneMesh<ZoneType, MeshType>&);
+        void operator=(const ZoneMesh<ZoneType, MeshType>&) = delete;
 
 
         //- Create zone map
@@ -141,9 +142,25 @@ public:
         //- Return a list of zone types
         wordList types() const;
 
-        //- Return a list of zone names
+        //- A list of the zone names
         wordList names() const;
 
+        //- A list of the zone names satisfying the input matcher
+        wordList names(const wordRe&) const;
+
+        //- A list of the zone names satisfying the input matchers
+        wordList names(const wordReList&) const;
+
+        //- Sorted list of the zone names
+        wordList sortedNames() const;
+
+        //- Sorted list of the zone names satisfying the input matcher
+        wordList sortedNames(const wordRe&) const;
+
+        //- Sorted list of the zone names satisfying the input matchers
+        wordList sortedNames(const wordReList&) const;
+
+
         //- Return zone indices for all matches
         labelList findIndices(const keyType&) const;
 
-- 
GitLab