From 87cb811db29c4d01a0dbd5ef5af0859ee3ca35d2 Mon Sep 17 00:00:00 2001
From: Mark Olesen <Mark.Olesen@esi-group.com>
Date: Thu, 18 May 2023 18:53:40 +0200
Subject: [PATCH] COMP: fix library linkage (#2784), silence some unused
 variable warnings

---
 .../mesh/conversion/kivaToFoam/readKivaGrid.H |  8 ++---
 .../DelaunayMesh/DelaunayMeshIO.C             | 36 +++++++++----------
 .../DelaunayMesh/DistributedDelaunayMesh.C    |  4 +--
 .../cellShapeControl/cellShapeControl.C       | 30 ++++++++--------
 .../controlMeshRefinement.C                   |  4 +--
 .../featurePointConformerSpecialisations.C    |  8 ++---
 .../foamToVTK/convertAreaFields.H             |  2 +-
 .../surfaceBooleanFeatures.C                  | 10 +++---
 .../surface/surfaceClean/collapseBase.C       |  4 +--
 src/conversion/starcd/STARCDMeshReader.C      |  3 +-
 src/fileFormats/vtk/part/foamVtuSizingImpl.C  |  4 +--
 .../cfdTools/general/MRF/MRFZone.C            |  8 ++---
 .../regionSizeDistribution.C                  |  6 ++--
 .../utilities/vtkWrite/vtkWriteImpl.C         |  2 --
 .../MGridGenGamgAgglomeration/Make/options    |  7 ++++
 .../pairPatchAgglomeration/Make/options       | 12 ++++---
 .../pairPatchAgglomeration.H                  |  4 +--
 .../displacementMotionSolverMeshMover.C       |  4 +--
 .../meshRefinement/meshRefinementBaffles.C    | 10 +++---
 .../meshRefinementProblemCells.C              | 28 +++++++--------
 .../refinementSurfaces/refinementSurfaces.C   |  4 +--
 .../extendedEdgeMesh/extendedEdgeMesh.C       |  8 ++---
 src/meshTools/regionSplit/localPointRegion.C  |  4 +--
 .../cellSources/regionToCell/regionToCell.C   |  9 +++--
 .../inverseDistanceCellCellStencil.C          |  4 +--
 .../oversetAdjustPhi/oversetAdjustPhi.C       |  4 +++
 src/overset/oversetFvMesh/oversetFvMeshBase.C | 21 ++++-------
 .../oversetFvMeshBaseTemplates.C              |  4 +--
 src/overset/regionsToCell/regionsToCell.C     | 10 +++---
 .../distributedTriSurfaceMesh.C               | 10 +++---
 .../exact/exactPatchDistMethod.C              |  4 +--
 31 files changed, 140 insertions(+), 136 deletions(-)

diff --git a/applications/utilities/mesh/conversion/kivaToFoam/readKivaGrid.H b/applications/utilities/mesh/conversion/kivaToFoam/readKivaGrid.H
index ca08396837c..3aabf9614af 100644
--- a/applications/utilities/mesh/conversion/kivaToFoam/readKivaGrid.H
+++ b/applications/utilities/mesh/conversion/kivaToFoam/readKivaGrid.H
@@ -42,7 +42,7 @@ for (label i=0; i<nPoints; i++)
 labelList i1tab(nPoints), i3tab(nPoints), i8tab(nPoints), idreg(nPoints),
       f(nPoints), bcl(nPoints), bcf(nPoints), bcb(nPoints);
 
-label nBfaces = 0;
+// label nBfaces = 0;
 
 for (label i=0; i<nPoints; i++)
 {
@@ -65,9 +65,9 @@ for (label i=0; i<nPoints; i++)
     bcf[i] = label(fbcf);
     bcb[i] = label(fbcb);
 
-    if (bcl[i] > 0 && bcl[i] != 4) nBfaces++;
-    if (bcf[i] > 0 && bcf[i] != 4) nBfaces++;
-    if (bcb[i] > 0 && bcb[i] != 4) nBfaces++;
+    // if (bcl[i] > 0 && bcl[i] != 4) ++nBfaces;
+    // if (bcf[i] > 0 && bcf[i] != 4) ++nBfaces;
+    // if (bcb[i] > 0 && bcb[i] != 4) ++nBfaces;
 }
 
 
diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/DelaunayMesh/DelaunayMeshIO.C b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/DelaunayMesh/DelaunayMeshIO.C
index 2dc3f599281..4f732312868 100644
--- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/DelaunayMesh/DelaunayMeshIO.C
+++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/DelaunayMesh/DelaunayMeshIO.C
@@ -170,23 +170,23 @@ template<class Triangulation>
 void Foam::DelaunayMesh<Triangulation>::printVertexInfo(Ostream& os) const
 {
     label nInternal = 0;
-    label nInternalRef = 0;
+    //label nInternalRef = 0;
     label nUnassigned = 0;
-    label nUnassignedRef = 0;
+    //label nUnassignedRef = 0;
     label nInternalNearBoundary = 0;
-    label nInternalNearBoundaryRef = 0;
+    //label nInternalNearBoundaryRef = 0;
     label nInternalSurface = 0;
-    label nInternalSurfaceRef = 0;
+    //label nInternalSurfaceRef = 0;
     label nInternalFeatureEdge = 0;
-    label nInternalFeatureEdgeRef = 0;
+    //label nInternalFeatureEdgeRef = 0;
     label nInternalFeaturePoint = 0;
-    label nInternalFeaturePointRef = 0;
+    //label nInternalFeaturePointRef = 0;
     label nExternalSurface = 0;
-    label nExternalSurfaceRef = 0;
+    //label nExternalSurfaceRef = 0;
     label nExternalFeatureEdge = 0;
-    label nExternalFeatureEdgeRef = 0;
+    //label nExternalFeatureEdgeRef = 0;
     label nExternalFeaturePoint = 0;
-    label nExternalFeaturePointRef = 0;
+    //label nExternalFeaturePointRef = 0;
     label nFar = 0;
     label nReferred = 0;
 
@@ -202,7 +202,7 @@ void Foam::DelaunayMesh<Triangulation>::printVertexInfo(Ostream& os) const
             if (vit->referred())
             {
                 nReferred++;
-                nInternalRef++;
+                //++nInternalRef;
             }
 
             nInternal++;
@@ -212,7 +212,7 @@ void Foam::DelaunayMesh<Triangulation>::printVertexInfo(Ostream& os) const
             if (vit->referred())
             {
                 nReferred++;
-                nUnassignedRef++;
+                //++nUnassignedRef;
             }
 
             nUnassigned++;
@@ -222,7 +222,7 @@ void Foam::DelaunayMesh<Triangulation>::printVertexInfo(Ostream& os) const
             if (vit->referred())
             {
                 nReferred++;
-                nInternalNearBoundaryRef++;
+                //++nInternalNearBoundaryRef;
             }
 
             nInternalNearBoundary++;
@@ -232,7 +232,7 @@ void Foam::DelaunayMesh<Triangulation>::printVertexInfo(Ostream& os) const
             if (vit->referred())
             {
                 nReferred++;
-                nInternalSurfaceRef++;
+                //++nInternalSurfaceRef;
             }
 
             nInternalSurface++;
@@ -242,7 +242,7 @@ void Foam::DelaunayMesh<Triangulation>::printVertexInfo(Ostream& os) const
             if (vit->referred())
             {
                 nReferred++;
-                nInternalFeatureEdgeRef++;
+                //++nInternalFeatureEdgeRef;
             }
 
             nInternalFeatureEdge++;
@@ -252,7 +252,7 @@ void Foam::DelaunayMesh<Triangulation>::printVertexInfo(Ostream& os) const
             if (vit->referred())
             {
                 nReferred++;
-                nInternalFeaturePointRef++;
+                //++nInternalFeaturePointRef;
             }
 
             nInternalFeaturePoint++;
@@ -262,7 +262,7 @@ void Foam::DelaunayMesh<Triangulation>::printVertexInfo(Ostream& os) const
             if (vit->referred())
             {
                 nReferred++;
-                nExternalSurfaceRef++;
+                //++nExternalSurfaceRef;
             }
 
             nExternalSurface++;
@@ -272,7 +272,7 @@ void Foam::DelaunayMesh<Triangulation>::printVertexInfo(Ostream& os) const
             if (vit->referred())
             {
                 nReferred++;
-                nExternalFeatureEdgeRef++;
+                //++nExternalFeatureEdgeRef;
             }
 
             nExternalFeatureEdge++;
@@ -282,7 +282,7 @@ void Foam::DelaunayMesh<Triangulation>::printVertexInfo(Ostream& os) const
             if (vit->referred())
             {
                 nReferred++;
-                nExternalFeaturePointRef++;
+                //++nExternalFeaturePointRef;
             }
 
             nExternalFeaturePoint++;
diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/DelaunayMesh/DistributedDelaunayMesh.C b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/DelaunayMesh/DistributedDelaunayMesh.C
index 01c14c7060e..2c50d6c462b 100644
--- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/DelaunayMesh/DistributedDelaunayMesh.C
+++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/DelaunayMesh/DistributedDelaunayMesh.C
@@ -853,7 +853,7 @@ Foam::DistributedDelaunayMesh<Triangulation>::rangeInsertReferredWithInfo
     typename Triangulation::Locate_type lt;
     int li, lj;
 
-    label nNotInserted = 0;
+    //label nNotInserted = 0;
 
     labelPairHashSet uninserted
     (
@@ -979,7 +979,7 @@ Foam::DistributedDelaunayMesh<Triangulation>::rangeInsertReferredWithInfo
         else
         {
             uninserted.insert(labelPair(vert.procIndex(), vert.index()));
-            nNotInserted++;
+            //++nNotInserted;
         }
     }
 
diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellShapeControl/cellShapeControl/cellShapeControl.C b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellShapeControl/cellShapeControl/cellShapeControl.C
index 8b5d394e19e..cb7a6208c66 100644
--- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellShapeControl/cellShapeControl/cellShapeControl.C
+++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellShapeControl/cellShapeControl/cellShapeControl.C
@@ -104,7 +104,7 @@ Foam::scalar Foam::cellShapeControl::cellSize(const point& pt) const
     }
     else if (shapeControlMesh_.is_infinite(ch))
     {
-//        if (nFarPoints != 0)
+//        if (nFarPoints)
 //        {
 //            for (label pI = 0; pI < 4; ++pI)
 //            {
@@ -136,11 +136,11 @@ Foam::scalar Foam::cellShapeControl::cellSize(const point& pt) const
         {
             if (ch->vertex(pI)->farPoint())
             {
-                nFarPoints++;
+                ++nFarPoints;
             }
         }
 
-        if (nFarPoints != 0)
+        if (nFarPoints)
         {
             for (label pI = 0; pI < 4; ++pI)
             {
@@ -179,16 +179,16 @@ Foam::tensor Foam::cellShapeControl::cellAlignment(const point& pt) const
     }
     else
     {
-        label nFarPoints = 0;
-        for (label pI = 0; pI < 4; ++pI)
-        {
-            if (ch->vertex(pI)->farPoint())
-            {
-                nFarPoints++;
-            }
-        }
-
-//        if (nFarPoints != 0)
+        // label nFarPoints = 0;
+        // for (label pI = 0; pI < 4; ++pI)
+        // {
+        //     if (ch->vertex(pI)->farPoint())
+        //     {
+        //         ++nFarPoints;
+        //     }
+        // }
+
+//        if (nFarPoints)
 //        {
 //            for (label pI = 0; pI < 4; ++pI)
 //            {
@@ -259,11 +259,11 @@ void Foam::cellShapeControl::cellSizeAndAlignment
         {
             if (ch->vertex(pI)->farPoint())
             {
-                nFarPoints++;
+                ++nFarPoints;
             }
         }
 
-        if (nFarPoints != 0)
+        if (nFarPoints)
         {
             for (label pI = 0; pI < 4; ++pI)
             {
diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellShapeControl/controlMeshRefinement/controlMeshRefinement.C b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellShapeControl/controlMeshRefinement/controlMeshRefinement.C
index 313a039a7b1..3aee2b34338 100644
--- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellShapeControl/controlMeshRefinement/controlMeshRefinement.C
+++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellShapeControl/controlMeshRefinement/controlMeshRefinement.C
@@ -82,11 +82,11 @@ bool Foam::controlMeshRefinement::detectEdge
 
     Foam::point midPoint = (a + b)/2.0;
 
-    label nIterations = 0;
+    //label nIterations = 0;
 
     while (true)
     {
-        nIterations++;
+        //++nIterations;
 
         if
         (
diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/featurePointConformer/featurePointConformerSpecialisations.C b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/featurePointConformer/featurePointConformerSpecialisations.C
index bd274824f34..3f8d6f104a9 100644
--- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/featurePointConformer/featurePointConformerSpecialisations.C
+++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/featurePointConformer/featurePointConformerSpecialisations.C
@@ -74,7 +74,7 @@ bool Foam::featurePointConformer::createSpecialisedFeaturePoint
             return false;
         }
 
-        label nVert = foamyHexMesh_.number_of_vertices();
+        //label nVert = foamyHexMesh_.number_of_vertices();
 
         const label initialNumOfPoints = pts.size();
 
@@ -267,7 +267,7 @@ bool Foam::featurePointConformer::createSpecialisedFeaturePoint
 
                 // Remove points that have just been added before returning
                 pts.pop_back(2);
-                nVert -= 2;
+                //nVert -= 2;
 
                 return false;
             }
@@ -503,7 +503,7 @@ bool Foam::featurePointConformer::createSpecialisedFeaturePoint
             return false;
         }
 
-        label nVert = foamyHexMesh_.number_of_vertices();
+        //label nVert = foamyHexMesh_.number_of_vertices();
 
         const label initialNumOfPoints = pts.size();
 
@@ -700,7 +700,7 @@ bool Foam::featurePointConformer::createSpecialisedFeaturePoint
 
                 // Remove points that have just been added before returning
                 pts.pop_back(2);
-                nVert -= 2;
+                //nVert -= 2;
 
                 return false;
             }
diff --git a/applications/utilities/postProcessing/dataConversion/foamToVTK/convertAreaFields.H b/applications/utilities/postProcessing/dataConversion/foamToVTK/convertAreaFields.H
index bdfe96ceb5a..7d8f467ab7a 100644
--- a/applications/utilities/postProcessing/dataConversion/foamToVTK/convertAreaFields.H
+++ b/applications/utilities/postProcessing/dataConversion/foamToVTK/convertAreaFields.H
@@ -81,7 +81,7 @@ if (doFiniteArea)
 
             labelList patchIds
             (
-                areaMesh.mesh().boundaryMesh().patchID(areaMesh.faceLabels())
+                pbm.patchID(areaMesh.faceLabels())
             );
 
             writer.writeCellData("patchID", patchIds);
diff --git a/applications/utilities/surface/surfaceBooleanFeatures/surfaceBooleanFeatures.C b/applications/utilities/surface/surfaceBooleanFeatures/surfaceBooleanFeatures.C
index 5cc5d909e5a..b7f2715b253 100644
--- a/applications/utilities/surface/surfaceBooleanFeatures/surfaceBooleanFeatures.C
+++ b/applications/utilities/surface/surfaceBooleanFeatures/surfaceBooleanFeatures.C
@@ -1408,7 +1408,7 @@ autoPtr<extendedFeatureEdgeMesh> createEdgeMesh
     label nIntOrExt = 0;
     label nFlat = 0;
     label nOpen = 0;
-    label nMultiple = 0;
+    // label nMultiple = 0;
 
     forAll(edgeNormals, eI)
     {
@@ -1432,10 +1432,10 @@ autoPtr<extendedFeatureEdgeMesh> createEdgeMesh
                 nIntOrExt++;
             }
         }
-        else if (nEdNorms > 2)
-        {
-            nMultiple++;
-        }
+        // else if (nEdNorms > 2)
+        // {
+        //     ++nMultiple;
+        // }
     }
 
     if (action == booleanSurface::UNION)
diff --git a/applications/utilities/surface/surfaceClean/collapseBase.C b/applications/utilities/surface/surfaceClean/collapseBase.C
index 5c5572c23b5..7ba52a00106 100644
--- a/applications/utilities/surface/surfaceClean/collapseBase.C
+++ b/applications/utilities/surface/surfaceClean/collapseBase.C
@@ -775,7 +775,7 @@ label collapseBase
 {
     label nTotalSplit = 0;
 
-    label iter = 0;
+    // label iter = 0;
 
     while (true)
     {
@@ -980,7 +980,7 @@ label collapseBase
         //    surf.write(fName);
         //}
 
-        iter++;
+        // ++iter;
     }
 
     // Remove any unused vertices
diff --git a/src/conversion/starcd/STARCDMeshReader.C b/src/conversion/starcd/STARCDMeshReader.C
index b17252ac7d0..d69fcdc46ab 100644
--- a/src/conversion/starcd/STARCDMeshReader.C
+++ b/src/conversion/starcd/STARCDMeshReader.C
@@ -697,7 +697,8 @@ void Foam::fileFormats::STARCDMeshReader::readBoundary
     // keep empty patch region in reserve
     ++nPatches;
     Info<< "Number of patches = " << nPatches
-        << " (including extra for missing)" << endl;
+        << " (including extra for missing) with "
+        << nFaces << " faces" << endl;
 
     // resize
     origRegion.setSize(nPatches);
diff --git a/src/fileFormats/vtk/part/foamVtuSizingImpl.C b/src/fileFormats/vtk/part/foamVtuSizingImpl.C
index ea834692515..b1d763d2c47 100644
--- a/src/fileFormats/vtk/part/foamVtuSizingImpl.C
+++ b/src/fileFormats/vtk/part/foamVtuSizingImpl.C
@@ -756,7 +756,7 @@ void Foam::vtk::vtuSizing::populateArrays
 
     const label nInputCells = shapes.size();
 
-    label nIgnored = 0;
+    // label nIgnored = 0;
 
     for
     (
@@ -852,7 +852,7 @@ void Foam::vtk::vtuSizing::populateArrays
             // Silent here.
             // - already complained (and skipped) during initial sizing
             --cellIndex;
-            ++nIgnored;
+            // ++nIgnored;
         }
     }
 
diff --git a/src/finiteVolume/cfdTools/general/MRF/MRFZone.C b/src/finiteVolume/cfdTools/general/MRF/MRFZone.C
index 90e91ede074..4244ee7f79d 100644
--- a/src/finiteVolume/cfdTools/general/MRF/MRFZone.C
+++ b/src/finiteVolume/cfdTools/general/MRF/MRFZone.C
@@ -75,14 +75,14 @@ void Foam::MRFZone::setMRFFaces()
     }
 
 
-    label nZoneFaces = 0;
+    // label nZoneFaces = 0;
 
     for (label facei = 0; facei < mesh_.nInternalFaces(); facei++)
     {
         if (zoneCell[own[facei]] || zoneCell[nei[facei]])
         {
             faceType[facei] = 1;
-            nZoneFaces++;
+            // ++nZoneFaces;
         }
     }
 
@@ -102,7 +102,7 @@ void Foam::MRFZone::setMRFFaces()
                 if (zoneCell[own[facei]])
                 {
                     faceType[facei] = 2;
-                    nZoneFaces++;
+                    // ++nZoneFaces;
                 }
             }
         }
