From a19f03a5cb1b727c16f3cb7b8c7c7dc4e520cae0 Mon Sep 17 00:00:00 2001
From: Mark Olesen <Mark.Olesen@esi-group.com>
Date: Tue, 2 Nov 2021 16:58:05 +0100
Subject: [PATCH] STYLE: additional storage checks, noexcept, spelling

- prune unneeded demandDrivenData.H includes
---
 .../mesh/manipulation/setSet/setSet.C         |  1 -
 .../facePointPatch/facePointPatch.C           |  1 -
 src/OpenFOAM/meshes/polyMesh/polyMesh.C       |  4 +-
 src/OpenFOAM/meshes/polyMesh/polyMesh.H       | 45 ++++++++--------
 src/OpenFOAM/meshes/polyMesh/polyMeshClear.C  |  4 +-
 .../constraint/oldCyclic/oldCyclicPolyPatch.C |  1 -
 .../constraint/processor/processorPolyPatch.C |  1 -
 .../meshes/polyMesh/zones/ZoneMesh/ZoneMesh.H | 18 ++++---
 .../PrimitivePatch/PrimitivePatch.H           |  4 +-
 .../meshes/primitiveMesh/primitiveMesh.C      |  1 -
 .../meshes/primitiveMesh/primitiveMesh.H      | 50 ++++++++---------
 .../meshes/primitiveMesh/primitiveMeshI.H     | 53 ++++++++++---------
 src/conversion/ccm/reader/ccmReader.C         |  1 -
 src/conversion/ccm/writer/ccmWriter.C         |  2 +-
 src/dynamicMesh/fvMeshSubset/fvMeshSubset.C   |  1 -
 .../slidingInterfaceAttachedAddressing.C      |  1 -
 src/finiteArea/faMatrices/faMatrix/faMatrix.C |  5 +-
 src/finiteArea/faMatrices/faMatrix/faMatrix.H | 35 +++++++++---
 .../processorCyclicFvPatchField.C             |  1 -
 .../fvMatrices/fvMatrix/fvMatrix.C            |  5 +-
 .../fvMatrices/fvMatrix/fvMatrix.H            | 31 +++++++++--
 .../volPointInterpolation.C                   |  1 -
 .../algorithms/MeshWave/FaceCellWave.H        |  2 +-
 src/meshTools/meshSearch/meshSearch.C         |  1 -
 .../sampledSurface/sampledSurface.C           |  1 -
 .../sampledSurface/sampledSurfaceRegister.C   |  1 -
 26 files changed, 152 insertions(+), 119 deletions(-)

diff --git a/applications/utilities/mesh/manipulation/setSet/setSet.C b/applications/utilities/mesh/manipulation/setSet/setSet.C
index 7f905226300..e0baf6d3fd7 100644
--- a/applications/utilities/mesh/manipulation/setSet/setSet.C
+++ b/applications/utilities/mesh/manipulation/setSet/setSet.C
@@ -45,7 +45,6 @@ Description
 #include "pointSet.H"
 #include "topoSetSource.H"
 #include "Fstream.H"
-#include "demandDrivenData.H"
 #include "foamVtkWriteTopoSet.H"
 #include "IOobjectList.H"
 #include "cellZoneSet.H"
diff --git a/src/OpenFOAM/meshes/pointMesh/pointPatches/facePointPatch/facePointPatch.C b/src/OpenFOAM/meshes/pointMesh/pointPatches/facePointPatch/facePointPatch.C
index 6214d4a9492..1025a998fc9 100644
--- a/src/OpenFOAM/meshes/pointMesh/pointPatches/facePointPatch/facePointPatch.C
+++ b/src/OpenFOAM/meshes/pointMesh/pointPatches/facePointPatch/facePointPatch.C
@@ -29,7 +29,6 @@ License
 #include "facePointPatch.H"
 #include "pointBoundaryMesh.H"
 #include "pointMesh.H"
-#include "demandDrivenData.H"
 #include "addToRunTimeSelectionTable.H"
 
 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
diff --git a/src/OpenFOAM/meshes/polyMesh/polyMesh.C b/src/OpenFOAM/meshes/polyMesh/polyMesh.C
index a2e7974aa58..5c11df4cdd3 100644
--- a/src/OpenFOAM/meshes/polyMesh/polyMesh.C
+++ b/src/OpenFOAM/meshes/polyMesh/polyMesh.C
@@ -1310,13 +1310,13 @@ const Foam::globalMeshData& Foam::polyMesh::globalData() const
 }
 
 
