From 0783bd28d1d517fb89f7a9f16d7407234289353d Mon Sep 17 00:00:00 2001
From: Mark Olesen <Mark.Olesen@esi-group.com>
Date: Mon, 5 Oct 2020 16:49:15 +0200
Subject: [PATCH] ENH: additional face constructors, cellModel methods

- support construct face from subset of labels.

- additional cellModel face() method to return a single face.

- reduce some allocations in cellModel centre/mag methods

STYLE: mark old cellModeller methods as compile-time deprecated

- deprecated in 2017, but not marked as such

STYLE: indentation, spacing in some headers
---
 .../containers/Bits/bitSet/PackedBoolList.H   |  3 +-
 src/OpenFOAM/meshes/meshShapes/cell/cell.C    | 23 +++----
 src/OpenFOAM/meshes/meshShapes/cell/cell.H    | 46 +++++++++----
 src/OpenFOAM/meshes/meshShapes/cell/cellI.H   | 35 ++++++++--
 .../meshShapes/cellMatcher/cellMatcher.H      | 20 ++----
 .../meshShapes/cellMatcher/cellMatcherI.H     |  3 -
 .../cellMatcher/degenerateMatcher.C           |  1 +
 .../cellMatcher/degenerateMatcher.H           | 10 +--
 .../meshShapes/cellMatcher/hexMatcher.C       |  8 +--
 .../meshShapes/cellMatcher/hexMatcher.H       |  5 +-
 .../meshShapes/cellMatcher/prismMatcher.C     |  6 +-
 .../meshShapes/cellMatcher/prismMatcher.H     |  5 +-
 .../meshShapes/cellMatcher/pyrMatcher.C       |  8 +--
 .../meshShapes/cellMatcher/pyrMatcher.H       |  5 +-
 .../meshShapes/cellMatcher/tetMatcher.C       |  9 +--
 .../meshShapes/cellMatcher/tetMatcher.H       |  5 +-
 .../meshShapes/cellMatcher/tetWedgeMatcher.C  |  8 +--
 .../meshShapes/cellMatcher/tetWedgeMatcher.H  |  5 +-
 .../meshShapes/cellMatcher/wedgeMatcher.C     |  8 +--
 .../meshShapes/cellMatcher/wedgeMatcher.H     |  5 +-
 .../meshes/meshShapes/cellModel/cellModel.C   | 66 ++++++-------------
 .../meshes/meshShapes/cellModel/cellModel.H   | 34 ++++++----
 .../meshes/meshShapes/cellModel/cellModelI.H  | 49 +++++++-------
 .../meshes/meshShapes/cellModel/cellModelIO.C |  1 +
 .../meshShapes/cellModel/cellModeller.H       | 12 ++--
 .../meshes/meshShapes/cellShape/cellShape.H   | 17 ++---
 .../meshShapes/cellShape/cellShapeEqual.C     |  3 -
 .../meshes/meshShapes/cellShape/cellShapeI.H  |  3 +-
 .../meshes/meshShapes/cellShape/cellShapeIO.C |  2 +-
 src/OpenFOAM/meshes/meshShapes/edge/edge.H    |  8 +--
 src/OpenFOAM/meshes/meshShapes/face/face.H    | 30 ++++++---
 src/OpenFOAM/meshes/meshShapes/face/faceI.H   | 25 +++++--
 .../meshShapes/labelledTri/labelledTri.H      |  5 +-
 .../meshes/meshShapes/tetCell/tetCell.H       |  3 +-
 .../meshes/meshShapes/triFace/triFace.H       |  5 +-
 .../polyMesh/polyMeshCheck/polyMeshTools.H    |  1 +
 .../primitiveMeshCheck/primitiveMeshTools.H   |  1 +
 .../primitiveShapes/line/linePoint2DRef.H     |  1 +
 .../primitiveShapes/line/linePointRef.H       |  2 +-
 .../meshes/primitiveShapes/pyramid/pyramid.H  |  7 +-
 .../pyramid}/pyramidPointFaceRef.H            |  1 +
 .../primitiveShapes/tetrahedron/tetPointRef.H |  1 +
 .../primitiveShapes/triangle/triPointRef.H    |  1 +
 .../ranges/scalarRange/scalarRange.H          |  1 +
 .../primitives/strings/parsing/parsing.H      |  1 +
 .../strings/wordRes/wordReListMatcher.H       |  3 +-
 src/conversion/ccm/common/ccmInternal.H       |  1 +
 src/conversion/ccm/reader/ccmBoundaryInfo.H   |  1 +
 .../ccm/reader/ccmInterfaceDefinitions.H      |  1 +
 src/conversion/ccm/reader/ccmSolutionTable.H  |  1 +
 src/conversion/ccm/writer/ccmWriter.H         |  1 +
 .../fvMeshSubsetProxy/meshSubsetHelper.H      |  5 +-
 .../coordinate/systems/coordinateSystems.H    |  1 +
 53 files changed, 262 insertions(+), 250 deletions(-)
 rename src/OpenFOAM/meshes/{meshShapes/cell => primitiveShapes/pyramid}/pyramidPointFaceRef.H (97%)

diff --git a/src/OpenFOAM/containers/Bits/bitSet/PackedBoolList.H b/src/OpenFOAM/containers/Bits/bitSet/PackedBoolList.H
index 2d8f5163ebe..801d2fb0ee6 100644
--- a/src/OpenFOAM/containers/Bits/bitSet/PackedBoolList.H
+++ b/src/OpenFOAM/containers/Bits/bitSet/PackedBoolList.H
@@ -8,8 +8,7 @@
     Copyright (C) 2018 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
-    This file is part of OpenFOAM, licensed under GNU General Public License
-    <http://www.gnu.org/licenses/>.
+    This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
 
 Typedef
     Foam::PackedBoolList
diff --git a/src/OpenFOAM/meshes/meshShapes/cell/cell.C b/src/OpenFOAM/meshes/meshShapes/cell/cell.C
index 484afafa077..33f6f71cf50 100644
--- a/src/OpenFOAM/meshes/meshShapes/cell/cell.C
+++ b/src/OpenFOAM/meshes/meshShapes/cell/cell.C
@@ -6,6 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2016 OpenFOAM Foundation
+    Copyright (C) 2020 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -32,17 +33,15 @@ License
 
 const char* const Foam::cell::typeName = "cell";
 