@@ -115,7 +115,7 @@ void Foam::MRFZone::setMRFFaces()
                 if (zoneCell[own[facei]])
                 {
                     faceType[facei] = 1;
-                    nZoneFaces++;
+                    // ++nZoneFaces;
                 }
             }
         }
diff --git a/src/functionObjects/field/regionSizeDistribution/regionSizeDistribution.C b/src/functionObjects/field/regionSizeDistribution/regionSizeDistribution.C
index 3b55fda4d5d..ebdf67cf782 100644
--- a/src/functionObjects/field/regionSizeDistribution/regionSizeDistribution.C
+++ b/src/functionObjects/field/regionSizeDistribution/regionSizeDistribution.C
@@ -474,7 +474,7 @@ bool Foam::functionObjects::regionSizeDistribution::write()
 
     // Determine blocked faces
     boolList blockedFace(mesh_.nFaces(), false);
-    label nBlocked = 0;
+    // label nBlocked = 0;
 
     {
         for (label facei = 0; facei < mesh_.nInternalFaces(); facei++)
@@ -489,7 +489,7 @@ bool Foam::functionObjects::regionSizeDistribution::write()
             )
             {
                 blockedFace[facei] = true;
-                nBlocked++;
+                // ++nBlocked;
             }
         }
 
@@ -518,7 +518,7 @@ bool Foam::functionObjects::regionSizeDistribution::write()
                     )
                     {
                         blockedFace[start+i] = true;
-                        nBlocked++;
+                        // ++nBlocked;
                     }
                 }
             }