-Foam::label Foam::polyMesh::comm() const
+Foam::label Foam::polyMesh::comm() const noexcept
 {
     return comm_;
 }
 
 
-Foam::label& Foam::polyMesh::comm()
+Foam::label& Foam::polyMesh::comm() noexcept
 {
     return comm_;
 }
diff --git a/src/OpenFOAM/meshes/polyMesh/polyMesh.H b/src/OpenFOAM/meshes/polyMesh/polyMesh.H
index 940de593311..cedcb558d3d 100644
--- a/src/OpenFOAM/meshes/polyMesh/polyMesh.H
+++ b/src/OpenFOAM/meshes/polyMesh/polyMesh.H
@@ -478,19 +478,19 @@ public:
             const indexedOctree<treeDataCell>& cellTree() const;
 
             //- Return point zone mesh
-            const pointZoneMesh& pointZones() const
+            const pointZoneMesh& pointZones() const noexcept
             {
                 return pointZones_;
             }
 
             //- Return face zone mesh
-            const faceZoneMesh& faceZones() const
+            const faceZoneMesh& faceZones() const noexcept
             {
                 return faceZones_;
             }
 
             //- Return cell zone mesh
-            const cellZoneMesh& cellZones() const
+            const cellZoneMesh& cellZones() const noexcept
             {
                 return cellZones_;
             }
@@ -499,13 +499,13 @@ public:
             const globalMeshData& globalData() const;
 
             //- Return communicator used for parallel communication
-            label comm() const;
+            label comm() const noexcept;
 
             //- Return communicator used for parallel communication
-            label& comm();
+            label& comm() noexcept;
 
             //- Return the object registry
-            const objectRegistry& thisDb() const
+            const objectRegistry& thisDb() const noexcept
             {
                 return *this;
             }
@@ -520,37 +520,37 @@ public:
             }
 
             //- Is mesh moving
-            bool moving() const
+            bool moving() const noexcept
             {
                 return moving_;
             }
 
             //- Set the mesh to be moving
-            bool moving(const bool m)
+            bool moving(const bool on) noexcept
             {
-                bool m0 = moving_;
-                moving_ = m;
-                return m0;
+                bool old(moving_);
+                moving_ = on;
+                return old;
             }
 
             //- Is mesh topology changing
-            bool topoChanging() const
+            bool topoChanging() const noexcept
             {
                 return topoChanging_;
             }
 
             //- Set the mesh topology to be changing
-            bool topoChanging(const bool c)
+            bool topoChanging(const bool on) noexcept
             {
-                bool c0 = topoChanging_;
-                topoChanging_ = c;
-                return c0;
+                bool old(topoChanging_);
+                topoChanging_ = on;
+                return old;
             }
 
             //- Is mesh changing (topology changing and/or moving)
-            bool changing() const
+            bool changing() const noexcept
             {
-                return moving()||topoChanging();
+                return (moving() || topoChanging());
             }
 
             //- Move points, returns volumes swept by faces in motion
@@ -563,19 +563,19 @@ public:
         // Topological change
 
             //- Return non-const access to the pointZones
-            pointZoneMesh& pointZones()
+            pointZoneMesh& pointZones() noexcept
             {
                 return pointZones_;
             }
 
             //- Return non-const access to the faceZones
-            faceZoneMesh& faceZones()
+            faceZoneMesh& faceZones() noexcept
             {
                 return faceZones_;
             }
 
             //- Return non-const access to the cellZones
-            cellZoneMesh& cellZones()
+            cellZoneMesh& cellZones() noexcept
             {
                 return cellZones_;
             }
@@ -669,6 +669,9 @@ public:
             void removeFiles() const;
 
 
+            bool hasTetBasePtIs() const { return bool(tetBasePtIsPtr_); }
+
+
         // Geometric checks. Selectively override primitiveMesh functionality.
 
             //- Check non-orthogonality
