From 99b293ffb3e3ddfa3bbdb5c65f0b3d5a92a8c7e5 Mon Sep 17 00:00:00 2001
From: Mark Olesen <Mark.Olesen@Germany>
Date: Wed, 2 Dec 2009 16:43:42 +0100
Subject: [PATCH] cellMatcher - can use ListOps for identity instead of its own
 method

---
 .../meshes/meshShapes/cellMatcher/cellMatcher.C | 17 ++---------------
 .../meshes/meshShapes/cellMatcher/cellMatcher.H |  6 ------
 .../meshShapes/cellMatcher/degenerateMatcher.C  | 12 ++++++------
 .../meshes/meshShapes/cellMatcher/hexMatcher.C  |  6 +++---
 .../meshShapes/cellMatcher/prismMatcher.C       |  3 ++-
 .../meshes/meshShapes/cellMatcher/pyrMatcher.C  |  3 ++-
 .../meshes/meshShapes/cellMatcher/tetMatcher.C  |  4 ++--
 .../meshShapes/cellMatcher/tetWedgeMatcher.C    |  3 ++-
 .../meshShapes/cellMatcher/wedgeMatcher.C       |  4 ++--
 9 files changed, 21 insertions(+), 37 deletions(-)

diff --git a/src/OpenFOAM/meshes/meshShapes/cellMatcher/cellMatcher.C b/src/OpenFOAM/meshes/meshShapes/cellMatcher/cellMatcher.C
index 93046b33079..58b4011418b 100644
--- a/src/OpenFOAM/meshes/meshShapes/cellMatcher/cellMatcher.C
+++ b/src/OpenFOAM/meshes/meshShapes/cellMatcher/cellMatcher.C
@@ -32,24 +32,11 @@ Description
 #include "Map.H"
 #include "faceList.H"
 #include "labelList.H"