diff --git a/src/functionObjects/utilities/vtkWrite/vtkWriteImpl.C b/src/functionObjects/utilities/vtkWrite/vtkWriteImpl.C
index 450cd6fcef7..66400af4bec 100644
--- a/src/functionObjects/utilities/vtkWrite/vtkWriteImpl.C
+++ b/src/functionObjects/utilities/vtkWrite/vtkWriteImpl.C
@@ -58,12 +58,10 @@ Foam::label Foam::functionObjects::vtkWrite::writeVolFieldsImpl
         }
 
         // Boundary
-        label writeri = 0;
         for (vtk::patchWriter& writer : patchWriters)
         {
             ok = true;
             writer.write(field);
-            ++writeri;
         }
 
         if (ok)
diff --git a/src/fvAgglomerationMethods/MGridGenGamgAgglomeration/Make/options b/src/fvAgglomerationMethods/MGridGenGamgAgglomeration/Make/options
index 7fd6b0ae766..a64d63749e2 100644
--- a/src/fvAgglomerationMethods/MGridGenGamgAgglomeration/Make/options
+++ b/src/fvAgglomerationMethods/MGridGenGamgAgglomeration/Make/options
@@ -1,6 +1,13 @@
 EXE_INC = \
+    -I$(LIB_SRC)/fileFormats/lnInclude \
+    -I$(LIB_SRC)/surfMesh/lnInclude \
+    -I$(LIB_SRC)/meshTools/lnInclude \
     -I$(LIB_SRC)/finiteVolume/lnInclude \
     -I$(MGRIDGEN_INC_DIR)
 
 LIB_LIBS = \
