From f0a196a90848866312154f1d90da2c54d3716237 Mon Sep 17 00:00:00 2001
From: Mark Olesen <Mark.Olesen@esi-group.com>
Date: Fri, 24 Feb 2023 15:46:23 +0100
Subject: [PATCH] STYLE: include primitivePatch.H (instead of PrimitivePatch.H)

- further de-clutter in the future

ENH: PrimitivePatchInterpolation with unique_ptr for memory management
---
 .../backgroundMeshDecomposition.H             |   2 -
 .../automatic/automatic.H                     |   2 +-
 .../fieldFromFile/fieldFromFile.H             |   2 +-
 .../nonUniformField/nonUniformField.H         |   2 +-
 .../PrimitivePatchInterpolation.C             | 102 +++++++-----------
 .../PrimitivePatchInterpolation.H             |  10 +-
 .../primitivePatchInterpolation.H             |   2 +-
 .../primitiveMesh/PatchTools/PatchTools.H     |   4 +-
 .../PrimitivePatch/PrimitivePatch.H           |   7 +-
 .../primitivePatch/indirectPrimitivePatch.H   |   4 +-
 .../primitivePatch/primitivePatch.H           |   4 -
 .../vtk/output/foamVtkPatchWriter.H           |   2 +-
 src/dynamicMesh/boundaryMesh/bMesh.H          |   9 +-
 src/dynamicMesh/boundaryMesh/boundaryMesh.H   |   2 +-
 .../polyMeshAdder/faceCoupleInfo.H            |   2 -
 .../polyTopoChange/hexRef8/hexRef8.H          |   1 -
 .../enrichedPatch/enrichedPatch.H             |   1 -
 .../AMIInterpolation/findNearestMaskedOp.H    |   2 +-
 .../cyclicACMIPointPatchField.H               |   2 +-
 .../cyclicAMIPointPatchField.H                |   2 +-
 .../PatchEdgeFaceWave/PatchEdgeFaceWave.H     |   2 +-
 .../extendedEdgeMesh/extendedEdgeMesh.H       |   6 +-
 .../indexedOctree/treeDataPrimitivePatch.C    |  24 ++---
 src/meshTools/meshTools/meshTools.H           |   6 +-
 .../sensitivityBezierIncompressible.H         |   8 +-
 .../sensitivityBezierFIIncompressible.H       |   2 +-
 .../sensitivitySurfaceIncompressible.C        |   2 +-
 .../adjoint/parameterization/Bezier/Bezier.H  |   7 +-
 .../sampledPatchInternalFieldTemplates.C      |   2 +-
 src/surfMesh/MeshedSurface/MeshedSurface.H    |   7 +-
 src/surfMesh/polySurface/polySurface.H        |   2 +-
 src/surfMesh/surfMesh/surfMesh.H              |   2 +-
 .../surfaceFormats/ac3d/AC3DsurfaceFormat.C   |   2 +-
 src/surfMesh/triSurface/triSurface.H          |   7 +-
 34 files changed, 102 insertions(+), 141 deletions(-)

diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/backgroundMeshDecomposition/backgroundMeshDecomposition.H b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/backgroundMeshDecomposition/backgroundMeshDecomposition.H
index 3a489a38ca9..a0dd1bd11d5 100644
--- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/backgroundMeshDecomposition/backgroundMeshDecomposition.H
+++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/backgroundMeshDecomposition/backgroundMeshDecomposition.H
@@ -68,9 +68,7 @@ SourceFiles
 #include "globalIndex.H"
 #include "treeBoundBox.H"
 #include "primitivePatch.H"
-#include "face.H"
 #include "labelList.H"
-#include "pointField.H"
 #include "indexedOctree.H"
 #include "treeDataPrimitivePatch.H"
 #include "volumeType.H"
diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellSizeControlSurfaces/surfaceCellSizeFunction/cellSizeCalculationType/automatic/automatic.H b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellSizeControlSurfaces/surfaceCellSizeFunction/cellSizeCalculationType/automatic/automatic.H
index 3b8da3bbf0e..df9922ba120 100644
--- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellSizeControlSurfaces/surfaceCellSizeFunction/cellSizeCalculationType/automatic/automatic.H
+++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellSizeControlSurfaces/surfaceCellSizeFunction/cellSizeCalculationType/automatic/automatic.H
@@ -38,7 +38,7 @@ SourceFiles
 
 #include "cellSizeCalculationType.H"
 #include "triSurfaceFields.H"
-#include "PrimitivePatchInterpolation.H"
+#include "primitivePatchInterpolation.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellSizeControlSurfaces/surfaceCellSizeFunction/cellSizeCalculationType/fieldFromFile/fieldFromFile.H b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellSizeControlSurfaces/surfaceCellSizeFunction/cellSizeCalculationType/fieldFromFile/fieldFromFile.H
index 7fb636e2af3..fe301e42625 100644
--- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellSizeControlSurfaces/surfaceCellSizeFunction/cellSizeCalculationType/fieldFromFile/fieldFromFile.H
+++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellSizeControlSurfaces/surfaceCellSizeFunction/cellSizeCalculationType/fieldFromFile/fieldFromFile.H
@@ -38,7 +38,7 @@ SourceFiles
 
 #include "cellSizeCalculationType.H"
 #include "triSurfaceFields.H"