-
-// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
-
-Foam::labelList Foam::cellMatcher::makeIdentity(const label nElems)
-{
-    labelList result(nElems);
-
-    forAll(result, elemI)
-    {
-        result[elemI] = elemI;
-    }
-    return result;
-}
+#include "ListOps.H"
 
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
-// Construct from components
 Foam::cellMatcher::cellMatcher
 (
     const label vertPerCell,
@@ -177,7 +164,7 @@ void Foam::cellMatcher::calcEdgeAddressing(const label numVert)
         {
             label start = f[prevVertI];
             label end = f[fp];
-            
+
             label key1 = edgeKey(numVert, start, end);
             label key2 = edgeKey(numVert, end, start);
 
diff --git a/src/OpenFOAM/meshes/meshShapes/cellMatcher/cellMatcher.H b/src/OpenFOAM/meshes/meshShapes/cellMatcher/cellMatcher.H
index b2f02e37beb..4f95e5e43ca 100644
--- a/src/OpenFOAM/meshes/meshShapes/cellMatcher/cellMatcher.H
+++ b/src/OpenFOAM/meshes/meshShapes/cellMatcher/cellMatcher.H
@@ -185,12 +185,6 @@ private:
 
 public:
 
-    // Static functions
-
-        //- Create list with incrementing labels
-        static labelList makeIdentity(const label nElems);
-
-
     // Constructors
 
         //- Construct given mesh and shape factors
diff --git a/src/OpenFOAM/meshes/meshShapes/cellMatcher/degenerateMatcher.C b/src/OpenFOAM/meshes/meshShapes/cellMatcher/degenerateMatcher.C
index f57aed27b30..240c8af157f 100644
--- a/src/OpenFOAM/meshes/meshShapes/cellMatcher/degenerateMatcher.C
+++ b/src/OpenFOAM/meshes/meshShapes/cellMatcher/degenerateMatcher.C
@@ -25,6 +25,7 @@ License
 \*---------------------------------------------------------------------------*/
 
 #include "degenerateMatcher.H"
+#include "ListOps.H"
 
 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
 
@@ -83,11 +84,10 @@ Foam::cellShape Foam::degenerateMatcher::match(const faceList& faces)
 
     return match
     (
-        faces, 
-        labelList(faces.size(), 0),     // Cell 0 is owner of all faces
-        0,                              // cell 0
-        labelList(cellMatcher::makeIdentity(faces.size()))  // cell 0 consists
-                                                            // of all faces
+        faces,
+        labelList(faces.size(), 0),    // cell 0 is owner of all faces
+        0,                             // cell 0
+        identity(faces.size())         // cell 0 consists of all faces
     );
 }
 
@@ -106,7 +106,7 @@ Foam::cellShape Foam::degenerateMatcher::match
 {
     return match
     (
-        mesh.faces(), 
+        mesh.faces(),
         mesh.faceOwner(),
         cellI,
         mesh.cells()[cellI]
diff --git a/src/OpenFOAM/meshes/meshShapes/cellMatcher/hexMatcher.C b/src/OpenFOAM/meshes/meshShapes/cellMatcher/hexMatcher.C
index aa4b8ab3575..09f5c69d000 100644
--- a/src/OpenFOAM/meshes/meshShapes/cellMatcher/hexMatcher.C
+++ b/src/OpenFOAM/meshes/meshShapes/cellMatcher/hexMatcher.C
@@ -26,6 +26,7 @@ License
 
 #include "hexMatcher.H"
 #include "primitiveMesh.H"
+#include "ListOps.H"
 
 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
 
@@ -36,7 +37,6 @@ const Foam::label Foam::hexMatcher::maxVertPerFace = 4;
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
-// Construct null
 Foam::hexMatcher::hexMatcher()
 :
     cellMatcher
@@ -97,7 +97,7 @@ bool Foam::hexMatcher::matchShape
     faceLabels_.setSize(facePerCell);
 
     //
-    // Try bottom face (face 4). 
+    // Try bottom face (face 4).
     // Only need to try one orientation of this face since hex is
     // rotation symmetric
     //
@@ -298,7 +298,7 @@ bool Foam::hexMatcher::isA(const faceList& faces)
         faces,                      // all faces in mesh
         labelList(faces.size(), 0), // cell 0 is owner of all faces
         0,                          // cell label
-        makeIdentity(faces.size())  // faces of cell 0
+        identity(faces.size())      // faces of cell 0
     );
 }
 
diff --git a/src/OpenFOAM/meshes/meshShapes/cellMatcher/prismMatcher.C b/src/OpenFOAM/meshes/meshShapes/cellMatcher/prismMatcher.C
index 32b99fc7bfe..d3b235cab03 100644
--- a/src/OpenFOAM/meshes/meshShapes/cellMatcher/prismMatcher.C
+++ b/src/OpenFOAM/meshes/meshShapes/cellMatcher/prismMatcher.C
@@ -26,6 +26,7 @@ License
 
 #include "prismMatcher.H"
 #include "primitiveMesh.H"
+#include "ListOps.H"
 
 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
 
@@ -363,7 +364,7 @@ bool Foam::prismMatcher::isA(const faceList& faces)
         faces,                      // all faces in mesh
         labelList(faces.size(), 0), // cell 0 is owner of all faces
         0,                          // cell label
-        makeIdentity(faces.size())  // faces of cell 0
+        identity(faces.size())      // faces of cell 0
     );
 }
 
diff --git a/src/OpenFOAM/meshes/meshShapes/cellMatcher/pyrMatcher.C b/src/OpenFOAM/meshes/meshShapes/cellMatcher/pyrMatcher.C
index dd8718a30cb..a48b7458cc6 100644
--- a/src/OpenFOAM/meshes/meshShapes/cellMatcher/pyrMatcher.C
+++ b/src/OpenFOAM/meshes/meshShapes/cellMatcher/pyrMatcher.C
@@ -29,6 +29,7 @@ License
 #include "primitiveMesh.H"
 #include "primitiveMesh.H"
 #include "cellModeller.H"