+    -lfileFormats \
+    -lsurfMesh \
+    -lmeshTools \
+    -lfiniteVolume \
     -L$(MGRIDGEN_LIB_DIR) -lmgrid
diff --git a/src/fvAgglomerationMethods/pairPatchAgglomeration/Make/options b/src/fvAgglomerationMethods/pairPatchAgglomeration/Make/options
index 7063a63df5f..440b98532ec 100644
--- a/src/fvAgglomerationMethods/pairPatchAgglomeration/Make/options
+++ b/src/fvAgglomerationMethods/pairPatchAgglomeration/Make/options
@@ -1,9 +1,11 @@
 EXE_INC = \
     -I$(LIB_SRC)/fileFormats/lnInclude \
-    -I$(LIB_SRC)/finiteVolume/lnInclude \
-    -I$(LIB_SRC)/meshTools/lnInclude
+    -I$(LIB_SRC)/surfMesh/lnInclude \
+    -I$(LIB_SRC)/meshTools/lnInclude \
+    -I$(LIB_SRC)/finiteVolume/lnInclude
 
 LIB_LIBS = \
-    -lOpenFOAM \
-    -lfiniteVolume \
-    -lmeshTools
+    -lfileFormats \
+    -lsurfMesh \
+    -lmeshTools \
+    -lfiniteVolume
diff --git a/src/fvAgglomerationMethods/pairPatchAgglomeration/pairPatchAgglomeration.H b/src/fvAgglomerationMethods/pairPatchAgglomeration/pairPatchAgglomeration.H
index ac564b2b915..9733c48f8f3 100644
--- a/src/fvAgglomerationMethods/pairPatchAgglomeration/pairPatchAgglomeration.H
+++ b/src/fvAgglomerationMethods/pairPatchAgglomeration/pairPatchAgglomeration.H
@@ -35,8 +35,8 @@ SourceFiles
 
 \*---------------------------------------------------------------------------*/
 