-#include "PrimitivePatchInterpolation.H"
+#include "primitivePatchInterpolation.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellSizeControlSurfaces/surfaceCellSizeFunction/nonUniformField/nonUniformField.H b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellSizeControlSurfaces/surfaceCellSizeFunction/nonUniformField/nonUniformField.H
index 13436971f64..0fedf3c6830 100644
--- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellSizeControlSurfaces/surfaceCellSizeFunction/nonUniformField/nonUniformField.H
+++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellSizeControlSurfaces/surfaceCellSizeFunction/nonUniformField/nonUniformField.H
@@ -38,7 +38,7 @@ SourceFiles
 #define nonUniformField_H
 
 #include "triSurfaceFields.H"
-#include "PrimitivePatchInterpolation.H"
+#include "primitivePatchInterpolation.H"
 #include "surfaceCellSizeFunction.H"
 #include "cellSizeCalculationType.H"
 
diff --git a/src/OpenFOAM/interpolations/primitivePatchInterpolation/PrimitivePatchInterpolation.C b/src/OpenFOAM/interpolations/primitivePatchInterpolation/PrimitivePatchInterpolation.C
index ccc578f7a1c..3a1a5bc0dbe 100644
--- a/src/OpenFOAM/interpolations/primitivePatchInterpolation/PrimitivePatchInterpolation.C
+++ b/src/OpenFOAM/interpolations/primitivePatchInterpolation/PrimitivePatchInterpolation.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2016 OpenFOAM Foundation
-    Copyright (C) 2020 OpenCFD Ltd.
+    Copyright (C) 2020-2023 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -27,19 +27,12 @@ License
 \*---------------------------------------------------------------------------*/
 
 #include "PrimitivePatchInterpolation.H"