+
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
 Foam::labelList Foam::cell::labels(const faceUList& f) const
 {
-    // return the unordered list of vertex labels supporting the cell
-
-    // count the maximum size of all vertices
-    label maxVert = 0;
-
     const labelList& faces = *this;
 
+    // Count the maximum size of all vertices
+    label maxVert = 0;
     forAll(faces, facei)
     {
         maxVert += f[faces[facei]].size();
@@ -65,6 +64,7 @@ Foam::labelList Foam::cell::labels(const faceUList& f) const
     // go through the rest of the faces. For each vertex, check if the point is
     // already inserted (up to maxVert, which now carries the number of real
     // points. If not, add it at the end of the list.
+
     for (label facei = 1; facei < faces.size(); facei++)
     {
         const labelList& curFace = f[faces[facei]];
@@ -87,8 +87,7 @@ Foam::labelList Foam::cell::labels(const faceUList& f) const
             if (!found)
             {
                 p[maxVert] = curPoint;
-
-                maxVert++;
+                ++maxVert;
             }
         }
     }
@@ -121,11 +120,8 @@ Foam::pointField Foam::cell::points
 
 Foam::edgeList Foam::cell::edges(const faceUList& f) const
 {
-    // return the lisf of cell edges
-
     const labelList& curFaces = *this;
 
-    // create a list of edges
     label maxNoEdges = 0;
 
     forAll(curFaces, facei)
@@ -140,10 +136,8 @@ Foam::edgeList Foam::cell::edges(const faceUList& f) const
     {
         const edgeList curFaceEdges = f[curFaces[facei]].edges();
 
-        forAll(curFaceEdges, faceEdgeI)
+        for (const edge& curEdge : curFaceEdges)
         {
-            const edge& curEdge = curFaceEdges[faceEdgeI];
-
             bool edgeFound = false;
 
             for (label addedEdgeI = 0; addedEdgeI < nEdges; addedEdgeI++)
@@ -160,7 +154,7 @@ Foam::edgeList Foam::cell::edges(const faceUList& f) const
             {
                 // Add the new edge onto the list
                 allEdges[nEdges] = curEdge;
-                nEdges++;
+                ++nEdges;
             }
         }
     }
@@ -194,6 +188,7 @@ Foam::point Foam::cell::centre
 
     // first calculate the approximate cell centre as the average of all
     // face centres
+
     vector cEst = Zero;
     scalar sumArea = 0;
 
diff --git a/src/OpenFOAM/meshes/meshShapes/cell/cell.H b/src/OpenFOAM/meshes/meshShapes/cell/cell.H
index e1003795237..afedec85433 100644
--- a/src/OpenFOAM/meshes/meshShapes/cell/cell.H
+++ b/src/OpenFOAM/meshes/meshShapes/cell/cell.H
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011 OpenFOAM Foundation
-    Copyright (C) 2017 OpenCFD Ltd.
+    Copyright (C) 2017-2020 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -56,27 +56,37 @@ class cell
 :
     public labelList
 {
-
 public:
 
-    // Static data members
+    // Static Data Members
 
         static const char* const typeName;
 
 
     // Constructors
 
-        //- Construct null
-        inline cell();
+        //- Default construct
+        constexpr cell() noexcept = default;
 
         //- Construct given size, with invalid point labels (-1)
         inline explicit cell(const label sz);
 
-        //- Copy construct from list of labels
-        inline explicit cell(const labelUList& lst);
+        //- Copy construct from list of face labels
+        inline explicit cell(const labelUList& list);
+
+        //- Move construct from list of face labels
+        inline explicit cell(labelList&& list);
+
+        //- Copy construct from list of face labels
+        template<unsigned N>
+        inline explicit cell(const FixedList<label, N>& list);
 
-        //- Move construct from list of labels
-        inline explicit cell(labelList&& lst);
+        //- Copy construct from subset of face labels
+        inline cell(const labelUList& list, const labelUList& indices);
+
+        //- Copy construct from subset of face labels
+        template<unsigned N>
+        inline cell(const labelUList& list, const FixedList<label, N>& indices);
 
         //- Construct from Istream
         inline cell(Istream& is);
@@ -88,17 +98,17 @@ public:
         inline label nFaces() const;
 
         //- Return unordered list of cell vertices given the list of faces
-        labelList labels(const faceUList& f) const;
+        labelList labels(const faceUList& meshFaces) const;
 
         //- Return the cell vertices given the list of faces and mesh points
         pointField points
         (
-            const faceUList& f,
+            const faceUList& meshFaces,
             const UList<point>& meshPoints
         ) const;
 
         //- Return cell edges
-        edgeList edges(const faceUList& f) const;
+        edgeList edges(const faceUList& meshFaces) const;
 
         //- Return index of opposite face
         label opposingFaceLabel
@@ -124,10 +134,18 @@ public:
         // future.
 
         //- Returns cell centre
-        point centre(const UList<point>& p, const faceUList& f) const;
+        point centre
+        (
+            const UList<point>& meshPoints,
+            const faceUList& meshFaces
+        ) const;
 
         //- Returns cell volume
-        scalar mag(const UList<point>& p, const faceUList& f) const;
+        scalar mag
+        (
+            const UList<point>& meshPoints,
+            const faceUList& meshFaces
+        ) const;
 };
 
 
diff --git a/src/OpenFOAM/meshes/meshShapes/cell/cellI.H b/src/OpenFOAM/meshes/meshShapes/cell/cellI.H
index 50e9d3dd47f..56fe8947a61 100644
--- a/src/OpenFOAM/meshes/meshShapes/cell/cellI.H
+++ b/src/OpenFOAM/meshes/meshShapes/cell/cellI.H
@@ -6,6 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011 OpenFOAM Foundation
+    Copyright (C) 2020 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -27,25 +28,45 @@ License
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
-inline Foam::cell::cell()
+inline Foam::cell::cell(const label sz)
+:
+    labelList(sz, -1)
 {}
 
 
-inline Foam::cell::cell(const label sz)
+inline Foam::cell::cell(const labelUList& list)
 :
-    labelList(sz, -1)
+    labelList(list)
+{}
+
+
+template<unsigned N>
+inline Foam::cell::cell(const FixedList<label, N>& list)
+:
+    labelList(list)
+{}
+
+
+inline Foam::cell::cell(labelList&& list)
+:
+    labelList(std::move(list))
 {}
 
 
-inline Foam::cell::cell(const labelUList& lst)
+inline Foam::cell::cell(const labelUList& list, const labelUList& indices)
 :
-    labelList(lst)
+    labelList(list, indices)
 {}
 
 
-inline Foam::cell::cell(labelList&& lst)
+template<unsigned N>
+inline Foam::cell::cell
+(
+    const labelUList& list,
+    const FixedList<label, N>& indices
+)
 :
-    labelList(std::move(lst))
+    labelList(list, indices)
 {}
 
 
diff --git a/src/OpenFOAM/meshes/meshShapes/cellMatcher/cellMatcher.H b/src/OpenFOAM/meshes/meshShapes/cellMatcher/cellMatcher.H
index b837c78786a..178cf994705 100644
--- a/src/OpenFOAM/meshes/meshShapes/cellMatcher/cellMatcher.H
+++ b/src/OpenFOAM/meshes/meshShapes/cellMatcher/cellMatcher.H
@@ -80,8 +80,7 @@ SourceFiles
 #ifndef cellMatcher_H
 #define cellMatcher_H
 
-#include "labelList.H"
-#include "faceList.H"
+#include "cellModel.H"
 #include "Map.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@@ -89,11 +88,10 @@ SourceFiles
 namespace Foam
 {
 
-// Forward declaration of classes
-class primitiveMesh;
+// Forward Declarations
 class cell;
-class cellModel;
 class cellShape;
+class primitiveMesh;
 
 /*---------------------------------------------------------------------------*\
                          Class cellMatcher Declaration
@@ -103,7 +101,7 @@ class cellMatcher
 {
 protected:
 
-    // Static functions
+    // Static Functions
 
         //- Given start and end of edge generate unique key
         inline static label edgeKey
@@ -116,7 +114,8 @@ protected:
         //- Step along face either in righthand or lefthand direction
         inline static label nextVert(const label, const label, const bool);
 
-    // Protected data
+
+    // Protected Data
 
         // Map from mesh to local vertex numbering
         Map<label> localPoint_;
@@ -174,11 +173,6 @@ protected:
             const label localFacei
         ) const;
 
-
-private:
-
-    // Private Member Functions
-
         //- No copy construct
         cellMatcher(const cellMatcher&) = delete;
 
@@ -224,6 +218,7 @@ public:
 
             void write(Ostream& os) const;
 
+
         // Cell shape dependent
 
             virtual label nVertPerCell() const = 0;
@@ -271,7 +266,6 @@ public:
                 const label celli,
                 cellShape& shape
             ) = 0;
-
 };
 
 
diff --git a/src/OpenFOAM/meshes/meshShapes/cellMatcher/cellMatcherI.H b/src/OpenFOAM/meshes/meshShapes/cellMatcher/cellMatcherI.H
index ced5f1e02eb..2e968546b7d 100644
--- a/src/OpenFOAM/meshes/meshShapes/cellMatcher/cellMatcherI.H
+++ b/src/OpenFOAM/meshes/meshShapes/cellMatcher/cellMatcherI.H
@@ -25,9 +25,6 @@ License
 
 \*---------------------------------------------------------------------------*/
 
-#include "primitiveMesh.H"
-#include "cellModel.H"
-
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
 inline const Foam::Map<Foam::label>& Foam::cellMatcher::localPoint() const
diff --git a/src/OpenFOAM/meshes/meshShapes/cellMatcher/degenerateMatcher.C b/src/OpenFOAM/meshes/meshShapes/cellMatcher/degenerateMatcher.C
index 5ed5a632f9c..a95c64fde13 100644
--- a/src/OpenFOAM/meshes/meshShapes/cellMatcher/degenerateMatcher.C
+++ b/src/OpenFOAM/meshes/meshShapes/cellMatcher/degenerateMatcher.C
@@ -26,6 +26,7 @@ License
 \*---------------------------------------------------------------------------*/
 
 #include "degenerateMatcher.H"
+#include "primitiveMesh.H"
 #include "ListOps.H"
 
 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
diff --git a/src/OpenFOAM/meshes/meshShapes/cellMatcher/degenerateMatcher.H b/src/OpenFOAM/meshes/meshShapes/cellMatcher/degenerateMatcher.H
index 4cf14a5aea9..8cbe021e4a8 100644
--- a/src/OpenFOAM/meshes/meshShapes/cellMatcher/degenerateMatcher.H
+++ b/src/OpenFOAM/meshes/meshShapes/cellMatcher/degenerateMatcher.H
@@ -60,8 +60,7 @@ namespace Foam
 
 class degenerateMatcher
 {
-
-    // Static data members
+    // Static Data Members
 
         //- Matchers for all degenerate hex shapes
         static hexMatcher hex;
@@ -71,7 +70,8 @@ class degenerateMatcher
         static pyrMatcher pyr;
         static tetMatcher tet;
 
-    // Static functions
+
+    // Static Functions
 
         //- Recognize basic shape
         static cellShape match
@@ -84,13 +84,13 @@ class degenerateMatcher
 
 public:
 
-    // Static data members
+    // Static Functions
 
         //- Recognize shape given faces of a cell
         static cellShape match(const faceList& faces);
 
         //- Recognize given uncollapsed shape (usually hex) with duplicate
-        //  vertices. cellShape just used to extract faces.
+        //- vertices. cellShape just used to extract faces.
         static cellShape match(const cellShape& shape);
 
         //- Recognize shape given mesh and celli
diff --git a/src/OpenFOAM/meshes/meshShapes/cellMatcher/hexMatcher.C b/src/OpenFOAM/meshes/meshShapes/cellMatcher/hexMatcher.C
index fb99e1f3dd0..fc76b142b70 100644
--- a/src/OpenFOAM/meshes/meshShapes/cellMatcher/hexMatcher.C
+++ b/src/OpenFOAM/meshes/meshShapes/cellMatcher/hexMatcher.C
@@ -38,17 +38,11 @@ Foam::hexMatcher::hexMatcher()
         vertPerCell,
         facePerCell,
         maxVertPerFace,
-        "hex" // same as cellModel::modelNames[cellModel::HEX]
+        "hex" // == cellModel::modelNames[cellModel::HEX]
     )
 {}
 
 
-// * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
-
-Foam::hexMatcher::~hexMatcher()
-{}
-
-
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
 bool Foam::hexMatcher::matchShape
diff --git a/src/OpenFOAM/meshes/meshShapes/cellMatcher/hexMatcher.H b/src/OpenFOAM/meshes/meshShapes/cellMatcher/hexMatcher.H
index 6c3ae816649..04db020287d 100644
--- a/src/OpenFOAM/meshes/meshShapes/cellMatcher/hexMatcher.H
+++ b/src/OpenFOAM/meshes/meshShapes/cellMatcher/hexMatcher.H
@@ -76,11 +76,12 @@ public:
 
     // Constructors
 
-        //- Construct null
+        //- Default construct
         hexMatcher();
 
+
     //- Destructor
-    ~hexMatcher();
+    ~hexMatcher() = default;
 
 
     // Member Functions
diff --git a/src/OpenFOAM/meshes/meshShapes/cellMatcher/prismMatcher.C b/src/OpenFOAM/meshes/meshShapes/cellMatcher/prismMatcher.C
index 2c3f7f4c013..566d4ed5223 100644
--- a/src/OpenFOAM/meshes/meshShapes/cellMatcher/prismMatcher.C
+++ b/src/OpenFOAM/meshes/meshShapes/cellMatcher/prismMatcher.C
@@ -38,14 +38,10 @@ Foam::prismMatcher::prismMatcher()
         vertPerCell,
         facePerCell,
         maxVertPerFace,
-        "prism" // same as cellModel::modelNames[cellModel::PRISM]
+        "prism" // == cellModel::modelNames[cellModel::PRISM]
     )
 {}
 
-// * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
-
-Foam::prismMatcher::~prismMatcher()
-{}
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
diff --git a/src/OpenFOAM/meshes/meshShapes/cellMatcher/prismMatcher.H b/src/OpenFOAM/meshes/meshShapes/cellMatcher/prismMatcher.H
index bfebb03de6a..fae45ed7d65 100644
--- a/src/OpenFOAM/meshes/meshShapes/cellMatcher/prismMatcher.H
+++ b/src/OpenFOAM/meshes/meshShapes/cellMatcher/prismMatcher.H
@@ -76,11 +76,12 @@ public:
 
     // Constructors
 
-        //- Construct
+        //- Default construct
         prismMatcher();
 
+
     //- Destructor
-    ~prismMatcher();
+    ~prismMatcher() = default;
 
 
     // Member Functions
diff --git a/src/OpenFOAM/meshes/meshShapes/cellMatcher/pyrMatcher.C b/src/OpenFOAM/meshes/meshShapes/cellMatcher/pyrMatcher.C
index 8b4a8d599a1..6667d5413ac 100644
--- a/src/OpenFOAM/meshes/meshShapes/cellMatcher/pyrMatcher.C
+++ b/src/OpenFOAM/meshes/meshShapes/cellMatcher/pyrMatcher.C
@@ -40,17 +40,11 @@ Foam::pyrMatcher::pyrMatcher()
         vertPerCell,
         facePerCell,
         maxVertPerFace,
-        "pyr" // same as cellModel::modelNames[cellModel::PYR]
+        "pyr" // == cellModel::modelNames[cellModel::PYR]
     )
 {}
 
 
-// * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
-
-Foam::pyrMatcher::~pyrMatcher()
-{}
-
-
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
 bool Foam::pyrMatcher::matchShape
diff --git a/src/OpenFOAM/meshes/meshShapes/cellMatcher/pyrMatcher.H b/src/OpenFOAM/meshes/meshShapes/cellMatcher/pyrMatcher.H
index 6f2fb84f777..908dd98bfc2 100644
--- a/src/OpenFOAM/meshes/meshShapes/cellMatcher/pyrMatcher.H
+++ b/src/OpenFOAM/meshes/meshShapes/cellMatcher/pyrMatcher.H
@@ -76,11 +76,12 @@ public:
 
     // Constructors
 
-        //- Construct null
+        //- Default construct
         pyrMatcher();
 
+
     //- Destructor
-    ~pyrMatcher();
+    ~pyrMatcher() = default;
 
 
     // Member Functions
diff --git a/src/OpenFOAM/meshes/meshShapes/cellMatcher/tetMatcher.C b/src/OpenFOAM/meshes/meshShapes/cellMatcher/tetMatcher.C
index 5208fafd121..2d59c197837 100644
--- a/src/OpenFOAM/meshes/meshShapes/cellMatcher/tetMatcher.C
+++ b/src/OpenFOAM/meshes/meshShapes/cellMatcher/tetMatcher.C
@@ -40,20 +40,13 @@ Foam::tetMatcher::tetMatcher()
         vertPerCell,
         facePerCell,
         maxVertPerFace,
-        "tet" // same as cellModel::modelNames[cellModel::TET]
+        "tet" // == cellModel::modelNames[cellModel::TET]
     )
 {}
 
 
-// * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
-
-Foam::tetMatcher::~tetMatcher()
-{}
-
-
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
-
 bool Foam::tetMatcher::matchShape
 (
     const bool checkOnly,
diff --git a/src/OpenFOAM/meshes/meshShapes/cellMatcher/tetMatcher.H b/src/OpenFOAM/meshes/meshShapes/cellMatcher/tetMatcher.H
index d00a2037839..f93c2042f39 100644
--- a/src/OpenFOAM/meshes/meshShapes/cellMatcher/tetMatcher.H
+++ b/src/OpenFOAM/meshes/meshShapes/cellMatcher/tetMatcher.H
@@ -76,11 +76,12 @@ public:
 
     // Constructors
 
-        //- Construct null
+        //- Default construct
         tetMatcher();
 
+
     //- Destructor
-    ~tetMatcher();
+    ~tetMatcher() = default;
 
 
     // Member Functions
diff --git a/src/OpenFOAM/meshes/meshShapes/cellMatcher/tetWedgeMatcher.C b/src/OpenFOAM/meshes/meshShapes/cellMatcher/tetWedgeMatcher.C
index babc274f9e2..e85f543e953 100644
--- a/src/OpenFOAM/meshes/meshShapes/cellMatcher/tetWedgeMatcher.C
+++ b/src/OpenFOAM/meshes/meshShapes/cellMatcher/tetWedgeMatcher.C
@@ -40,17 +40,11 @@ Foam::tetWedgeMatcher::tetWedgeMatcher()
         vertPerCell,
         facePerCell,
         maxVertPerFace,
-        "tetWedge" // same as cellModel::modelNames[cellModel::TETWEDGE]
+        "tetWedge" // == cellModel::modelNames[cellModel::TETWEDGE]
     )
 {}
 
 
-// * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
-
-Foam::tetWedgeMatcher::~tetWedgeMatcher()
-{}
-
-
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
 bool Foam::tetWedgeMatcher::matchShape
diff --git a/src/OpenFOAM/meshes/meshShapes/cellMatcher/tetWedgeMatcher.H b/src/OpenFOAM/meshes/meshShapes/cellMatcher/tetWedgeMatcher.H
index 58791358f96..3322ce373a8 100644
--- a/src/OpenFOAM/meshes/meshShapes/cellMatcher/tetWedgeMatcher.H
+++ b/src/OpenFOAM/meshes/meshShapes/cellMatcher/tetWedgeMatcher.H
@@ -76,11 +76,12 @@ public:
 
     // Constructors
 
-        //- Construct null
+        //- Default construct
         tetWedgeMatcher();
 
+
     //- Destructor
-    ~tetWedgeMatcher();
+    ~tetWedgeMatcher() = default;
 
 
     // Member Functions
diff --git a/src/OpenFOAM/meshes/meshShapes/cellMatcher/wedgeMatcher.C b/src/OpenFOAM/meshes/meshShapes/cellMatcher/wedgeMatcher.C
index 1304060efc0..e3c76909d03 100644
--- a/src/OpenFOAM/meshes/meshShapes/cellMatcher/wedgeMatcher.C
+++ b/src/OpenFOAM/meshes/meshShapes/cellMatcher/wedgeMatcher.C
@@ -38,17 +38,11 @@ Foam::wedgeMatcher::wedgeMatcher()
         vertPerCell,
         facePerCell,
         maxVertPerFace,
-        "wedge" // same as cellModel::modelNames[cellModel::WEDGE]
+        "wedge" // == cellModel::modelNames[cellModel::WEDGE]
     )
 {}
 
 
-// * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
-
-Foam::wedgeMatcher::~wedgeMatcher()
-{}
-
-
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
 bool Foam::wedgeMatcher::matchShape
diff --git a/src/OpenFOAM/meshes/meshShapes/cellMatcher/wedgeMatcher.H b/src/OpenFOAM/meshes/meshShapes/cellMatcher/wedgeMatcher.H
index 12c186f1d0b..376de912056 100644
--- a/src/OpenFOAM/meshes/meshShapes/cellMatcher/wedgeMatcher.H
+++ b/src/OpenFOAM/meshes/meshShapes/cellMatcher/wedgeMatcher.H
@@ -76,11 +76,12 @@ public:
 
     // Constructors
 
-        //- Construct null
+        //- Default construct
         wedgeMatcher();
 
+
     //- Destructor
-    ~wedgeMatcher();
+    ~wedgeMatcher() = default;
 
 
     // Member Functions
diff --git a/src/OpenFOAM/meshes/meshShapes/cellModel/cellModel.C b/src/OpenFOAM/meshes/meshShapes/cellModel/cellModel.C
index b72d13a63b7..926b07abde5 100644
--- a/src/OpenFOAM/meshes/meshShapes/cellModel/cellModel.C
+++ b/src/OpenFOAM/meshes/meshShapes/cellModel/cellModel.C
@@ -27,7 +27,7 @@ License
 \*---------------------------------------------------------------------------*/
 
 #include "cellModel.H"
-#include "pyramid.H"
+#include "pyramidPointFaceRef.H"
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
@@ -37,51 +37,37 @@ Foam::vector Foam::cellModel::centre
     const UList<point>& points
 ) const
 {
-    // Estimate centre of cell
+    // Estimate cell centre by averaging the cell points
     vector cEst = Zero;
-
-    // Sum the points indicated by the label list
-    forAll(pointLabels, i)
+    for (const label pointi : pointLabels)
     {
-        cEst += points[pointLabels[i]];
+        cEst += points[pointi];
     }
-
-    // Average by dividing by the number summed over.
     cEst /= scalar(pointLabels.size());
 
 
     // Calculate the centre by breaking the cell into pyramids and
     // volume-weighted averaging their centres
-    scalar sumV = 0.0;
-    vector sumVc = Zero;
 
-    const faceList cellFaces = faces(pointLabels);
+    scalar sumV = 0;
+    vector sumVc = Zero;
 
-    forAll(cellFaces, i)
+    forAll(faces_, facei)
     {
-        const face& curFace = cellFaces[i];
+        const Foam::face f(pointLabels, faces_[facei]);
 
-        scalar pyrVol =
-            pyramid<point, const point&, const face&>
-            (
-                curFace,
-                cEst
-            ).mag(points);
+        const scalar pyrVol = pyramidPointFaceRef(f, cEst).mag(points);
 
         if (pyrVol > SMALL)
         {
             WarningInFunction
                 << "zero or negative pyramid volume: " << -pyrVol
-                << " for face " << i
+                << " for face " << facei
                 << endl;
         }
 
-        sumVc -=
-            pyrVol
-           *pyramid<point, const point&, const face&>(curFace, cEst)
-           .centre(points);
-
         sumV -= pyrVol;
+        sumVc -= pyrVol * pyramidPointFaceRef(f, cEst).centre(points);
     }
 
     return sumVc/(sumV + VSMALL);
@@ -94,16 +80,12 @@ Foam::scalar Foam::cellModel::mag
     const UList<point>& points
 ) const
 {
-    // Estimate centre of cell
+    // Estimate cell centre by averaging the cell points
     vector cEst = Zero;
-
-    // Sum the points indicated by the label list
-    forAll(pointLabels, i)
+    for (const label pointi : pointLabels)
     {
-        cEst += points[pointLabels[i]];
+        cEst += points[pointi];
     }
-
-    // Average by dividing by the number summed over.
     cEst /= scalar(pointLabels.size());
 
 
@@ -111,33 +93,27 @@ Foam::scalar Foam::cellModel::mag
     // The sign change is because the faces point outwards
     // and a pyramid is constructed from an inward pointing face
     // and the base centre-apex vector
-    scalar v = 0;
 
-    const faceList cellFaces = faces(pointLabels);
+    scalar sumV = 0;
 
-    forAll(cellFaces, i)
+    forAll(faces_, facei)
     {
-        const face& curFace =cellFaces[i];
+        const Foam::face f(pointLabels, faces_[facei]);
 
-        scalar pyrVol =
-            pyramid<point, const point&, const face&>
-            (
-                curFace,
-                cEst
-            ).mag(points);
+        const scalar pyrVol = pyramidPointFaceRef(f, cEst).mag(points);
 
         if (pyrVol > SMALL)
         {
             WarningInFunction
                 << "zero or negative pyramid volume: " << -pyrVol
-                << " for face " << i
+                << " for face " << facei
                 << endl;
         }
 
-        v -= pyrVol;
+        sumV -= pyrVol;
     }
 
-    return v;
+    return sumV;
 }
 
 