-#ifndef pairPatchAgglomeration_H
-#define pairPatchAgglomeration_H
+#ifndef Foam_pairPatchAgglomeration_H
+#define Foam_pairPatchAgglomeration_H
 
 #include "mathematicalConstants.H"
 #include "indirectPrimitivePatch.H"
diff --git a/src/mesh/snappyHexMesh/externalDisplacementMeshMover/displacementMotionSolverMeshMover.C b/src/mesh/snappyHexMesh/externalDisplacementMeshMover/displacementMotionSolverMeshMover.C
index 070d73e2c7c..89d08776ed2 100644
--- a/src/mesh/snappyHexMesh/externalDisplacementMeshMover/displacementMotionSolverMeshMover.C
+++ b/src/mesh/snappyHexMesh/externalDisplacementMeshMover/displacementMotionSolverMeshMover.C
@@ -275,13 +275,13 @@ bool Foam::displacementMotionSolverMeshMover::move
         );
 
 
-        scalar resid = 0;
+        // scalar resid = 0;
 
         forAll(displacement, patchPointI)
         {
             const label pointI(adaptPatchPtr_().meshPoints()[patchPointI]);
 
-            resid += mag(pointDisplacement()[pointI]-displacement[patchPointI]);
+            // resid += mag(pointDisplacement()[pointI]-displacement[patchPointI]);
 
             pointDisplacement()[pointI] = displacement[patchPointI];
         }