+#include "ListOps.H"
 
 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
 
@@ -286,7 +287,7 @@ bool Foam::pyrMatcher::isA(const faceList& faces)
         faces,                      // all faces in mesh
         labelList(faces.size(), 0), // cell 0 is owner of all faces
         0,                          // cell label
-        makeIdentity(faces.size())  // faces of cell 0
+        identity(faces.size())      // faces of cell 0
     );
 }
 
diff --git a/src/OpenFOAM/meshes/meshShapes/cellMatcher/tetMatcher.C b/src/OpenFOAM/meshes/meshShapes/cellMatcher/tetMatcher.C
index 911a01db258..cae492efa3e 100644
--- a/src/OpenFOAM/meshes/meshShapes/cellMatcher/tetMatcher.C
+++ b/src/OpenFOAM/meshes/meshShapes/cellMatcher/tetMatcher.C
@@ -29,6 +29,7 @@ License
 #include "primitiveMesh.H"
 #include "primitiveMesh.H"
 #include "cellModeller.H"
+#include "ListOps.H"
 
 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
 
@@ -39,7 +40,6 @@ const Foam::label Foam::tetMatcher::maxVertPerFace = 3;
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
-// Construct null
 Foam::tetMatcher::tetMatcher()
 :
     cellMatcher
@@ -238,7 +238,7 @@ bool Foam::tetMatcher::isA(const faceList& faces)
         faces,                      // all faces in mesh
         labelList(faces.size(), 0), // cell 0 is owner of all faces
         0,                          // cell label
-        makeIdentity(faces.size())  // faces of cell 0
+        identity(faces.size())      // faces of cell 0
     );
 }
 
diff --git a/src/OpenFOAM/meshes/meshShapes/cellMatcher/tetWedgeMatcher.C b/src/OpenFOAM/meshes/meshShapes/cellMatcher/tetWedgeMatcher.C
index af815d58736..804f9ee4d47 100644
--- a/src/OpenFOAM/meshes/meshShapes/cellMatcher/tetWedgeMatcher.C
+++ b/src/OpenFOAM/meshes/meshShapes/cellMatcher/tetWedgeMatcher.C
@@ -29,6 +29,7 @@ License
 #include "primitiveMesh.H"
 #include "primitiveMesh.H"
 #include "cellModeller.H"
+#include "ListOps.H"
 
 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
 
@@ -291,7 +292,7 @@ bool Foam::tetWedgeMatcher::isA(const faceList& faces)
         faces,                      // all faces in mesh
         labelList(faces.size(), 0), // cell 0 is owner of all faces
         0,                          // cell label
-        makeIdentity(faces.size())  // faces of cell 0
+        identity(faces.size())      // faces of cell 0
     );
 }
 
diff --git a/src/OpenFOAM/meshes/meshShapes/cellMatcher/wedgeMatcher.C b/src/OpenFOAM/meshes/meshShapes/cellMatcher/wedgeMatcher.C
index 97512ad427e..ee29cae3288 100644
--- a/src/OpenFOAM/meshes/meshShapes/cellMatcher/wedgeMatcher.C
+++ b/src/OpenFOAM/meshes/meshShapes/cellMatcher/wedgeMatcher.C
@@ -26,7 +26,7 @@ License
 
 #include "wedgeMatcher.H"
 #include "primitiveMesh.H"
-
+#include "ListOps.H"
 
 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
 
@@ -391,7 +391,7 @@ bool Foam::wedgeMatcher::isA(const faceList& faces)
         faces,                      // all faces in mesh
         labelList(faces.size(), 0), // cell 0 is owner of all faces
         0,                          // cell label
-        makeIdentity(faces.size())  // faces of cell 0
+        identity(faces.size())      // faces of cell 0
     );
 }
 
-- 
GitLab