diff --git a/src/OpenFOAM/meshes/meshShapes/cellModel/cellModel.H b/src/OpenFOAM/meshes/meshShapes/cellModel/cellModel.H
index 6e677281065..747ae7dd276 100644
--- a/src/OpenFOAM/meshes/meshShapes/cellModel/cellModel.H
+++ b/src/OpenFOAM/meshes/meshShapes/cellModel/cellModel.H
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2015 OpenFOAM Foundation
-    Copyright (C) 2017 OpenCFD Ltd.
+    Copyright (C) 2017-2020 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -62,7 +62,7 @@ SourceFiles
 namespace Foam
 {
 
-// Forward declarations
+// Forward Declarations
 class cellModel;
 Ostream& operator<<(Ostream& os, const cellModel& cm);
 
@@ -93,7 +93,7 @@ public:
         static const Enum<modelType> modelNames;
 
 
-    // Lookup Static Models
+    // Lookup Methods
 
         //- Look up pointer to cellModel by enumeration, or nullptr on failure.
         static const cellModel* ptr(const modelType model);
@@ -155,9 +155,9 @@ public:
     // Constructors
 
         //- Construct from Istream
-        cellModel(Istream& is);
+        explicit cellModel(Istream& is);
 
-        //- Return a new cellModel on free-store created from Istream
+        //- Return a new cellModel created from Istream
         static autoPtr<cellModel> New(Istream& is)
         {
             return autoPtr<cellModel>::New(is);
@@ -170,7 +170,7 @@ public:
         }
 
 
-    // Member functions
+    // Member Functions
 
         //- Return model name
         inline const word& name() const;
@@ -193,12 +193,19 @@ public:
         //- Return a raw list of model faces
         inline const faceList& modelFaces() const;
 
-        //- Return list of edges
+        //- Return list of cell edges
         inline edgeList edges(const labelUList& pointLabels) const;
 
-        //- Return list of faces
+        //- Return list of cell faces
         inline faceList faces(const labelUList& pointLabels) const;
 
+        //- Return the cell face for specified model face
+        inline Foam::face face
+        (
+            const label modelFacei,
+            const labelUList& pointLabels
+        ) const;
+
 
         //- Vector centroid
         vector centre
@@ -221,7 +228,7 @@ public:
             return *this;
         }
 
-        //- WriteData member function required by regIOobject
+        //- The writeData member function required by regIOobject
         bool writeData(Ostream& os) const
         {
             os << *this;
@@ -229,20 +236,19 @@ public:
         }
 
 
-    // Ostream operator
-
-       friend Ostream& operator<<(Ostream& os, const cellModel& cm);
+    // Ostream Operator
 
+        friend Ostream& operator<<(Ostream& os, const cellModel& cm);
 };
 
 
-// Ostream operators
+// Ostream Operators
 
 template<>
 Ostream& operator<<(Ostream& os, const InfoProxy<cellModel>& ip);
 
 
-// Global operators
+// Global Operators
 
 //- Equality: true when model pointers are identical
 inline bool operator==(const cellModel& lhs, const cellModel& rhs);
diff --git a/src/OpenFOAM/meshes/meshShapes/cellModel/cellModelI.H b/src/OpenFOAM/meshes/meshShapes/cellModel/cellModelI.H
index 15281c736fc..cc5ba490721 100644
--- a/src/OpenFOAM/meshes/meshShapes/cellModel/cellModelI.H
+++ b/src/OpenFOAM/meshes/meshShapes/cellModel/cellModelI.H
@@ -6,6 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2016 OpenFOAM Foundation
+    Copyright (C) 2020 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -69,55 +70,53 @@ inline const Foam::faceList& Foam::cellModel::modelFaces() const
 }
 
 
-//  Return the faces of a cellModel by untangling the geometry
-//  supplied in terms of the face labels
 inline Foam::edgeList Foam::cellModel::edges
 (
     const labelUList& pointLabels
 ) const
 {
-    edgeList e(edges_.size());
+    edgeList theEdges(edges_.size());
 
-    // Translate model labels into global labels
     forAll(edges_, edgei)
     {
-         e[edgei] =
-             edge
-             (
-                 pointLabels[edges_[edgei].start()],
-                 pointLabels[edges_[edgei].end()]
-             );
+        // From model labels to global labels
+        theEdges[edgei] =
+            edge
+            (
+                pointLabels[edges_[edgei].first()],
+                pointLabels[edges_[edgei].second()]
+            );
     }
 
-    return e;
+    return theEdges;
 }
 
 
-//  Return the faces of a cellModel by untangling the geometry
-//  supplied in terms of the face labels
 inline Foam::faceList Foam::cellModel::faces
 (
     const labelUList& pointLabels
 ) const
 {
-    faceList f(faces_.size());
+    faceList theFaces(faces_.size());
 
-    // Translate model labels into global labels
     forAll(faces_, facei)
     {
-         const labelList& curModelLabels = faces_[facei];
-
-         face& curFace = f[facei];
+        // From model labels to global labels
+        theFaces[facei] = Foam::face(pointLabels, faces_[facei]);
+    }
 
-         curFace.setSize(curModelLabels.size());
+    return theFaces;
+}
 
-         forAll(curModelLabels, labeli)
-         {
-             curFace[labeli] = pointLabels[curModelLabels[labeli]];
-         }
-    }
 
-    return f;
+inline Foam::face Foam::cellModel::face
+(
+    const label modelFacei,
+    const labelUList& pointLabels
+) const
+{
+    // From model labels to global labels
+    return Foam::face(pointLabels, faces_[modelFacei]);
 }
 
 
diff --git a/src/OpenFOAM/meshes/meshShapes/cellModel/cellModelIO.C b/src/OpenFOAM/meshes/meshShapes/cellModel/cellModelIO.C
index bb622460783..464b12ce352 100644
--- a/src/OpenFOAM/meshes/meshShapes/cellModel/cellModelIO.C
+++ b/src/OpenFOAM/meshes/meshShapes/cellModel/cellModelIO.C
@@ -6,6 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2015 OpenFOAM Foundation
+    Copyright (C) 2018 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
diff --git a/src/OpenFOAM/meshes/meshShapes/cellModel/cellModeller.H b/src/OpenFOAM/meshes/meshShapes/cellModel/cellModeller.H
index c73b1710837..b5eb5c84c80 100644
--- a/src/OpenFOAM/meshes/meshShapes/cellModel/cellModeller.H
+++ b/src/OpenFOAM/meshes/meshShapes/cellModel/cellModeller.H
@@ -5,11 +5,10 @@
     \\  /    A nd           | www.openfoam.com
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
-    Copyright (C) 2017 OpenCFD Ltd.
+    Copyright (C) 2017-2020 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
-    This file is part of OpenFOAM, licensed under GNU General Public License
-    <http://www.gnu.org/licenses/>.
+    This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
 
 Namespace
     Foam::cellModeller
@@ -20,6 +19,7 @@ Description
     Superseded (NOV-2017) by cellModel methods.
 
 \*---------------------------------------------------------------------------*/
+
 #ifndef cellModeller_H
 #define cellModeller_H
 
@@ -34,14 +34,16 @@ namespace cellModeller
 
     //- Deprecated(2017-11) equivalent to cellModel::ptr static method.
     //  \deprecated(2017-11) use cellModel::ptr instead
-    inline const cellModel* lookup(const word& modelName)
+    FOAM_DEPRECATED_FOR(2017-11, "cellModel::ptr() static method")
+    const cellModel* lookup(const word& modelName)
     {
         return cellModel::ptr(modelName);
     }
 
     //- Deprecated(2017-11) equivalent to cellModel::ptr static method.
     //  \deprecated(2017-11) use cellModel::ptr instead
-    inline const cellModel* lookup(const label modelIndex)
+    FOAM_DEPRECATED_FOR(2017-11, "cellModel::ptr() static method")
+    const cellModel* lookup(const label modelIndex)
     {
         return cellModel::ptr(modelIndex);
     }