diff --git a/src/mesh/snappyHexMesh/meshRefinement/meshRefinementBaffles.C b/src/mesh/snappyHexMesh/meshRefinement/meshRefinementBaffles.C
index c36580ced64..781dd60d091 100644
--- a/src/mesh/snappyHexMesh/meshRefinement/meshRefinementBaffles.C
+++ b/src/mesh/snappyHexMesh/meshRefinement/meshRefinementBaffles.C
@@ -3941,14 +3941,14 @@ Foam::label Foam::meshRefinement::markPatchZones
 
     // Protect all non-manifold edges
     {
-        label nProtected = 0;
+        // label nProtected = 0;
 
         forAll(nMasterFacesPerEdge, edgeI)
         {
             if (nMasterFacesPerEdge[edgeI] > 2)
             {
                 allEdgeInfo[edgeI] = edgeTopoDistanceData<label>(0, -2);
-                nProtected++;
+                // ++nProtected;
             }
         }
         //Info<< "Protected from visiting "
@@ -4097,7 +4097,7 @@ void Foam::meshRefinement::consistentOrientation
     // - slaves of coupled faces
     // - non-manifold edges
     {
-        label nProtected = 0;
+        // label nProtected = 0;
 
         forAll(patch.addressing(), faceI)
         {
@@ -4113,7 +4113,7 @@ void Foam::meshRefinement::consistentOrientation
             {
                 // Slave side. Mark so doesn't get visited.
                 allFaceInfo[faceI] = orientedSurface::NOFLIP;
-                nProtected++;
+                // ++nProtected;
             }
         }
         //Info<< "Protected from visiting "
@@ -4128,7 +4128,7 @@ void Foam::meshRefinement::consistentOrientation
             if (nMasterFacesPerEdge[edgeI] > 2)
             {
                 allEdgeInfo[edgeI] = orientedSurface::NOFLIP;
-                nProtected++;
+                ++nProtected;
             }
         }
 
diff --git a/src/mesh/snappyHexMesh/meshRefinement/meshRefinementProblemCells.C b/src/mesh/snappyHexMesh/meshRefinement/meshRefinementProblemCells.C
index 48f333495a0..0c1c50ba695 100644
--- a/src/mesh/snappyHexMesh/meshRefinement/meshRefinementProblemCells.C
+++ b/src/mesh/snappyHexMesh/meshRefinement/meshRefinementProblemCells.C
@@ -655,7 +655,7 @@ void Foam::meshRefinement::markFacesOnProblemCells
         // Get number of anchor points (pointLevel <= cellLevel)
 
         label nBoundaryAnchors = 0;
-        label nNonAnchorBoundary = 0;
+        // label nNonAnchorBoundary = 0;
         label nonBoundaryAnchor = -1;
 
         for (const label pointi : cPoints)
@@ -673,10 +673,10 @@ void Foam::meshRefinement::markFacesOnProblemCells
                     nonBoundaryAnchor = pointi;
                 }
             }
-            else if (isBoundaryPoint[pointi])
-            {
-                nNonAnchorBoundary++;
-            }
+            // else if (isBoundaryPoint[pointi])
+            // {
+            //     ++nNonAnchorBoundary;
+            // }
         }
 
         if (nBoundaryAnchors == 8)
@@ -684,15 +684,15 @@ void Foam::meshRefinement::markFacesOnProblemCells
             const cell& cFaces = mesh_.cells()[celli];
 
             // Count boundary faces.
-            label nBfaces = 0;
-
-            forAll(cFaces, cFacei)
-            {
-                if (isBoundaryFace[cFaces[cFacei]])
-                {
-                    nBfaces++;
-                }
-            }
+            // label nBfaces = 0;
+            //
+            // forAll(cFaces, cFacei)
+            // {
+            //     if (isBoundaryFace[cFaces[cFacei]])
+            //     {
+            //         ++nBfaces;
+            //     }
+            // }
 
             // If nBfaces > 1 make all non-boundary non-baffle faces baffles.
             // We assume that this situation is where there is a single
diff --git a/src/mesh/snappyHexMesh/refinementSurfaces/refinementSurfaces.C b/src/mesh/snappyHexMesh/refinementSurfaces/refinementSurfaces.C
index 29c101a33cc..8c31035de53 100644
--- a/src/mesh/snappyHexMesh/refinementSurfaces/refinementSurfaces.C
+++ b/src/mesh/snappyHexMesh/refinementSurfaces/refinementSurfaces.C
@@ -64,13 +64,13 @@ Foam::labelList Foam::refinementSurfaces::findHigherLevel
         // 3. uncached : use region 0 value
 
         DynamicList<label> retestSet;
-        label nHits = 0;
+        // label nHits = 0;
 
         forAll(intersectionInfo, i)
         {
             if (intersectionInfo[i].hit())
             {
-                nHits++;
+                // ++nHits;
 
                 // Check if minLevelField for this surface.
                 if (minLevelField.size())
diff --git a/src/meshTools/edgeMesh/extendedEdgeMesh/extendedEdgeMesh.C b/src/meshTools/edgeMesh/extendedEdgeMesh/extendedEdgeMesh.C
index f65587e9f7e..4b71f44950e 100644
--- a/src/meshTools/edgeMesh/extendedEdgeMesh/extendedEdgeMesh.C
+++ b/src/meshTools/edgeMesh/extendedEdgeMesh/extendedEdgeMesh.C
@@ -2109,7 +2109,7 @@ void Foam::extendedEdgeMesh::sortedOrder
     label nConvex = 0;
     label nConcave = 0;
     label nMixed = 0;
-    label nNonFeat = 0;
+    // label nNonFeat = 0;
 
     forAll(pointStat, pointI)
     {
@@ -2128,7 +2128,7 @@ void Foam::extendedEdgeMesh::sortedOrder
             break;
 
             case extendedEdgeMesh::NONFEATURE:
-                nNonFeat++;
+                // ++nNonFeat;
             break;
 
             default:
@@ -2179,7 +2179,7 @@ void Foam::extendedEdgeMesh::sortedOrder
     label nInternal = 0;
     label nFlat = 0;
     label nOpen = 0;
-    label nMultiple = 0;
+    // label nMultiple = 0;
 
     forAll(edgeStat, edgeI)
     {
@@ -2202,7 +2202,7 @@ void Foam::extendedEdgeMesh::sortedOrder
             break;
 
             case extendedEdgeMesh::MULTIPLE:
-                nMultiple++;
+                // ++nMultiple;
             break;
 
             case extendedEdgeMesh::NONE:
diff --git a/src/meshTools/regionSplit/localPointRegion.C b/src/meshTools/regionSplit/localPointRegion.C
index 36e8eaadce3..02d2e8aea3c 100644
--- a/src/meshTools/regionSplit/localPointRegion.C
+++ b/src/meshTools/regionSplit/localPointRegion.C
@@ -554,7 +554,7 @@ Foam::labelList Foam::localPointRegion::findDuplicateFaces
     );
 
     labelList duplicateFace(allPatch.size(), -1);
-    label nDuplicateFaces = 0;
+    // label nDuplicateFaces = 0;
 
     // Find all duplicate faces.
     forAll(allPatch, bFacei)
@@ -611,7 +611,7 @@ Foam::labelList Foam::localPointRegion::findDuplicateFaces
 
                     duplicateFace[bFacei] = otherFacei;
                     duplicateFace[otherFacei] = bFacei;
-                    nDuplicateFaces++;
+                    // ++nDuplicateFaces;
                 }
             }
         }