-#include "faceList.H"
-#include "demandDrivenData.H"
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-namespace Foam
-{
 
 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
 
 template<class Patch>
-const scalarListList&
-PrimitivePatchInterpolation<Patch>::faceToPointWeights() const
+const Foam::scalarListList&
+Foam::PrimitivePatchInterpolation<Patch>::faceToPointWeights() const
 {
     if (!faceToPointWeightsPtr_)
     {
@@ -51,7 +44,7 @@ PrimitivePatchInterpolation<Patch>::faceToPointWeights() const
 
 
 template<class Patch>
-void PrimitivePatchInterpolation<Patch>::makeFaceToPointWeights() const
+void Foam::PrimitivePatchInterpolation<Patch>::makeFaceToPointWeights() const
 {
     if (faceToPointWeightsPtr_)
     {
@@ -60,10 +53,10 @@ void PrimitivePatchInterpolation<Patch>::makeFaceToPointWeights() const
             << abort(FatalError);
     }
 
-    const pointField& points = patch_.localPoints();
-    const List<typename Patch::face_type>& faces = patch_.localFaces();
+    const auto& points = patch_.localPoints();
+    const auto& faces = patch_.localFaces();
 
-    faceToPointWeightsPtr_ = new scalarListList(points.size());
+    faceToPointWeightsPtr_.reset(new scalarListList(points.size()));
     auto& weights = *faceToPointWeightsPtr_;
 
     // get reference to addressing
@@ -94,8 +87,8 @@ void PrimitivePatchInterpolation<Patch>::makeFaceToPointWeights() const
 
 
 template<class Patch>
-const scalarList&
-PrimitivePatchInterpolation<Patch>::faceToEdgeWeights() const
+const Foam::scalarList&
+Foam::PrimitivePatchInterpolation<Patch>::faceToEdgeWeights() const
 {
     if (!faceToEdgeWeightsPtr_)
     {
@@ -107,7 +100,7 @@ PrimitivePatchInterpolation<Patch>::faceToEdgeWeights() const
 
 
 template<class Patch>
-void PrimitivePatchInterpolation<Patch>::makeFaceToEdgeWeights() const
+void Foam::PrimitivePatchInterpolation<Patch>::makeFaceToEdgeWeights() const
 {
     if (faceToEdgeWeightsPtr_)
     {
@@ -116,12 +109,12 @@ void PrimitivePatchInterpolation<Patch>::makeFaceToEdgeWeights() const
             << abort(FatalError);
     }
 
-    const pointField& points = patch_.localPoints();
-    const List<typename Patch::face_type>& faces = patch_.localFaces();
+    const auto& points = patch_.localPoints();
+    const auto& faces = patch_.localFaces();
     const edgeList& edges = patch_.edges();
     const labelListList& edgeFaces = patch_.edgeFaces();
 
-    faceToEdgeWeightsPtr_ = new scalarList(patch_.nInternalEdges());
+    faceToEdgeWeightsPtr_.reset(new scalarList(patch_.nInternalEdges()));
     auto& weights = *faceToEdgeWeightsPtr_;
 
     forAll(weights, edgei)
@@ -142,17 +135,20 @@ void PrimitivePatchInterpolation<Patch>::makeFaceToEdgeWeights() const
 
 
 template<class Patch>
-void PrimitivePatchInterpolation<Patch>::clearWeights()
+void Foam::PrimitivePatchInterpolation<Patch>::clearWeights()
 {
-    deleteDemandDrivenData(faceToPointWeightsPtr_);
-    deleteDemandDrivenData(faceToEdgeWeightsPtr_);
+    faceToPointWeightsPtr_.reset(nullptr);
+    faceToEdgeWeightsPtr_.reset(nullptr);
 }
 
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
 template<class Patch>
-PrimitivePatchInterpolation<Patch>::PrimitivePatchInterpolation(const Patch& p)
+Foam::PrimitivePatchInterpolation<Patch>::PrimitivePatchInterpolation
+(
+    const Patch& p
+)
 :
     patch_(p),
     faceToPointWeightsPtr_(nullptr),
@@ -160,20 +156,12 @@ PrimitivePatchInterpolation<Patch>::PrimitivePatchInterpolation(const Patch& p)
 {}
 
 
-// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
-
-template<class Patch>
-PrimitivePatchInterpolation<Patch>::~PrimitivePatchInterpolation()
-{
-    clearWeights();
-}
-
-
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
 template<class Patch>
 template<class Type>
-tmp<Field<Type>> PrimitivePatchInterpolation<Patch>::faceToPointInterpolate
+Foam::tmp<Foam::Field<Type>>
+Foam::PrimitivePatchInterpolation<Patch>::faceToPointInterpolate
 (
     const Field<Type>& ff
 ) const
@@ -187,15 +175,8 @@ tmp<Field<Type>> PrimitivePatchInterpolation<Patch>::faceToPointInterpolate
             << abort(FatalError);
     }
 
-    tmp<Field<Type>> tresult
-    (
-        new Field<Type>
-        (
-            patch_.nPoints(), Zero
-        )
-    );
-
-    Field<Type>& result = tresult.ref();
+    auto tresult = tmp<Field<Type>>::New(patch_.nPoints(), Zero);
+    auto& result = tresult.ref();
 
     const labelListList& pointFaces = patch_.pointFaces();
     const scalarListList& weights = faceToPointWeights();
@@ -217,7 +198,8 @@ tmp<Field<Type>> PrimitivePatchInterpolation<Patch>::faceToPointInterpolate
 
 template<class Patch>
 template<class Type>
-tmp<Field<Type>> PrimitivePatchInterpolation<Patch>::faceToPointInterpolate
+Foam::tmp<Foam::Field<Type>>
+Foam::PrimitivePatchInterpolation<Patch>::faceToPointInterpolate
 (
     const tmp<Field<Type>>& tff
 ) const
@@ -230,7 +212,8 @@ tmp<Field<Type>> PrimitivePatchInterpolation<Patch>::faceToPointInterpolate
 
 template<class Patch>
 template<class Type>
-tmp<Field<Type>> PrimitivePatchInterpolation<Patch>::pointToFaceInterpolate
+Foam::tmp<Foam::Field<Type>>
+Foam::PrimitivePatchInterpolation<Patch>::pointToFaceInterpolate
 (
     const Field<Type>& pf
 ) const
@@ -243,18 +226,10 @@ tmp<Field<Type>> PrimitivePatchInterpolation<Patch>::pointToFaceInterpolate
             << abort(FatalError);
     }
 
-    tmp<Field<Type>> tresult
-    (
-        new Field<Type>
-        (
-            patch_.size(),
-            Zero
-        )
-    );
-
-    Field<Type>& result = tresult.ref();
+    auto tresult = tmp<Field<Type>>::New(patch_.size(), Zero);
+    auto& result = tresult.ref();
 
-    const List<typename Patch::face_type>& localFaces = patch_.localFaces();
+    const auto& localFaces = patch_.localFaces();
 
     forAll(result, facei)
     {
@@ -274,7 +249,8 @@ tmp<Field<Type>> PrimitivePatchInterpolation<Patch>::pointToFaceInterpolate
 
 template<class Patch>
 template<class Type>
-tmp<Field<Type>> PrimitivePatchInterpolation<Patch>::pointToFaceInterpolate
+Foam::tmp<Foam::Field<Type>>
+Foam::PrimitivePatchInterpolation<Patch>::pointToFaceInterpolate
 (
     const tmp<Field<Type>>& tpf
 ) const
@@ -287,7 +263,8 @@ tmp<Field<Type>> PrimitivePatchInterpolation<Patch>::pointToFaceInterpolate
 
 template<class Patch>
 template<class Type>
-tmp<Field<Type>> PrimitivePatchInterpolation<Patch>::faceToEdgeInterpolate
+Foam::tmp<Foam::Field<Type>>
+Foam::PrimitivePatchInterpolation<Patch>::faceToEdgeInterpolate
 (
     const Field<Type>& pf
 ) const
@@ -327,7 +304,8 @@ tmp<Field<Type>> PrimitivePatchInterpolation<Patch>::faceToEdgeInterpolate
 
 template<class Patch>
 template<class Type>
-tmp<Field<Type>> PrimitivePatchInterpolation<Patch>::faceToEdgeInterpolate
+Foam::tmp<Foam::Field<Type>>
+Foam::PrimitivePatchInterpolation<Patch>::faceToEdgeInterpolate
 (
     const tmp<Field<Type>>& tpf
 ) const
@@ -339,7 +317,7 @@ tmp<Field<Type>> PrimitivePatchInterpolation<Patch>::faceToEdgeInterpolate
 
 
 template<class Patch>
-bool PrimitivePatchInterpolation<Patch>::movePoints()
+bool Foam::PrimitivePatchInterpolation<Patch>::movePoints()
 {
     clearWeights();
 
@@ -347,8 +325,4 @@ bool PrimitivePatchInterpolation<Patch>::movePoints()
 }
 
 
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-} // End namespace Foam
-
 // ************************************************************************* //
diff --git a/src/OpenFOAM/interpolations/primitivePatchInterpolation/PrimitivePatchInterpolation.H b/src/OpenFOAM/interpolations/primitivePatchInterpolation/PrimitivePatchInterpolation.H
index 22f9b653354..c952be4c9b2 100644
--- a/src/OpenFOAM/interpolations/primitivePatchInterpolation/PrimitivePatchInterpolation.H
+++ b/src/OpenFOAM/interpolations/primitivePatchInterpolation/PrimitivePatchInterpolation.H
@@ -39,6 +39,7 @@ SourceFiles
 #define PrimitivePatchInterpolation_H
 
 #include "scalarList.H"
+#include "faceList.H"
 #include "Field.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@@ -46,6 +47,9 @@ SourceFiles
 namespace Foam
 {
 
+// Forward Declarations
+template<class Patch> class PrimitivePatchInterpolation;
+
 /*---------------------------------------------------------------------------*\
                   Class PrimitivePatchInterpolation Declaration
 \*---------------------------------------------------------------------------*/
@@ -62,10 +66,10 @@ class PrimitivePatchInterpolation
     // Demand-driven data
 
         //- Face-to-point weights
-        mutable scalarListList* faceToPointWeightsPtr_;
+        mutable std::unique_ptr<scalarListList> faceToPointWeightsPtr_;
 
         //- Face-to-edge weights
-        mutable scalarList* faceToEdgeWeightsPtr_;
+        mutable std::unique_ptr<scalarList> faceToEdgeWeightsPtr_;
 
 
     // Private Member Functions
@@ -105,7 +109,7 @@ public:
 
 
     //- Destructor
-    ~PrimitivePatchInterpolation();
+    ~PrimitivePatchInterpolation() = default;
 
 
     // Member Functions
diff --git a/src/OpenFOAM/interpolations/primitivePatchInterpolation/primitivePatchInterpolation.H b/src/OpenFOAM/interpolations/primitivePatchInterpolation/primitivePatchInterpolation.H
index 93f26a19221..266f251eba1 100644
--- a/src/OpenFOAM/interpolations/primitivePatchInterpolation/primitivePatchInterpolation.H
+++ b/src/OpenFOAM/interpolations/primitivePatchInterpolation/primitivePatchInterpolation.H
@@ -35,8 +35,8 @@ Description
 #ifndef primitivePatchInterpolation_H
 #define primitivePatchInterpolation_H
 
-#include "PrimitivePatchInterpolation.H"
 #include "primitivePatch.H"
+#include "PrimitivePatchInterpolation.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
diff --git a/src/OpenFOAM/meshes/primitiveMesh/PatchTools/PatchTools.H b/src/OpenFOAM/meshes/primitiveMesh/PatchTools/PatchTools.H
index 0a96cfb0cdd..56fbd59a905 100644
--- a/src/OpenFOAM/meshes/primitiveMesh/PatchTools/PatchTools.H
+++ b/src/OpenFOAM/meshes/primitiveMesh/PatchTools/PatchTools.H
@@ -48,9 +48,9 @@ SourceFiles
 #ifndef Foam_PatchTools_H
 #define Foam_PatchTools_H
 
-#include "PrimitivePatch.H"
-#include "globalIndex.H"
 #include "autoPtr.H"
+#include "globalIndex.H"
+#include "primitivePatch.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
diff --git a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatch.H b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatch.H
index 3355bacdde1..0c83b4c2732 100644
--- a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatch.H
+++ b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatch.H
@@ -57,9 +57,11 @@ SourceFiles
 #include "boolList.H"
 #include "labelList.H"
 #include "edgeList.H"
-#include "point.H"
+#include "face.H"
+#include "pointField.H"
 #include "intersection.H"
 #include "HashSet.H"
+#include "SubList.H"
 #include "objectHit.H"
 #include "PrimitivePatchBase.H"
 
@@ -69,8 +71,9 @@ namespace Foam
 {
 
 // Forward Declarations
-class face;
 template<class T> class Map;
+template<class FaceList, class PointField> class PrimitivePatch;
+
 
 /*---------------------------------------------------------------------------*\
                            Class PrimitivePatch Declaration
diff --git a/src/OpenFOAM/meshes/primitiveMesh/primitivePatch/indirectPrimitivePatch.H b/src/OpenFOAM/meshes/primitiveMesh/primitivePatch/indirectPrimitivePatch.H
index 4de24fb4b2d..ee1b9d99068 100644
--- a/src/OpenFOAM/meshes/primitiveMesh/primitivePatch/indirectPrimitivePatch.H
+++ b/src/OpenFOAM/meshes/primitiveMesh/primitivePatch/indirectPrimitivePatch.H
@@ -43,10 +43,8 @@ Description
 #ifndef Foam_indirectPrimitivePatch_H
 #define Foam_indirectPrimitivePatch_H
 
-#include "PrimitivePatch.H"
-#include "face.H"
+#include "primitivePatch.H"
 #include "IndirectList.H"
-#include "pointField.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
diff --git a/src/OpenFOAM/meshes/primitiveMesh/primitivePatch/primitivePatch.H b/src/OpenFOAM/meshes/primitiveMesh/primitivePatch/primitivePatch.H
index 9fda6d684fa..f6279b5990d 100644
--- a/src/OpenFOAM/meshes/primitiveMesh/primitivePatch/primitivePatch.H
+++ b/src/OpenFOAM/meshes/primitiveMesh/primitivePatch/primitivePatch.H
@@ -48,10 +48,6 @@ Description
 #define Foam_primitivePatch_H
 
 #include "PrimitivePatch.H"
-#include "face.H"
-#include "SubList.H"
-#include "List.H"
-#include "pointField.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
diff --git a/src/conversion/vtk/output/foamVtkPatchWriter.H b/src/conversion/vtk/output/foamVtkPatchWriter.H
index b6e52977061..429c212b1c0 100644
--- a/src/conversion/vtk/output/foamVtkPatchWriter.H
+++ b/src/conversion/vtk/output/foamVtkPatchWriter.H
@@ -53,7 +53,7 @@ SourceFiles
 #include "foamVtkPatchMeshWriter.H"
 #include "volFields.H"
 #include "pointFields.H"
-#include "PrimitivePatchInterpolation.H"
+#include "primitivePatchInterpolation.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
diff --git a/src/dynamicMesh/boundaryMesh/bMesh.H b/src/dynamicMesh/boundaryMesh/bMesh.H
index a41a250204f..5aab8f09153 100644
--- a/src/dynamicMesh/boundaryMesh/bMesh.H
+++ b/src/dynamicMesh/boundaryMesh/bMesh.H
@@ -33,13 +33,10 @@ Description
 
 \*---------------------------------------------------------------------------*/
 
-#ifndef bMesh_H
-#define bMesh_H
+#ifndef Foam_bMesh_H
+#define Foam_bMesh_H
 
-#include "PrimitivePatch.H"
-#include "face.H"
-#include "List.H"
-#include "pointField.H"
+#include "primitivePatch.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
diff --git a/src/dynamicMesh/boundaryMesh/boundaryMesh.H b/src/dynamicMesh/boundaryMesh/boundaryMesh.H
index 0b20ef41004..a7367be57be 100644
--- a/src/dynamicMesh/boundaryMesh/boundaryMesh.H
+++ b/src/dynamicMesh/boundaryMesh/boundaryMesh.H
@@ -43,7 +43,7 @@ SourceFiles
 #include "boundaryPatch.H"
 #include "className.H"
 #include "polyPatch.H"
-#include "PrimitivePatch.H"
+#include "primitivePatch.H"
 #include "PtrList.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
diff --git a/src/dynamicMesh/polyMeshAdder/faceCoupleInfo.H b/src/dynamicMesh/polyMeshAdder/faceCoupleInfo.H
index 5424b736b2a..2e2df56b3d7 100644
--- a/src/dynamicMesh/polyMeshAdder/faceCoupleInfo.H
+++ b/src/dynamicMesh/polyMeshAdder/faceCoupleInfo.H
@@ -137,7 +137,6 @@ SourceFiles
 #define Foam_faceCoupleInfo_H
 
 #include "edgeHashes.H"
-#include "pointField.H"
 #include "indirectPrimitivePatch.H"
 #include "primitivePatch.H"
 
@@ -147,7 +146,6 @@ namespace Foam
 {
 
 // Forward Declarations
-class face;
 class primitiveMesh;
 class polyPatch;
 class polyMesh;
diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8/hexRef8.H b/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8/hexRef8.H
index 681ef62f0de..d82f7b4fefa 100644
--- a/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8/hexRef8.H
+++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8/hexRef8.H
@@ -39,7 +39,6 @@ SourceFiles
 #define hexRef8_H
 
 #include "labelIOList.H"
-#include "face.H"
 #include "HashSet.H"
 #include "DynamicList.H"
 #include "primitivePatch.H"
diff --git a/src/dynamicMesh/slidingInterface/enrichedPatch/enrichedPatch.H b/src/dynamicMesh/slidingInterface/enrichedPatch/enrichedPatch.H
index bec45a2d296..2689d449f83 100644
--- a/src/dynamicMesh/slidingInterface/enrichedPatch/enrichedPatch.H
+++ b/src/dynamicMesh/slidingInterface/enrichedPatch/enrichedPatch.H
@@ -55,7 +55,6 @@ SourceFiles
 #define Foam_enrichedPatch_H
 
 #include "Map.H"
-#include "point.H"
 #include "primitivePatch.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/findNearestMaskedOp.H b/src/meshTools/AMIInterpolation/AMIInterpolation/findNearestMaskedOp.H
index 2290021efb5..3d66906b7b3 100644
--- a/src/meshTools/AMIInterpolation/AMIInterpolation/findNearestMaskedOp.H
+++ b/src/meshTools/AMIInterpolation/AMIInterpolation/findNearestMaskedOp.H
@@ -43,7 +43,7 @@ public:
 
             if (!excludeIndices_.found(index))
             {
-                const typename PatchType::FaceType& f = patch[index];
+                const auto& f = patch[index];
 
                 pointHit nearHit = f.nearestPoint(sample, points);
                 scalar distSqr = sqr(nearHit.distance());
diff --git a/src/meshTools/AMIInterpolation/patches/cyclicACMI/cyclicACMIPointPatchField/cyclicACMIPointPatchField.H b/src/meshTools/AMIInterpolation/patches/cyclicACMI/cyclicACMIPointPatchField/cyclicACMIPointPatchField.H
index fa2d54f387c..17755d52954 100644
--- a/src/meshTools/AMIInterpolation/patches/cyclicACMI/cyclicACMIPointPatchField/cyclicACMIPointPatchField.H
+++ b/src/meshTools/AMIInterpolation/patches/cyclicACMI/cyclicACMIPointPatchField/cyclicACMIPointPatchField.H
@@ -40,7 +40,7 @@ SourceFiles
 
 #include "coupledPointPatchField.H"
 #include "cyclicACMIPointPatch.H"
-#include "PrimitivePatchInterpolation.H"
+#include "primitivePatchInterpolation.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
diff --git a/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPointPatchField/cyclicAMIPointPatchField.H b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPointPatchField/cyclicAMIPointPatchField.H
index 78a8148c099..5840a302695 100644
--- a/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPointPatchField/cyclicAMIPointPatchField.H
+++ b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPointPatchField/cyclicAMIPointPatchField.H
@@ -40,7 +40,7 @@ SourceFiles
 
 #include "coupledPointPatchField.H"
 #include "cyclicAMIPointPatch.H"
-#include "PrimitivePatchInterpolation.H"
+#include "primitivePatchInterpolation.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
diff --git a/src/meshTools/algorithms/PatchEdgeFaceWave/PatchEdgeFaceWave.H b/src/meshTools/algorithms/PatchEdgeFaceWave/PatchEdgeFaceWave.H
index e96c54e1ef1..0a59fb7ac81 100644
--- a/src/meshTools/algorithms/PatchEdgeFaceWave/PatchEdgeFaceWave.H
+++ b/src/meshTools/algorithms/PatchEdgeFaceWave/PatchEdgeFaceWave.H
@@ -42,7 +42,7 @@ SourceFiles
 
 #include "bitSet.H"
 #include "scalarField.H"
-#include "PrimitivePatch.H"
+#include "primitivePatch.H"
 #include "vectorTensorTransform.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
diff --git a/src/meshTools/edgeMesh/extendedEdgeMesh/extendedEdgeMesh.H b/src/meshTools/edgeMesh/extendedEdgeMesh/extendedEdgeMesh.H
index f495b8e8f64..254b48969b5 100644
--- a/src/meshTools/edgeMesh/extendedEdgeMesh/extendedEdgeMesh.H
+++ b/src/meshTools/edgeMesh/extendedEdgeMesh/extendedEdgeMesh.H
@@ -56,14 +56,14 @@ SourceFiles
 
 \*---------------------------------------------------------------------------*/
 
-#ifndef extendedEdgeMesh_H
-#define extendedEdgeMesh_H
+#ifndef Foam_extendedEdgeMesh_H
+#define Foam_extendedEdgeMesh_H
 
 #include "edgeMesh.H"
 #include "indexedOctree.H"
 #include "treeDataEdge.H"
 #include "treeDataPoint.H"
-#include "PrimitivePatch.H"
+#include "primitivePatch.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
diff --git a/src/meshTools/indexedOctree/treeDataPrimitivePatch.C b/src/meshTools/indexedOctree/treeDataPrimitivePatch.C
index 74d7a764485..7cafbe5dc30 100644
--- a/src/meshTools/indexedOctree/treeDataPrimitivePatch.C
+++ b/src/meshTools/indexedOctree/treeDataPrimitivePatch.C
@@ -199,9 +199,9 @@ Foam::volumeType Foam::treeDataPrimitivePatch<PatchType>::getVolumeType
             << " nearest face:" << facei;
     }
 
-    const typename PatchType::face_type& localF = patch_.localFaces()[facei];
-    const typename PatchType::face_type& f = patch_[facei];
-    const pointField& points = patch_.points();
+    const auto& localF = patch_.localFaces()[facei];
+    const auto& f = patch_[facei];
+    const auto& points = patch_.points();
 
     // Retest to classify where on face info is. Note: could be improved. We
     // already have point.
@@ -412,8 +412,8 @@ bool Foam::treeDataPrimitivePatch<PatchType>::overlaps
 
     // 2. Check if one or more face points inside
 
-    const pointField& points = patch_.points();
-    const typename PatchType::face_type& f = patch_[index];
+    const auto& points = patch_.points();
+    const auto& f = patch_[index];
 
     if (f.size() == 3)
     {
@@ -469,8 +469,8 @@ bool Foam::treeDataPrimitivePatch<PatchType>::overlaps
         return false;
     }
 
-    const pointField& points = patch_.points();
-    const face& f = patch_[index];
+    const auto& points = patch_.points();
+    const auto& f = patch_[index];
 
     pointHit nearHit = f.nearestPoint(centre, points);
 
@@ -498,11 +498,11 @@ void Foam::treeDataPrimitivePatch<PatchType>::findNearest
     point& nearestPoint
 ) const
 {
-    const pointField& points = patch_.points();
+    const auto& points = patch_.points();
 
     for (const label index : indices)
     {
-        const typename PatchType::face_type& f = patch_[index];
+        const auto& f = patch_[index];
 
         const pointHit nearHit = f.nearestPoint(sample, points);
         const scalar distSqr = sqr(nearHit.distance());
@@ -606,7 +606,7 @@ bool Foam::treeDataPrimitivePatch<PatchType>::findSelfIntersectOp::operator()
     const treeDataPrimitivePatch<PatchType>& shape = tree_.shapes();
     const PatchType& patch = shape.patch();
 
-    const typename PatchType::face_type& f = patch.localFaces()[index];
+    const auto& f = patch.localFaces()[index];
     const edge& e = patch.edges()[edgeID_];
 
     if (!f.found(e[0]) && !f.found(e[1]))
@@ -631,8 +631,8 @@ bool Foam::treeDataPrimitivePatch<PatchType>::findIntersection
     const treeDataPrimitivePatch<PatchType>& shape = tree.shapes();
     const PatchType& patch = shape.patch();
 
-    const pointField& points = patch.points();
-    const typename PatchType::face_type& f = patch[index];
+    const auto& points = patch.points();
+    const auto& f = patch[index];
 
     // Do quick rejection test
     if (shape.cacheBb_)
diff --git a/src/meshTools/meshTools/meshTools.H b/src/meshTools/meshTools/meshTools.H
index fd5996864d5..007d3b519de 100644
--- a/src/meshTools/meshTools/meshTools.H
+++ b/src/meshTools/meshTools/meshTools.H
@@ -34,14 +34,13 @@ SourceFiles
 
 \*---------------------------------------------------------------------------*/
 
-#ifndef meshTools_H
-#define meshTools_H
+#ifndef Foam_meshTools_H
+#define Foam_meshTools_H
 
 #include "label.H"
 #include "vector.H"
 #include "triad.H"
 #include "labelList.H"
-#include "pointField.H"
 #include "faceList.H"
 #include "cellList.H"
 #include "primitivePatch.H"
@@ -51,6 +50,7 @@ SourceFiles
 namespace Foam
 {
 
+// Forward Declarations
 class polyMesh;
 class primitiveMesh;
 class treeBoundBox;
diff --git a/src/optimisation/adjointOptimisation/adjoint/optimisation/adjointSensitivity/incompressible/sensitivityBezier/sensitivityBezierIncompressible.H b/src/optimisation/adjointOptimisation/adjoint/optimisation/adjointSensitivity/incompressible/sensitivityBezier/sensitivityBezierIncompressible.H
index c31b3ff5edb..0422edadeb3 100644
--- a/src/optimisation/adjointOptimisation/adjoint/optimisation/adjointSensitivity/incompressible/sensitivityBezier/sensitivityBezierIncompressible.H
+++ b/src/optimisation/adjointOptimisation/adjoint/optimisation/adjointSensitivity/incompressible/sensitivityBezier/sensitivityBezierIncompressible.H
@@ -25,7 +25,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/>.
 
-
 Class
     Foam::incompressible::sensitivityBezier
 
@@ -37,8 +36,8 @@ SourceFiles
 
 \*---------------------------------------------------------------------------*/
 
-#ifndef sensitivityBezierIncompressible_H
-#define sensitivityBezierIncompressible_H
+#ifndef Foam_sensitivityBezierIncompressible_H
+#define Foam_sensitivityBezierIncompressible_H
 
 #include "primitiveFieldsFwd.H"
 #include "volFieldsFwd.H"
@@ -46,8 +45,7 @@ SourceFiles
 #include "surfaceFieldsFwd.H"
 #include "volPointInterpolation.H"
 #include "SIBaseIncompressible.H"
-#include "PrimitivePatchInterpolation.H"
-#include "PrimitivePatch.H"
+#include "primitivePatchInterpolation.H"
 #include "deltaBoundary.H"
 #include "Bezier.H"
 
diff --git a/src/optimisation/adjointOptimisation/adjoint/optimisation/adjointSensitivity/incompressible/sensitivityBezierFI/sensitivityBezierFIIncompressible.H b/src/optimisation/adjointOptimisation/adjoint/optimisation/adjointSensitivity/incompressible/sensitivityBezierFI/sensitivityBezierFIIncompressible.H
index 9f83d24fb53..56df11726d2 100644
--- a/src/optimisation/adjointOptimisation/adjoint/optimisation/adjointSensitivity/incompressible/sensitivityBezierFI/sensitivityBezierFIIncompressible.H
+++ b/src/optimisation/adjointOptimisation/adjoint/optimisation/adjointSensitivity/incompressible/sensitivityBezierFI/sensitivityBezierFIIncompressible.H
@@ -46,7 +46,7 @@ SourceFiles
 #include "surfaceFieldsFwd.H"
 #include "volPointInterpolation.H"
 #include "FIBaseIncompressible.H"
-#include "PrimitivePatchInterpolation.H"
+#include "primitivePatchInterpolation.H"
 #include "deltaBoundary.H"
 #include "Bezier.H"
 
diff --git a/src/optimisation/adjointOptimisation/adjoint/optimisation/adjointSensitivity/incompressible/sensitivitySurface/sensitivitySurfaceIncompressible.C b/src/optimisation/adjointOptimisation/adjoint/optimisation/adjointSensitivity/incompressible/sensitivitySurface/sensitivitySurfaceIncompressible.C
index 5914db07984..8844079cfd2 100644
--- a/src/optimisation/adjointOptimisation/adjoint/optimisation/adjointSensitivity/incompressible/sensitivitySurface/sensitivitySurfaceIncompressible.C
+++ b/src/optimisation/adjointOptimisation/adjoint/optimisation/adjointSensitivity/incompressible/sensitivitySurface/sensitivitySurfaceIncompressible.C
@@ -29,7 +29,7 @@ License
 
 #include "sensitivitySurfaceIncompressible.H"
 #include "incompressibleAdjointSolver.H"
-#include "PrimitivePatchInterpolation.H"
+#include "primitivePatchInterpolation.H"
 #include "syncTools.H"
 #include "addToRunTimeSelectionTable.H"
 #include "faMatrices.H"
diff --git a/src/optimisation/adjointOptimisation/adjoint/parameterization/Bezier/Bezier.H b/src/optimisation/adjointOptimisation/adjoint/parameterization/Bezier/Bezier.H
index 00470e76164..3d3896ac228 100644
--- a/src/optimisation/adjointOptimisation/adjoint/parameterization/Bezier/Bezier.H
+++ b/src/optimisation/adjointOptimisation/adjoint/parameterization/Bezier/Bezier.H
@@ -36,16 +36,15 @@ SourceFiles
 
 \*---------------------------------------------------------------------------*/
 
-#ifndef Bezier_H
-#define Bezier_H
+#ifndef Foam_Bezier_H
+#define Foam_Bezier_H
 
 #include "primitiveFieldsFwd.H"
 #include "volFieldsFwd.H"
 #include "pointFieldsFwd.H"
 #include "surfaceFieldsFwd.H"
 #include "volPointInterpolation.H"
-#include "PrimitivePatchInterpolation.H"
-#include "PrimitivePatch.H"
+#include "primitivePatchInterpolation.H"
 #include "deltaBoundary.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
diff --git a/src/sampling/sampledSurface/sampledPatchInternalField/sampledPatchInternalFieldTemplates.C b/src/sampling/sampledSurface/sampledPatchInternalField/sampledPatchInternalFieldTemplates.C
index 97943c9abe7..4d5e5d2d408 100644
--- a/src/sampling/sampledSurface/sampledPatchInternalField/sampledPatchInternalFieldTemplates.C
+++ b/src/sampling/sampledSurface/sampledPatchInternalField/sampledPatchInternalFieldTemplates.C
@@ -28,7 +28,7 @@ License
 
 #include "sampledPatchInternalField.H"
 #include "interpolationCellPoint.H"
-#include "PrimitivePatchInterpolation.H"
+#include "primitivePatchInterpolation.H"
 
 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
 
diff --git a/src/surfMesh/MeshedSurface/MeshedSurface.H b/src/surfMesh/MeshedSurface/MeshedSurface.H
index 87c7181ee6d..8f7214257e3 100644
--- a/src/surfMesh/MeshedSurface/MeshedSurface.H
+++ b/src/surfMesh/MeshedSurface/MeshedSurface.H
@@ -52,12 +52,11 @@ SourceFiles
 
 \*---------------------------------------------------------------------------*/
 
-#ifndef MeshedSurface_H
-#define MeshedSurface_H
+#ifndef Foam_MeshedSurface_H
+#define Foam_MeshedSurface_H
 
-#include "PrimitivePatch.H"
+#include "primitivePatch.H"
 #include "PatchTools.H"
-#include "pointField.H"
 #include "face.H"
 #include "labelledTri.H"
 #include "bitSet.H"
diff --git a/src/surfMesh/polySurface/polySurface.H b/src/surfMesh/polySurface/polySurface.H
index 2a23c6fe0fd..3256c2ec681 100644
--- a/src/surfMesh/polySurface/polySurface.H
+++ b/src/surfMesh/polySurface/polySurface.H
@@ -42,7 +42,7 @@ SourceFiles
 #define Foam_polySurface_H
 
 #include "objectRegistry.H"
-#include "PrimitivePatch.H"
+#include "primitivePatch.H"
 #include "meshedSurf.H"
 #include "polySurfaceFieldsFwd.H"
 
diff --git a/src/surfMesh/surfMesh/surfMesh.H b/src/surfMesh/surfMesh/surfMesh.H
index e324a1ebafe..078126c0981 100644
--- a/src/surfMesh/surfMesh/surfMesh.H
+++ b/src/surfMesh/surfMesh/surfMesh.H
@@ -43,7 +43,7 @@ SourceFiles
 
 #include "surfaceRegistry.H"
 #include "MeshedSurfaceIOAllocator.H"
-#include "PrimitivePatch.H"
+#include "primitivePatch.H"
 #include "surfZoneIOList.H"
 #include "surfFieldsFwd.H"
 
diff --git a/src/surfMesh/surfaceFormats/ac3d/AC3DsurfaceFormat.C b/src/surfMesh/surfaceFormats/ac3d/AC3DsurfaceFormat.C
index 46a401ba080..6e84873870c 100644
--- a/src/surfMesh/surfaceFormats/ac3d/AC3DsurfaceFormat.C
+++ b/src/surfMesh/surfaceFormats/ac3d/AC3DsurfaceFormat.C
@@ -28,7 +28,7 @@ License
 
 #include "AC3DsurfaceFormat.H"
 #include "StringStream.H"
-#include "PrimitivePatch.H"
+#include "primitivePatch.H"
 #include "faceTraits.H"
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
diff --git a/src/surfMesh/triSurface/triSurface.H b/src/surfMesh/triSurface/triSurface.H
index 899d76ecd99..f8f0b4519f6 100644
--- a/src/surfMesh/triSurface/triSurface.H
+++ b/src/surfMesh/triSurface/triSurface.H
@@ -38,12 +38,11 @@ SourceFiles
 
 \*---------------------------------------------------------------------------*/
 
-#ifndef triSurface_H
-#define triSurface_H
+#ifndef Foam_triSurface_H
+#define Foam_triSurface_H
 
-#include "PrimitivePatch.H"
+#include "primitivePatch.H"
 #include "PatchTools.H"
-#include "pointField.H"
 #include "labelledTri.H"
 #include "boolList.H"
 #include "bitSet.H"
-- 
GitLab