diff --git a/src/OpenFOAM/meshes/polyMesh/polyMeshClear.C b/src/OpenFOAM/meshes/polyMesh/polyMeshClear.C
index 323053ddd7b..e657ee38a61 100644
--- a/src/OpenFOAM/meshes/polyMesh/polyMeshClear.C
+++ b/src/OpenFOAM/meshes/polyMesh/polyMeshClear.C
@@ -92,7 +92,7 @@ void Foam::polyMesh::updateGeomPoints
             << exit(FatalError);
     }
 
-    // Clear all geometric mesh objects that are not 'moveable'
+    // Clear all geometric mesh objects that are not 'movable'
     meshObject::clearUpto
     <
         pointMesh,
@@ -143,7 +143,7 @@ void Foam::polyMesh::updateGeomPoints
     geometricD_ = Zero;
     solutionD_ = Zero;
 
-    // Update all 'moveable' objects
+    // Update all 'movable' objects
     meshObject::movePoints<polyMesh>(*this);
     meshObject::movePoints<pointMesh>(*this);
 }
diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/oldCyclic/oldCyclicPolyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/oldCyclic/oldCyclicPolyPatch.C
index 29289ad3d6a..26f114c46bd 100644
--- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/oldCyclic/oldCyclicPolyPatch.C
+++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/oldCyclic/oldCyclicPolyPatch.C
@@ -30,7 +30,6 @@ License
 #include "addToRunTimeSelectionTable.H"
 #include "polyBoundaryMesh.H"
 #include "polyMesh.H"
-#include "demandDrivenData.H"
 #include "OFstream.H"
 #include "patchZones.H"
 #include "matchPoints.H"
diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.C
index 46b2792a76a..27cda877c0e 100644
--- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.C
+++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.C
@@ -30,7 +30,6 @@ License
 #include "addToRunTimeSelectionTable.H"
 #include "dictionary.H"
 #include "SubField.H"
-#include "demandDrivenData.H"
 #include "matchPoints.H"
 #include "OFstream.H"
 #include "polyMesh.H"
diff --git a/src/OpenFOAM/meshes/polyMesh/zones/ZoneMesh/ZoneMesh.H b/src/OpenFOAM/meshes/polyMesh/zones/ZoneMesh/ZoneMesh.H
index d96de5d2715..25f99e1fed1 100644
--- a/src/OpenFOAM/meshes/polyMesh/zones/ZoneMesh/ZoneMesh.H
+++ b/src/OpenFOAM/meshes/polyMesh/zones/ZoneMesh/ZoneMesh.H
@@ -249,13 +249,6 @@ public:
         //- Set/add group with zones
         void setGroup(const word& groupName, const labelUList& zoneIDs);
 
-
-        //- Clear addressing
-        void clearAddressing();
-
-        //- Clear the zones
-        void clear();
-
         //- Check zone definition. Return true if in error.
         bool checkDefinition(const bool report = false) const;
 
@@ -267,6 +260,17 @@ public:
         void movePoints(const pointField& pts);
 
 
+    // Storage Management
+
+        //- Clear addressing
+        void clearAddressing();
+
+        //- Clear the zones
+        void clear();
+
+        bool hasFaceAreas() const { return bool(zoneMapPtr_); }
+
+
     // Member Operators
 
         //- Return const and non-const reference to zone by index.
diff --git a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatch.H b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatch.H
index 5bd1dfe87c0..3999b7449b5 100644
--- a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatch.H
+++ b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatch.H
@@ -297,13 +297,13 @@ public:
     // Access
 
         //- Return reference to global points
-        const Field<point_type>& points() const
+        const Field<point_type>& points() const noexcept
         {
             return points_;
         }
 
         //- Number of faces in the patch
-        label nFaces() const
+        label nFaces() const noexcept
         {
             return FaceList::size();
         }
diff --git a/src/OpenFOAM/meshes/primitiveMesh/primitiveMesh.C b/src/OpenFOAM/meshes/primitiveMesh/primitiveMesh.C
index 2f3cb10efc2..1b468aa4148 100644
--- a/src/OpenFOAM/meshes/primitiveMesh/primitiveMesh.C
+++ b/src/OpenFOAM/meshes/primitiveMesh/primitiveMesh.C
@@ -26,7 +26,6 @@ License
 \*---------------------------------------------------------------------------*/
 
 #include "primitiveMesh.H"
-#include "demandDrivenData.H"
 
 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
 