diff --git a/src/meshTools/topoSet/cellSources/regionToCell/regionToCell.C b/src/meshTools/topoSet/cellSources/regionToCell/regionToCell.C
index 45d6c987096..0089668c738 100644
--- a/src/meshTools/topoSet/cellSources/regionToCell/regionToCell.C
+++ b/src/meshTools/topoSet/cellSources/regionToCell/regionToCell.C
@@ -232,14 +232,13 @@ void Foam::regionToCell::shrinkRegions
                 if (selectedCell[celli])
                 {
                     selectedCell[celli] = false;
-                    nChanged++;
+                    ++nChanged;
                 }
             }
         }
     }
     Info<< "    Eroded "
-        << returnReduce(nChanged, sumOp<label>())
-        << " cells." << endl;
+        << returnReduce(nChanged, sumOp<label>()) << " cells." << endl;
 }
 
 
@@ -308,7 +307,7 @@ void Foam::regionToCell::erode
 
         // Select all cells using these points
 
-        label nChanged = 0;
+        // label nChanged = 0;
         forAll(boundaryPoint, pointi)
         {
             if (boundaryPoint[pointi])
@@ -320,7 +319,7 @@ void Foam::regionToCell::erode
                     if (!removeCell[celli])
                     {
                         removeCell[celli] = true;
-                        nChanged++;
+                        // ++nChanged;
                     }
                 }
             }
diff --git a/src/overset/cellCellStencil/inverseDistance/inverseDistanceCellCellStencil.C b/src/overset/cellCellStencil/inverseDistance/inverseDistanceCellCellStencil.C
index a6eeba364a8..530b5ac2153 100644
--- a/src/overset/cellCellStencil/inverseDistance/inverseDistanceCellCellStencil.C
+++ b/src/overset/cellCellStencil/inverseDistance/inverseDistanceCellCellStencil.C
@@ -1166,14 +1166,14 @@ void Foam::cellCellStencils::inverseDistance::findHoles
 
 
     // See which regions have not been visited (regionType == 1)
-    label count = 0;
+    // label count = 0;
     forAll(cellRegion, cellI)
     {
         label type = regionType[cellRegion[cellI]];
         if (type == 1 && cellTypes[cellI] != HOLE)
         {
             cellTypes[cellI] = HOLE;
-            count++;
+            // ++count;
         }
     }
 }
diff --git a/src/overset/oversetAdjustPhi/oversetAdjustPhi.C b/src/overset/oversetAdjustPhi/oversetAdjustPhi.C
index d25999f6209..4b858ab40c6 100644
--- a/src/overset/oversetAdjustPhi/oversetAdjustPhi.C
+++ b/src/overset/oversetAdjustPhi/oversetAdjustPhi.C
@@ -244,6 +244,7 @@ bool Foam::oversetAdjustPhi
 
 
     // Check correction
+    #ifdef FULLDEBUG
     if (fv::debug)
     {
         scalar massOutCheck = 0;
@@ -287,7 +288,10 @@ bool Foam::oversetAdjustPhi
                 }
             }
         }
+
+        Info<< "mass in:" << massInCheck << " out:" << massOutCheck << nl;
     }
+    #endif  /* FULLDEBUG */
 
     return true;
 }
diff --git a/src/overset/oversetFvMesh/oversetFvMeshBase.C b/src/overset/oversetFvMesh/oversetFvMeshBase.C
index 8182a1f9277..bdf08b1fbb2 100644
--- a/src/overset/oversetFvMesh/oversetFvMeshBase.C
+++ b/src/overset/oversetFvMesh/oversetFvMeshBase.C
@@ -372,8 +372,7 @@ Foam::scalar Foam::oversetFvMeshBase::cellAverage
     const cell& cFaces = mesh_.cells()[celli];
 
     scalar avg = 0.0;