diff --git a/src/OpenFOAM/meshes/meshShapes/cellShape/cellShape.H b/src/OpenFOAM/meshes/meshShapes/cellShape/cellShape.H
index fe674a3274e..29c59981f72 100644
--- a/src/OpenFOAM/meshes/meshShapes/cellShape/cellShape.H
+++ b/src/OpenFOAM/meshes/meshShapes/cellShape/cellShape.H
@@ -54,11 +54,8 @@ SourceFiles
 namespace Foam
 {
 
-// Forward declaration of classes
+// Forward Declarations
 class cell;
-
-// Forward declaration of friend functions and operators
-
 class cellShape;
 bool operator==(const cellShape& a, const cellShape& b);
 Istream& operator>>(Istream& is, cellShape& s);
@@ -73,7 +70,7 @@ class cellShape
 :
     public labelList
 {
-    // Private data
+    // Private Data
 
         //- Access to the cellShape's model
         const cellModel *m;
@@ -83,10 +80,10 @@ public:
 
     // Constructors
 
-        //- Construct null
-        inline cellShape();
+        //- Default construct
+        inline constexpr cellShape() noexcept;
 
-        //- Construct from components
+        //- Copy construct from components
         inline cellShape
         (
             const cellModel& model,
@@ -94,7 +91,7 @@ public:
             const bool doCollapse = false
         );
 
-        //- Construct from components
+        //- Move construct from components
         inline cellShape
         (
             const cellModel& model,
@@ -102,7 +99,7 @@ public:
             const bool doCollapse = false
         );
 
-        //- Construct from components
+        //- Copy construct from components
         inline cellShape
         (
             const word& modelName,
diff --git a/src/OpenFOAM/meshes/meshShapes/cellShape/cellShapeEqual.C b/src/OpenFOAM/meshes/meshShapes/cellShape/cellShapeEqual.C
index 8fd430f6706..9c9c021436d 100644
--- a/src/OpenFOAM/meshes/meshShapes/cellShape/cellShapeEqual.C
+++ b/src/OpenFOAM/meshes/meshShapes/cellShape/cellShapeEqual.C
@@ -23,9 +23,6 @@ License
     You should have received a copy of the GNU General Public License
     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 
-Description
-    Equality operator for cellShape class
-
 \*---------------------------------------------------------------------------*/
 
 #include "cellShape.H"
diff --git a/src/OpenFOAM/meshes/meshShapes/cellShape/cellShapeI.H b/src/OpenFOAM/meshes/meshShapes/cellShape/cellShapeI.H
index 30ca288e8ff..3f8273c6a24 100644
--- a/src/OpenFOAM/meshes/meshShapes/cellShape/cellShapeI.H
+++ b/src/OpenFOAM/meshes/meshShapes/cellShape/cellShapeI.H
@@ -31,8 +31,9 @@ License
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
-inline Foam::cellShape::cellShape()
+inline constexpr Foam::cellShape::cellShape() noexcept
 :
+    labelList(),
     m(nullptr)
 {}
 
diff --git a/src/OpenFOAM/meshes/meshShapes/cellShape/cellShapeIO.C b/src/OpenFOAM/meshes/meshShapes/cellShape/cellShapeIO.C
index ffc6abb872b..d9d92114f88 100644
--- a/src/OpenFOAM/meshes/meshShapes/cellShape/cellShapeIO.C
+++ b/src/OpenFOAM/meshes/meshShapes/cellShape/cellShapeIO.C
@@ -72,7 +72,7 @@ Foam::Istream& Foam::operator>>(Istream& is, cellShape& s)
     }
 
     // Check that a model was found
-    if (!s.m)
+    if (s.m == nullptr)
     {
         FatalIOErrorInFunction(is)
             << "CellShape has unknown model " << t.info()
diff --git a/src/OpenFOAM/meshes/meshShapes/edge/edge.H b/src/OpenFOAM/meshes/meshShapes/edge/edge.H
index 4c824e771fb..720788b992e 100644
--- a/src/OpenFOAM/meshes/meshShapes/edge/edge.H
+++ b/src/OpenFOAM/meshes/meshShapes/edge/edge.H
@@ -74,16 +74,16 @@ public:
 
     // Constructors
 
-        //- Construct null with invalid point labels (-1)
+        //- Default construct, with invalid point labels (-1)
         inline edge();
 
         //- Construct from two point labels
         inline edge(const label from, const label to);
 
-        //- Construct from pair of labels
+        //- Construct from pair of point labels
         inline edge(const labelPair& pair);
 
-        //- Construct from list
+        //- Construct from list of point labels
         inline edge(const FixedList<label, 2>& list);
 
         //- Construct from two point labels, sorted with first less-than second
@@ -92,7 +92,7 @@ public:
         //- Construct from list, sorted with first less-than second
         inline edge(const FixedList<label, 2>& list, const bool doSort);
 
-        //- Copy construct from a subset of the input
+        //- Copy construct from a subset of point labels
         inline edge
         (
             const UList<label>& list,
diff --git a/src/OpenFOAM/meshes/meshShapes/face/face.H b/src/OpenFOAM/meshes/meshShapes/face/face.H
index d1556e935de..668d7781ce1 100644
--- a/src/OpenFOAM/meshes/meshShapes/face/face.H
+++ b/src/OpenFOAM/meshes/meshShapes/face/face.H
@@ -42,6 +42,7 @@ SourceFiles
     faceTemplates.C
 
 \*---------------------------------------------------------------------------*/
+
 #ifndef face_H
 #define face_H
 
@@ -63,7 +64,6 @@ namespace Foam
 // Forward Declarations
 class face;
 class triFace;
-
 template<class T, int SizeMin> class DynamicList;
 
 /*---------------------------------------------------------------------------*\
@@ -136,6 +136,7 @@ public:
         EDGE    // Close to edge
     };
 
+
     // Static Data Members
 
         static const char* const typeName;
@@ -144,23 +145,30 @@ public:
     // Constructors
 
         //- Default construct
-        face() = default;
+        constexpr face() noexcept = default;
 
         //- Construct given size, with invalid point labels (-1)
         inline explicit face(const label sz);
 
-        //- Copy construct from list of labels
+        //- Copy construct from list of point labels
         inline explicit face(const labelUList& list);
 
-        //- Copy construct from list of labels
+        //- Move construct from list of point labels
+        inline explicit face(labelList&& list);
+
+        //- Copy construct from an initializer list of point labels
+        inline explicit face(std::initializer_list<label> list);
+
+        //- Copy construct from list of point labels
         template<unsigned N>
         inline explicit face(const FixedList<label, N>& list);
 
-        //- Copy construct from an initializer list of labels
-        inline explicit face(std::initializer_list<label> list);
+        //- Copy construct from subset of point labels
+        inline face(const labelUList& list, const labelUList& indices);
 
-        //- Move construct from list of labels
-        inline explicit face(labelList&& list);
+        //- Copy construct from subset of point labels
+        template<unsigned N>
+        inline face(const labelUList& list, const FixedList<label, N>& indices);
 
         //- Copy construct from triFace
         face(const triFace& f);
@@ -214,6 +222,7 @@ public:
         //  The starting points of the original and reverse face are identical.
         face reverseFace() const;
 
+
         // Navigation through face vertices
 
         //- Return true if the point label is found in face.
@@ -238,7 +247,7 @@ public:
         ) const;
 
         //- Return the inertia tensor, with optional reference
-        //  point and density specification
+        //- point and density specification
         tensor inertia
         (
             const UList<point>& p,
@@ -247,7 +256,7 @@ public:
         ) const;
 
         //- Return potential intersection with face with a ray starting
-        //  at p, direction n (does not need to be normalized)
+        //- at p, direction n (does not need to be normalized)
         //  Does face-centre decomposition and returns triangle intersection
         //  point closest to p. Face-centre is calculated from point average.
         //  For a hit, the distance is signed.  Positive number
@@ -450,6 +459,7 @@ struct offsetOp<face>
 //- Deprecated(2017-04) find the longest edge on a face.
 //- Face point labels index into pts.
 //  \deprecated(2017-04) use class method instead
+FOAM_DEPRECATED_FOR(2017-04, "use face::longestEdge() method")
 label longestEdge(const face& f, const UList<point>& pts);
 
 
diff --git a/src/OpenFOAM/meshes/meshShapes/face/faceI.H b/src/OpenFOAM/meshes/meshShapes/face/faceI.H
index fa3f26a23ae..631d8cad45b 100644
--- a/src/OpenFOAM/meshes/meshShapes/face/faceI.H
+++ b/src/OpenFOAM/meshes/meshShapes/face/faceI.H
@@ -54,6 +54,18 @@ inline Foam::face::face(const labelUList& list)
 {}
 
 
+inline Foam::face::face(labelList&& list)
+:
+    labelList(std::move(list))
+{}
+
+
+inline Foam::face::face(std::initializer_list<label> list)
+:
+    labelList(list)
+{}
+
+
 template<unsigned N>
 inline Foam::face::face(const FixedList<label, N>& list)
 :
@@ -61,15 +73,20 @@ inline Foam::face::face(const FixedList<label, N>& list)
 {}
 
 
-inline Foam::face::face(std::initializer_list<label> list)
+inline Foam::face::face(const labelUList& list, const labelUList& indices)
 :
-    labelList(list)
+    labelList(list, indices)
 {}
 
 
-inline Foam::face::face(labelList&& list)
+template<unsigned N>
+inline Foam::face::face
+(
+    const labelUList& list,
+    const FixedList<label, N>& indices
+)
 :
-    labelList(std::move(list))
+    labelList(list, indices)
 {}
 
 
diff --git a/src/OpenFOAM/meshes/meshShapes/labelledTri/labelledTri.H b/src/OpenFOAM/meshes/meshShapes/labelledTri/labelledTri.H
index 85e0d50caba..039ef49bddf 100644
--- a/src/OpenFOAM/meshes/meshShapes/labelledTri/labelledTri.H
+++ b/src/OpenFOAM/meshes/meshShapes/labelledTri/labelledTri.H
@@ -51,7 +51,6 @@ class labelledTri;
 Istream& operator>>(Istream&, labelledTri&);
 Ostream& operator<<(Ostream&, const labelledTri&);
 
-
 /*---------------------------------------------------------------------------*\
                            Class labelledTri Declaration
 \*---------------------------------------------------------------------------*/
@@ -60,7 +59,7 @@ class labelledTri
 :
     public triFace
 {
-    // Private data
+    // Private Data
 
         label region_;
 
@@ -75,7 +74,7 @@ public:
 
     // Constructors
 
-        //- Construct null with invalid point labels and region (-1).
+        //- Default construct, with invalid point labels and region (-1).
         inline labelledTri();
 
         //- Construct from triFace and region label.
diff --git a/src/OpenFOAM/meshes/meshShapes/tetCell/tetCell.H b/src/OpenFOAM/meshes/meshShapes/tetCell/tetCell.H
index b364b42126a..93a1f408af3 100644
--- a/src/OpenFOAM/meshes/meshShapes/tetCell/tetCell.H
+++ b/src/OpenFOAM/meshes/meshShapes/tetCell/tetCell.H
@@ -64,7 +64,6 @@ class tetCell
 :
     public FixedList<label, 4>
 {
-
 public:
 
     // Constructors
@@ -87,7 +86,7 @@ public:
         //- Construct from FixedList of four point labels
         inline tetCell(const FixedList<label, 4>& list);
 
-        //- Copy construct from a subset of the input list
+        //- Copy construct from a subset of point labels
         inline tetCell
         (
             const labelUList& list,
diff --git a/src/OpenFOAM/meshes/meshShapes/triFace/triFace.H b/src/OpenFOAM/meshes/meshShapes/triFace/triFace.H
index 6bfd6bfedb8..af08fc4a48f 100644
--- a/src/OpenFOAM/meshes/meshShapes/triFace/triFace.H
+++ b/src/OpenFOAM/meshes/meshShapes/triFace/triFace.H
@@ -63,7 +63,6 @@ class triFace;
 inline bool operator==(const triFace& a, const triFace& b);
 inline bool operator!=(const triFace& a, const triFace& b);
 
-
 /*---------------------------------------------------------------------------*\
                           Class triFace Declaration
 \*---------------------------------------------------------------------------*/
@@ -76,7 +75,7 @@ public:
 
     // Constructors
 
-        //- Construct null with invalid point labels (-1)
+        //- Default construct, with invalid point labels (-1)
         inline triFace();
 
         //- Construct from three point labels
@@ -93,7 +92,7 @@ public:
         //- Copy construct from a list of three point labels.
         inline explicit triFace(const labelUList& list);
 
-        //- Copy construct from a subset of the input
+        //- Copy construct from a subset of point labels
         inline triFace
         (
             const labelUList& list,
diff --git a/src/OpenFOAM/meshes/polyMesh/polyMeshCheck/polyMeshTools.H b/src/OpenFOAM/meshes/polyMesh/polyMeshCheck/polyMeshTools.H
index 1e93bcb7ab8..0624c07f9b2 100644
--- a/src/OpenFOAM/meshes/polyMesh/polyMeshCheck/polyMeshTools.H
+++ b/src/OpenFOAM/meshes/polyMesh/polyMeshCheck/polyMeshTools.H
@@ -34,6 +34,7 @@ SourceFiles
     polyMeshTools.C
 
 \*---------------------------------------------------------------------------*/
+
 #ifndef polyMeshTools_H
 #define polyMeshTools_H
 
diff --git a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCheck/primitiveMeshTools.H b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCheck/primitiveMeshTools.H
index 4b108798b39..9803acac367 100644
--- a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCheck/primitiveMeshTools.H
+++ b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCheck/primitiveMeshTools.H
@@ -34,6 +34,7 @@ SourceFiles
     primitiveMeshTools.C
 
 \*---------------------------------------------------------------------------*/
+
 #ifndef primitiveMeshTools_H
 #define primitiveMeshTools_H
 
diff --git a/src/OpenFOAM/meshes/primitiveShapes/line/linePoint2DRef.H b/src/OpenFOAM/meshes/primitiveShapes/line/linePoint2DRef.H
index 09490747d9c..5422df65c0c 100644
--- a/src/OpenFOAM/meshes/primitiveShapes/line/linePoint2DRef.H
+++ b/src/OpenFOAM/meshes/primitiveShapes/line/linePoint2DRef.H
@@ -27,6 +27,7 @@ Typedef
     Foam::linePoint2DRef
 
 Description
+    A line using referred 2D points
 
 \*---------------------------------------------------------------------------*/
 
diff --git a/src/OpenFOAM/meshes/primitiveShapes/line/linePointRef.H b/src/OpenFOAM/meshes/primitiveShapes/line/linePointRef.H
index 9732da33ca5..fa49276f9e9 100644
--- a/src/OpenFOAM/meshes/primitiveShapes/line/linePointRef.H
+++ b/src/OpenFOAM/meshes/primitiveShapes/line/linePointRef.H
@@ -27,7 +27,7 @@ Typedef
     Foam::linePointRef
 
 Description
-    Line using referred points
+    A line using referred points
 
 \*---------------------------------------------------------------------------*/
 
diff --git a/src/OpenFOAM/meshes/primitiveShapes/pyramid/pyramid.H b/src/OpenFOAM/meshes/primitiveShapes/pyramid/pyramid.H
index 13ad33b6b36..9f3ee46b412 100644
--- a/src/OpenFOAM/meshes/primitiveShapes/pyramid/pyramid.H
+++ b/src/OpenFOAM/meshes/primitiveShapes/pyramid/pyramid.H
@@ -44,7 +44,7 @@ SourceFiles
 namespace Foam
 {
 
-// Forward declaration of friend functions and operators
+// Forward Declarations
 
 template<class Point, class PointRef, class polygonRef>
 class pyramid;
@@ -71,9 +71,10 @@ inline Ostream& operator<<
 template<class Point, class PointRef, class polygonRef>
 class pyramid
 {
-    // Private data
+    // Private Data
 
         polygonRef base_;
+
         PointRef apex_;
 
 
@@ -88,7 +89,7 @@ public:
         inline pyramid(Istream& is);
 
 
-    // Member functions
+    // Member Functions
 
         // Access
 
diff --git a/src/OpenFOAM/meshes/meshShapes/cell/pyramidPointFaceRef.H b/src/OpenFOAM/meshes/primitiveShapes/pyramid/pyramidPointFaceRef.H
similarity index 97%
rename from src/OpenFOAM/meshes/meshShapes/cell/pyramidPointFaceRef.H
rename to src/OpenFOAM/meshes/primitiveShapes/pyramid/pyramidPointFaceRef.H
index 6821928e811..638e4d511de 100644
--- a/src/OpenFOAM/meshes/meshShapes/cell/pyramidPointFaceRef.H
+++ b/src/OpenFOAM/meshes/primitiveShapes/pyramid/pyramidPointFaceRef.H
@@ -27,6 +27,7 @@ Typedef
     Foam::pyramidPointFaceRef
 
 Description
+    A pyramid using referred points and faces
 
 \*---------------------------------------------------------------------------*/
 
diff --git a/src/OpenFOAM/meshes/primitiveShapes/tetrahedron/tetPointRef.H b/src/OpenFOAM/meshes/primitiveShapes/tetrahedron/tetPointRef.H
index 9964126d6c5..d7405deea89 100644
--- a/src/OpenFOAM/meshes/primitiveShapes/tetrahedron/tetPointRef.H
+++ b/src/OpenFOAM/meshes/primitiveShapes/tetrahedron/tetPointRef.H
@@ -27,6 +27,7 @@ Typedef
     Foam::tetPointRef
 
 Description
+    A tetrahedron using referred points
 
 \*---------------------------------------------------------------------------*/
 
diff --git a/src/OpenFOAM/meshes/primitiveShapes/triangle/triPointRef.H b/src/OpenFOAM/meshes/primitiveShapes/triangle/triPointRef.H
index 34cc95b13cb..5aba23926e1 100644
--- a/src/OpenFOAM/meshes/primitiveShapes/triangle/triPointRef.H
+++ b/src/OpenFOAM/meshes/primitiveShapes/triangle/triPointRef.H
@@ -27,6 +27,7 @@ Typedef
     Foam::triPointRef
 
 Description
+    A triangle using referred points
 
 \*---------------------------------------------------------------------------*/
 
diff --git a/src/OpenFOAM/primitives/ranges/scalarRange/scalarRange.H b/src/OpenFOAM/primitives/ranges/scalarRange/scalarRange.H
index 12b6ac4366d..2fbf85a209e 100644
--- a/src/OpenFOAM/primitives/ranges/scalarRange/scalarRange.H
+++ b/src/OpenFOAM/primitives/ranges/scalarRange/scalarRange.H
@@ -43,6 +43,7 @@ SourceFiles
     scalarRange.C
 
 \*---------------------------------------------------------------------------*/
+
 #ifndef scalarRange_H
 #define scalarRange_H
 
diff --git a/src/OpenFOAM/primitives/strings/parsing/parsing.H b/src/OpenFOAM/primitives/strings/parsing/parsing.H
index 8ef439b756f..68720a3ca95 100644
--- a/src/OpenFOAM/primitives/strings/parsing/parsing.H
+++ b/src/OpenFOAM/primitives/strings/parsing/parsing.H
@@ -35,6 +35,7 @@ SourceFiles
     parsingI.H
 
 \*---------------------------------------------------------------------------*/
+
 #ifndef parsing_H
 #define parsing_H
 
diff --git a/src/OpenFOAM/primitives/strings/wordRes/wordReListMatcher.H b/src/OpenFOAM/primitives/strings/wordRes/wordReListMatcher.H
index 4da4654d1ea..6b1ec81af23 100644
--- a/src/OpenFOAM/primitives/strings/wordRes/wordReListMatcher.H
+++ b/src/OpenFOAM/primitives/strings/wordRes/wordReListMatcher.H
@@ -8,8 +8,7 @@
     Copyright (C) 2017 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
-    This file is part of OpenFOAM, licensed under GNU General Public License
-    <http://www.gnu.org/licenses/>.
+    This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
 
 Typedef
     Foam::wordReListMatcher
diff --git a/src/conversion/ccm/common/ccmInternal.H b/src/conversion/ccm/common/ccmInternal.H
index 302f5c28dfa..27d43ec83ac 100644
--- a/src/conversion/ccm/common/ccmInternal.H
+++ b/src/conversion/ccm/common/ccmInternal.H
@@ -27,6 +27,7 @@ Description
     Internal bits for wrapping libccmio - do not use directly
 
 \*---------------------------------------------------------------------------*/
+
 #ifndef ccmInternal_H
 #define ccmInternal_H
 
diff --git a/src/conversion/ccm/reader/ccmBoundaryInfo.H b/src/conversion/ccm/reader/ccmBoundaryInfo.H
index fd500413d5b..5879ade6c20 100644
--- a/src/conversion/ccm/reader/ccmBoundaryInfo.H
+++ b/src/conversion/ccm/reader/ccmBoundaryInfo.H
@@ -27,6 +27,7 @@ Description
     Container for holding STARCCM boundary information
 
 \*---------------------------------------------------------------------------*/
+
 #ifndef ccmBoundaryInfo_H
 #define ccmBoundaryInfo_H
 
diff --git a/src/conversion/ccm/reader/ccmInterfaceDefinitions.H b/src/conversion/ccm/reader/ccmInterfaceDefinitions.H
index 67f9d79f1e6..fbd87b659ff 100644
--- a/src/conversion/ccm/reader/ccmInterfaceDefinitions.H
+++ b/src/conversion/ccm/reader/ccmInterfaceDefinitions.H
@@ -27,6 +27,7 @@ Description
     Containers for holding STARCCM interface definitions
 
 \*---------------------------------------------------------------------------*/
+
 #ifndef ccmInterfaceDefinitions_H
 #define ccmInterfaceDefinitions_H
 
diff --git a/src/conversion/ccm/reader/ccmSolutionTable.H b/src/conversion/ccm/reader/ccmSolutionTable.H
index f9343380c05..74401546862 100644
--- a/src/conversion/ccm/reader/ccmSolutionTable.H
+++ b/src/conversion/ccm/reader/ccmSolutionTable.H
@@ -27,6 +27,7 @@ Description
     Containers for holding ccm solution and field listings.
 
 \*---------------------------------------------------------------------------*/
+
 #ifndef ccmSolutionTable_H
 #define ccmSolutionTable_H
 
diff --git a/src/conversion/ccm/writer/ccmWriter.H b/src/conversion/ccm/writer/ccmWriter.H
index a5e06f9542a..2a2127da4fb 100644
--- a/src/conversion/ccm/writer/ccmWriter.H
+++ b/src/conversion/ccm/writer/ccmWriter.H
@@ -87,6 +87,7 @@ SourceFiles
     ccmWriterSolution.C
 
 \*---------------------------------------------------------------------------*/
+
 #ifndef ccmWriter_H
 #define ccmWriter_H
 
diff --git a/src/dynamicMesh/fvMeshSubsetProxy/meshSubsetHelper.H b/src/dynamicMesh/fvMeshSubsetProxy/meshSubsetHelper.H
index 7f8234fd9ff..6cd1352633b 100644
--- a/src/dynamicMesh/fvMeshSubsetProxy/meshSubsetHelper.H
+++ b/src/dynamicMesh/fvMeshSubsetProxy/meshSubsetHelper.H
@@ -8,14 +8,13 @@
     Copyright (C) 2018 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
-    This file is part of OpenFOAM, licensed under GNU General Public License
-    <http://www.gnu.org/licenses/>.
+    This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
 
 Typedef
     Foam::meshSubsetHelper
 
 Description
-    Compatibility name. Rename (JUL-2018) as Foam::fvMeshSubsetProxy
+    Compatibility name. Renamed (JUL-2018) as Foam::fvMeshSubsetProxy
 
 \*---------------------------------------------------------------------------*/
 
diff --git a/src/meshTools/coordinate/systems/coordinateSystems.H b/src/meshTools/coordinate/systems/coordinateSystems.H
index 56c9611b5ad..5fe6669a94b 100644
--- a/src/meshTools/coordinate/systems/coordinateSystems.H
+++ b/src/meshTools/coordinate/systems/coordinateSystems.H
@@ -58,6 +58,7 @@ SourceFiles
     coordinateSystems.C
 
 \*---------------------------------------------------------------------------*/
+
 #ifndef coordinateSystems_H
 #define coordinateSystems_H
 
-- 
GitLab