diff --git a/src/OpenFOAM/meshes/primitiveMesh/primitiveMesh.H b/src/OpenFOAM/meshes/primitiveMesh/primitiveMesh.H
index ecbcbe277a5..f807041e497 100644
--- a/src/OpenFOAM/meshes/primitiveMesh/primitiveMesh.H
+++ b/src/OpenFOAM/meshes/primitiveMesh/primitiveMesh.H
@@ -69,7 +69,7 @@ SourceFiles
 namespace Foam
 {
 
-// Forward declarations
+// Forward Declarations
 class bitSet;
 
 /*---------------------------------------------------------------------------*\
@@ -484,28 +484,28 @@ public:
             // Mesh size parameters
 
                 //- Number of mesh points
-                inline label nPoints() const;
+                inline label nPoints() const noexcept;
 
                 //- Number of mesh edges
                 inline label nEdges() const;
 
                 //- Number of mesh faces
-                inline label nFaces() const;
+                inline label nFaces() const noexcept;
 
                 //- Number of mesh cells
-                inline label nCells() const;
+                inline label nCells() const noexcept;
 
                 //- Number of internal faces
-                inline label nInternalFaces() const;
+                inline label nInternalFaces() const noexcept;
 
                 //- Number of boundary faces (== nFaces - nInternalFaces)
-                inline label nBoundaryFaces() const;
+                inline label nBoundaryFaces() const noexcept;
 
 
             // If points are ordered (nInternalPoints != -1):
 
                 //- Points not on boundary
-                inline label nInternalPoints() const;
+                inline label nInternalPoints() const noexcept;
 
                 //- Internal edges (i.e. not on boundary face) using
                 //- no boundary point
@@ -607,7 +607,7 @@ public:
 
 
             //- Return true if given face label is internal to the mesh
-            inline bool isInternalFace(const label faceIndex) const;
+            inline bool isInternalFace(const label faceIndex) const noexcept;
 
 
             // Topological checks
@@ -795,23 +795,23 @@ public:
             void printAllocated() const;
 
             // Per storage whether allocated
-            inline bool hasCellShapes() const;
-            inline bool hasEdges() const;
-            inline bool hasCellCells() const;
-            inline bool hasEdgeCells() const;
-            inline bool hasPointCells() const;
-            inline bool hasCells() const;
-            inline bool hasEdgeFaces() const;
-            inline bool hasPointFaces() const;
-            inline bool hasCellEdges() const;
-            inline bool hasFaceEdges() const;
-            inline bool hasPointEdges() const;
-            inline bool hasPointPoints() const;
-            inline bool hasCellPoints() const;
-            inline bool hasCellCentres() const;
-            inline bool hasFaceCentres() const;
-            inline bool hasCellVolumes() const;
-            inline bool hasFaceAreas() const;
+            inline bool hasCellShapes() const noexcept;
+            inline bool hasEdges() const noexcept;
+            inline bool hasCellCells() const noexcept;
+            inline bool hasEdgeCells() const noexcept;
+            inline bool hasPointCells() const noexcept;
+            inline bool hasCells() const noexcept;
+            inline bool hasEdgeFaces() const noexcept;
+            inline bool hasPointFaces() const noexcept;
+            inline bool hasCellEdges() const noexcept;
+            inline bool hasFaceEdges() const noexcept;
+            inline bool hasPointEdges() const noexcept;
+            inline bool hasPointPoints() const noexcept;
+            inline bool hasCellPoints() const noexcept;
+            inline bool hasCellCentres() const noexcept;
+            inline bool hasFaceCentres() const noexcept;
+            inline bool hasCellVolumes() const noexcept;
+            inline bool hasFaceAreas() const noexcept;
 
             // On-the-fly addressing calculation. These functions return either
             // a reference to the full addressing (if already calculated) or
diff --git a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshI.H b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshI.H
index fa182d339ca..5bca7075b86 100644
--- a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshI.H
+++ b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshI.H
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011 OpenFOAM Foundation
-    Copyright (C) 2018 OpenCFD Ltd.
+    Copyright (C) 2018-2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -28,13 +28,13 @@ License
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
-inline Foam::label Foam::primitiveMesh::nInternalPoints() const
+inline Foam::label Foam::primitiveMesh::nInternalPoints() const noexcept
 {
     return nInternalPoints_;
 }
 
 
-inline Foam::label Foam::primitiveMesh::nPoints() const
+inline Foam::label Foam::primitiveMesh::nPoints() const noexcept
 {
     return nPoints_;
 }
@@ -75,133 +75,136 @@ inline Foam::label Foam::primitiveMesh::nEdges() const
 }
 
 
-inline Foam::label Foam::primitiveMesh::nInternalFaces() const
+inline Foam::label Foam::primitiveMesh::nInternalFaces() const noexcept
 {
     return nInternalFaces_;
 }
 
 
-inline Foam::label Foam::primitiveMesh::nBoundaryFaces() const
+inline Foam::label Foam::primitiveMesh::nBoundaryFaces() const noexcept
 {
     return (nFaces_ - nInternalFaces_);
 }
 
 
-inline Foam::label Foam::primitiveMesh::nFaces() const
+inline Foam::label Foam::primitiveMesh::nFaces() const noexcept
 {
     return nFaces_;
 }
 
 
-inline Foam::label Foam::primitiveMesh::nCells() const
+inline Foam::label Foam::primitiveMesh::nCells() const noexcept
 {
     return nCells_;
 }
 
 
-inline bool Foam::primitiveMesh::isInternalFace(const label faceIndex) const
+inline bool Foam::primitiveMesh::isInternalFace
+(
+    const label faceIndex
+) const noexcept
 {
     return faceIndex < nInternalFaces_;
 }
 
 
-inline bool Foam::primitiveMesh::hasCellShapes() const
+inline bool Foam::primitiveMesh::hasCellShapes() const noexcept
 {
     return cellShapesPtr_;
 }
 
 
-inline bool Foam::primitiveMesh::hasEdges() const
+inline bool Foam::primitiveMesh::hasEdges() const noexcept
 {
     return edgesPtr_;
 }
 
 
-inline bool Foam::primitiveMesh::hasCellCells() const
+inline bool Foam::primitiveMesh::hasCellCells() const noexcept
 {
     return ccPtr_;
 }
 
 
-inline bool Foam::primitiveMesh::hasEdgeCells() const
+inline bool Foam::primitiveMesh::hasEdgeCells() const noexcept
 {
     return ecPtr_;
 }
 
 
-inline bool Foam::primitiveMesh::hasPointCells() const
+inline bool Foam::primitiveMesh::hasPointCells() const noexcept
 {
     return pcPtr_;
 }
 
 
-inline bool Foam::primitiveMesh::hasCells() const
+inline bool Foam::primitiveMesh::hasCells() const noexcept
 {
     return cfPtr_;
 }
 
 
-inline bool Foam::primitiveMesh::hasEdgeFaces() const
+inline bool Foam::primitiveMesh::hasEdgeFaces() const noexcept
 {
     return efPtr_;
 }
 
 
-inline bool Foam::primitiveMesh::hasPointFaces() const
+inline bool Foam::primitiveMesh::hasPointFaces() const noexcept
 {
     return pfPtr_;
 }
 
 
-inline bool Foam::primitiveMesh::hasCellEdges() const
+inline bool Foam::primitiveMesh::hasCellEdges() const noexcept
 {
     return cePtr_;
 }
 
 
-inline bool Foam::primitiveMesh::hasFaceEdges() const
+inline bool Foam::primitiveMesh::hasFaceEdges() const noexcept
 {
     return fePtr_;
 }
 
 
-inline bool Foam::primitiveMesh::hasPointEdges() const
+inline bool Foam::primitiveMesh::hasPointEdges() const noexcept
 {
     return pePtr_;
 }
 
 
-inline bool Foam::primitiveMesh::hasPointPoints() const
+inline bool Foam::primitiveMesh::hasPointPoints() const noexcept
 {
     return ppPtr_;
 }
 
 
-inline bool Foam::primitiveMesh::hasCellPoints() const
+inline bool Foam::primitiveMesh::hasCellPoints() const noexcept
 {
     return cpPtr_;
 }
 
 
-inline bool Foam::primitiveMesh::hasCellCentres() const
+inline bool Foam::primitiveMesh::hasCellCentres() const noexcept
 {
     return cellCentresPtr_;
 }
 
 
-inline bool Foam::primitiveMesh::hasFaceCentres() const
+inline bool Foam::primitiveMesh::hasFaceCentres() const noexcept
 {
     return faceCentresPtr_;
 }
 
 
-inline bool Foam::primitiveMesh::hasCellVolumes() const
+inline bool Foam::primitiveMesh::hasCellVolumes() const noexcept
 {
     return cellVolumesPtr_;
 }
 
 
-inline bool Foam::primitiveMesh::hasFaceAreas() const
+inline bool Foam::primitiveMesh::hasFaceAreas() const noexcept
 {
     return faceAreasPtr_;
 }
diff --git a/src/conversion/ccm/reader/ccmReader.C b/src/conversion/ccm/reader/ccmReader.C
index 838b5d234f1..baa5b19b7cc 100644
--- a/src/conversion/ccm/reader/ccmReader.C
+++ b/src/conversion/ccm/reader/ccmReader.C
@@ -28,7 +28,6 @@ License
 #include "ccmReader.H"
 #include "IFstream.H"
 #include "IOdictionary.H"
-#include "demandDrivenData.H"
 
 #include "ccmInternal.H"  // include last to avoid any strange interactions
 
diff --git a/src/conversion/ccm/writer/ccmWriter.C b/src/conversion/ccm/writer/ccmWriter.C
index 33f12e1f56e..b690752f421 100644
--- a/src/conversion/ccm/writer/ccmWriter.C
+++ b/src/conversion/ccm/writer/ccmWriter.C
@@ -27,7 +27,7 @@ License
 
 #include "ccmWriter.H"
 #include "cellModel.H"
-#include "demandDrivenData.H"
+
 #include "ccmInternal.H" // include last to avoid any strange interactions
 
 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
diff --git a/src/dynamicMesh/fvMeshSubset/fvMeshSubset.C b/src/dynamicMesh/fvMeshSubset/fvMeshSubset.C
index 71b6bb229f4..305f4515ea7 100644
--- a/src/dynamicMesh/fvMeshSubset/fvMeshSubset.C
+++ b/src/dynamicMesh/fvMeshSubset/fvMeshSubset.C
@@ -32,7 +32,6 @@ License
 #include "pointIndList.H"
 #include "Pstream.H"
 #include "emptyPolyPatch.H"
-#include "demandDrivenData.H"
 #include "cyclicPolyPatch.H"
 #include "removeCells.H"
 #include "polyTopoChange.H"
diff --git a/src/dynamicMesh/slidingInterface/slidingInterfaceAttachedAddressing.C b/src/dynamicMesh/slidingInterface/slidingInterfaceAttachedAddressing.C
index 1015e60c589..f7e43abc343 100644
--- a/src/dynamicMesh/slidingInterface/slidingInterfaceAttachedAddressing.C
+++ b/src/dynamicMesh/slidingInterface/slidingInterfaceAttachedAddressing.C
@@ -30,7 +30,6 @@ License
 #include "polyMesh.H"
 #include "mapPolyMesh.H"
 #include "polyTopoChanger.H"
-#include "demandDrivenData.H"
 
 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
 
diff --git a/src/finiteArea/faMatrices/faMatrix/faMatrix.C b/src/finiteArea/faMatrices/faMatrix/faMatrix.C
index 01cd2e88124..2d646e78516 100644
--- a/src/finiteArea/faMatrices/faMatrix/faMatrix.C
+++ b/src/finiteArea/faMatrices/faMatrix/faMatrix.C
@@ -308,10 +308,7 @@ Foam::faMatrix<Type>::faMatrix
 template<class Type>
 Foam::tmp<Foam::faMatrix<Type>> Foam::faMatrix<Type>::clone() const
 {
-    return tmp<faMatrix<Type>>
-    (
-        new faMatrix<Type>(*this)
-    );
+    return tmp<faMatrix<Type>>::New(*this);
 }
 
 
diff --git a/src/finiteArea/faMatrices/faMatrix/faMatrix.H b/src/finiteArea/faMatrices/faMatrix/faMatrix.H
index f51ebd80b3b..dcee88c4391 100644
--- a/src/finiteArea/faMatrices/faMatrix/faMatrix.H
+++ b/src/finiteArea/faMatrices/faMatrix/faMatrix.H
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2016-2017 Wikki Ltd
-    Copyright (C) 2020 OpenCFD Ltd.
+    Copyright (C) 2020-2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -74,11 +74,28 @@ class faMatrix
     public refCount,
     public lduMatrix
 {
+public:
+
+    // Public Types
+
+        //- Field type for psi
+        typedef
+            GeometricField<Type, faPatchField, areaMesh>
+            psiFieldType;
+
+        //- Field type for face flux (for non-orthogonal correction)
+        typedef
+            GeometricField<Type, faePatchField, edgeMesh>
+            faceFluxFieldType;
+
+
+private:
+
     // Private Data
 
         //- Const reference to field
         //  Converted into a non-const reference at the point of solution.
-        const GeometricField<Type, faPatchField, areaMesh>& psi_;
+        const psiFieldType& psi_;
 
         //- Dimension set
         dimensionSet dimensions_;
@@ -95,8 +112,7 @@ class faMatrix
         FieldField<Field, Type> boundaryCoeffs_;
 
         //- Face flux field for non-orthogonal correction
-        mutable GeometricField<Type, faePatchField, edgeMesh>
-            *faceFluxCorrectionPtr_;
+        mutable faceFluxFieldType* faceFluxCorrectionPtr_;
 
 
 protected:
@@ -285,17 +301,22 @@ public:
                 return boundaryCoeffs_;
             }
 
-
             //- Declare return type of the faceFluxCorrectionPtr() function
             typedef GeometricField<Type, faePatchField, edgeMesh>
-                *edgeTypeFieldPtr;
+                *faceFluxFieldPtrType;
 
             //- Return pointer to face-flux non-orthogonal correction field
-            edgeTypeFieldPtr& faceFluxCorrectionPtr()
+            faceFluxFieldPtrType& faceFluxCorrectionPtr()
             {
                 return faceFluxCorrectionPtr_;
             }
 
+            //- True if face-flux non-orthogonal correction field exists
+            bool hasFaceFluxCorrection() const noexcept
+            {
+                return bool(faceFluxCorrectionPtr_);
+            }
+
 
         // Operations
 
diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/processorCyclic/processorCyclicFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/constraint/processorCyclic/processorCyclicFvPatchField.C
index 2320fc25c95..03e6518cc87 100644
--- a/src/finiteVolume/fields/fvPatchFields/constraint/processorCyclic/processorCyclicFvPatchField.C
+++ b/src/finiteVolume/fields/fvPatchFields/constraint/processorCyclic/processorCyclicFvPatchField.C
@@ -27,7 +27,6 @@ License
 
 #include "processorCyclicFvPatchField.H"
 #include "processorCyclicFvPatch.H"
-#include "demandDrivenData.H"
 #include "transformField.H"
 
 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
diff --git a/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.C b/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.C
index 96b3ff6c9f8..8720efd95f0 100644
--- a/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.C
+++ b/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.C
@@ -528,10 +528,7 @@ Foam::fvMatrix<Type>::fvMatrix
 template<class Type>
 Foam::tmp<Foam::fvMatrix<Type>> Foam::fvMatrix<Type>::clone() const
 {
-    return tmp<fvMatrix<Type>>
-    (
-        new fvMatrix<Type>(*this)
-    );
+    return tmp<fvMatrix<Type>>::New(*this);
 }
 
 
diff --git a/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.H b/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.H
index a98074244a3..33c42a978ad 100644
--- a/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.H
+++ b/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.H
@@ -121,11 +121,27 @@ class fvMatrix
     public refCount,
     public lduMatrix
 {
+public:
+
+    // Public Types
+
+        //- Field type for psi
+        typedef
+            GeometricField<Type, fvPatchField, volMesh>
+            psiFieldType;
+
+        //- Field type for face flux (for non-orthogonal correction)
+        typedef
+            GeometricField<Type, fvsPatchField, surfaceMesh>
+            faceFluxFieldType;
+
+private:
+
     // Private Data
 
         //- Const reference to field
         //  Converted into a non-const reference at the point of solution.
-        const GeometricField<Type, fvPatchField, volMesh>& psi_;
+        const psiFieldType& psi_;
 
         //- Originating fvMatrices when assembling matrices. Empty if not used.
         PtrList<fvMatrix<Type>> subMatrices_;
@@ -154,8 +170,7 @@ class fvMatrix
         FieldField<Field, Type> boundaryCoeffs_;
 
         //- Face flux field for non-orthogonal correction
-        mutable GeometricField<Type, fvsPatchField, surfaceMesh>
-            *faceFluxCorrectionPtr_;
+        mutable faceFluxFieldType* faceFluxCorrectionPtr_;
 
 
 protected:
@@ -468,14 +483,20 @@ public:
 
             //- Declare return type of the faceFluxCorrectionPtr() function
             typedef GeometricField<Type, fvsPatchField, surfaceMesh>
-                *surfaceTypeFieldPtr;
+                *faceFluxFieldPtrType;
 
             //- Return pointer to face-flux non-orthogonal correction field
-            surfaceTypeFieldPtr& faceFluxCorrectionPtr()
+            faceFluxFieldPtrType& faceFluxCorrectionPtr()
             {
                 return faceFluxCorrectionPtr_;
             }
 
+            //- True if face-flux non-orthogonal correction field exists
+            bool hasFaceFluxCorrection() const noexcept
+            {
+                return bool(faceFluxCorrectionPtr_);
+            }
+
 
         // Operations
 
diff --git a/src/finiteVolume/interpolation/volPointInterpolation/volPointInterpolation.C b/src/finiteVolume/interpolation/volPointInterpolation/volPointInterpolation.C
index 98d14998c1d..9200d9c1fd0 100644
--- a/src/finiteVolume/interpolation/volPointInterpolation/volPointInterpolation.C
+++ b/src/finiteVolume/interpolation/volPointInterpolation/volPointInterpolation.C
@@ -30,7 +30,6 @@ License
 #include "fvMesh.H"
 #include "volFields.H"
 #include "pointFields.H"
-#include "demandDrivenData.H"
 #include "pointConstraints.H"
 #include "surfaceFields.H"
 #include "processorPointPatch.H"
diff --git a/src/meshTools/algorithms/MeshWave/FaceCellWave.H b/src/meshTools/algorithms/MeshWave/FaceCellWave.H
index b03cc805bd4..f3eefe65f82 100644
--- a/src/meshTools/algorithms/MeshWave/FaceCellWave.H
+++ b/src/meshTools/algorithms/MeshWave/FaceCellWave.H
@@ -83,7 +83,7 @@ class FaceCellWave
 protected:
 
     //- Information tagged with a source or destination id.
-    //  With std::pair as lightweight, moveable container.
+    //  With std::pair as lightweight, movable container.
     typedef std::pair<label,Type> taggedInfoType;
 
 
diff --git a/src/meshTools/meshSearch/meshSearch.C b/src/meshTools/meshSearch/meshSearch.C
index ed0017ba9fa..2f840ac26d3 100644
--- a/src/meshTools/meshSearch/meshSearch.C
+++ b/src/meshTools/meshSearch/meshSearch.C
@@ -30,7 +30,6 @@ License
 #include "polyMesh.H"
 #include "indexedOctree.H"
 #include "DynamicList.H"
-#include "demandDrivenData.H"
 #include "treeDataCell.H"
 #include "treeDataFace.H"
 
diff --git a/src/sampling/sampledSurface/sampledSurface/sampledSurface.C b/src/sampling/sampledSurface/sampledSurface/sampledSurface.C
index 333a8a8e563..9d9fd19cec8 100644
--- a/src/sampling/sampledSurface/sampledSurface/sampledSurface.C
+++ b/src/sampling/sampledSurface/sampledSurface/sampledSurface.C
@@ -28,7 +28,6 @@ License
 
 #include "sampledSurface.H"
 #include "polyMesh.H"
-#include "demandDrivenData.H"
 
 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
 
diff --git a/src/sampling/sampledSurface/sampledSurface/sampledSurfaceRegister.C b/src/sampling/sampledSurface/sampledSurface/sampledSurfaceRegister.C
index 0045bebeb5d..4bb0eaecff9 100644
--- a/src/sampling/sampledSurface/sampledSurface/sampledSurfaceRegister.C
+++ b/src/sampling/sampledSurface/sampledSurface/sampledSurfaceRegister.C
@@ -28,7 +28,6 @@ License
 #include "sampledSurface.H"
 #include "fvMesh.H"
 #include "MeshedSurface.H"
-#include "demandDrivenData.H"
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
-- 
GitLab