-    label n = 0;
-    label nFront = 0;
+    label nTotal = 0;
     for (const label facei : cFaces)
     {
         if (mesh_.isInternalFace(facei))
@@ -382,38 +381,32 @@ Foam::scalar Foam::oversetFvMeshBase::cellAverage
             if (norm[nbrCelli] == -GREAT)
             {
                 // Invalid neighbour. Add to front
-                if (isFront.set(facei))
-                {
-                    nFront++;
-                }
+                isFront.set(facei);
             }
             else
             {
                 // Valid neighbour. Add to average
                 avg += norm[nbrCelli];
-                n++;
+                ++nTotal;
             }
         }
         else
         {
             if (nbrNorm[facei-mesh_.nInternalFaces()] == -GREAT)
             {
-                if (isFront.set(facei))
-                {
-                    nFront++;
-                }
+                isFront.set(facei);
             }
             else
             {
                 avg += nbrNorm[facei-mesh_.nInternalFaces()];
-                n++;
+                ++nTotal;
             }
         }
     }
 
-    if (n > 0)
+    if (nTotal)
     {
-        return avg/n;
+        return avg/nTotal;
     }
     else
     {
diff --git a/src/overset/oversetFvMesh/oversetFvMeshBaseTemplates.C b/src/overset/oversetFvMesh/oversetFvMeshBaseTemplates.C
index 4805fec67e1..faa741cafea 100644
--- a/src/overset/oversetFvMesh/oversetFvMeshBaseTemplates.C
+++ b/src/overset/oversetFvMesh/oversetFvMeshBaseTemplates.C
@@ -165,14 +165,14 @@ Foam::tmp<Foam::scalarField> Foam::oversetFvMeshBase::normalisation
         const cellCellStencilObject& overlap = Stencil::New(mesh_);
         const labelUList& types = overlap.cellTypes();
 
-        label nHoles = 0;
+        // label nHoles = 0;
         scalarField extrapolatedNorm(norm);
         forAll(types, celli)
         {
             if (types[celli] == cellCellStencil::HOLE)
             {
                 extrapolatedNorm[celli] = -GREAT;
-                nHoles++;
+                // ++nHoles;
             }
         }
 
diff --git a/src/overset/regionsToCell/regionsToCell.C b/src/overset/regionsToCell/regionsToCell.C
index b3e71e810f6..996743d394a 100644
--- a/src/overset/regionsToCell/regionsToCell.C
+++ b/src/overset/regionsToCell/regionsToCell.C
@@ -261,13 +261,13 @@ void Foam::regionsToCell::shrinkRegions
                 if (selectedCell[cellI])
                 {
                     selectedCell[cellI] = false;
-                    nChanged++;
+                    ++nChanged;
                 }
             }
         }
     }
-    Info<< "    Eroded " << returnReduce(nChanged, sumOp<label>())
-        << " cells." << endl;
+    Info<< "    Eroded "
+        << returnReduce(nChanged, sumOp<label>()) << " cells." << endl;
 }
 
 
@@ -338,7 +338,7 @@ void Foam::regionsToCell::erode
 
         // Select all cells using these points
 
-        label nChanged = 0;
+        // label nChanged = 0;
         forAll(boundaryPoint, pointI)
         {
             if (boundaryPoint[pointI])
@@ -350,7 +350,7 @@ void Foam::regionsToCell::erode
                     if (!removeCell[cellI])
                     {
                         removeCell[cellI] = true;
-                        nChanged++;
+                        // ++nChanged;
                     }
                 }
             }
diff --git a/src/parallel/distributed/distributedTriSurfaceMesh/distributedTriSurfaceMesh.C b/src/parallel/distributed/distributedTriSurfaceMesh/distributedTriSurfaceMesh.C
index c338498f015..1c77ad3f961 100644
--- a/src/parallel/distributed/distributedTriSurfaceMesh/distributedTriSurfaceMesh.C
+++ b/src/parallel/distributed/distributedTriSurfaceMesh/distributedTriSurfaceMesh.C
@@ -3297,7 +3297,7 @@ void Foam::distributedTriSurfaceMesh::findNearest
         // Work array - whether processor bb overlaps the bounding sphere.
         boolList procBbOverlaps(Pstream::nProcs());
 
-        label nFound = 0;
+        // label nFound = 0;
 
         forAll(nearestInfo, samplei)
         {
@@ -3305,10 +3305,10 @@ void Foam::distributedTriSurfaceMesh::findNearest
             const nearestAndDist& ni = nearestInfo[samplei];
             const pointIndexHit& info = ni.first();
 
-            if (info.hit())
-            {
-                nFound++;
-            }
+            // if (info.hit())
+            // {
+            //     nFound++;
+            // }
 
             scalar d2 =
             (
diff --git a/src/parallel/distributed/patchDistMethods/exact/exactPatchDistMethod.C b/src/parallel/distributed/patchDistMethods/exact/exactPatchDistMethod.C
index 991a43b162f..73fe2e15fe4 100644
--- a/src/parallel/distributed/patchDistMethods/exact/exactPatchDistMethod.C
+++ b/src/parallel/distributed/patchDistMethods/exact/exactPatchDistMethod.C
@@ -170,14 +170,14 @@ bool Foam::patchDistMethods::exact::correct
     );
 
     // Take over hits
-    label nHits = 0;
+    // label nHits = 0;
     forAll(info, celli)
     {
         if (info[celli].hit())
         {
             const point& cc = mesh_.cellCentres()[celli];
             y[celli] = info[celli].point().dist(cc);
-            nHits++;
+            // ++nHits;
         }
         //else
         //{
-- 
GitLab