From 8567ef594a4be8d2bb22cb1e6376ac6fcd96cdad Mon Sep 17 00:00:00 2001
From: Mark Olesen <Mark.Olesen@esi-group.com>
Date: Sun, 17 Dec 2017 13:47:12 +0100
Subject: [PATCH] STYLE: remove unneed DynamicList::reserve() call

- DynamicList now has SizeMin=16, which eliminates the need for reserve()
  in some cases

- remove unused enrichedPatch static variable
---
 .../enrichedPatch/enrichedPatch.H             |  3 ---
 .../enrichedPatch/enrichedPatchMasterPoints.C | 19 ++++---------------
 2 files changed, 4 insertions(+), 18 deletions(-)

diff --git a/src/dynamicMesh/slidingInterface/enrichedPatch/enrichedPatch.H b/src/dynamicMesh/slidingInterface/enrichedPatch/enrichedPatch.H
index 6d04a55a33f..12430c03e63 100644
--- a/src/dynamicMesh/slidingInterface/enrichedPatch/enrichedPatch.H
+++ b/src/dynamicMesh/slidingInterface/enrichedPatch/enrichedPatch.H
@@ -176,9 +176,6 @@ class enrichedPatch
         //- Estimated ratio of original-to-enriched face size
         static const label enrichedFaceRatio_;
 
-        //- Estimated number of master face hits by slave points
-        static const label nFaceHits_;
-
         //- Size of face on which the check is forced
         static const label maxFaceSizeDebug_;
 
diff --git a/src/dynamicMesh/slidingInterface/enrichedPatch/enrichedPatchMasterPoints.C b/src/dynamicMesh/slidingInterface/enrichedPatch/enrichedPatchMasterPoints.C
index 18edef858ed..614bc5058a8 100644
--- a/src/dynamicMesh/slidingInterface/enrichedPatch/enrichedPatchMasterPoints.C
+++ b/src/dynamicMesh/slidingInterface/enrichedPatch/enrichedPatchMasterPoints.C
@@ -28,11 +28,6 @@ License
 #include "demandDrivenData.H"
 #include "DynamicList.H"
 
-// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
-
-const Foam::label Foam::enrichedPatch::nFaceHits_ = 4;
-
-
 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
 
 void Foam::enrichedPatch::calcMasterPointFaces() const
@@ -63,11 +58,8 @@ void Foam::enrichedPatch::calcMasterPointFaces() const
 
         for (const label pointi : curFace)
         {
-            DynamicList<label>& dynLst = mpf(pointi); // Get or create
-
-            dynLst.reserve(primitiveMesh::facesPerPoint_); // Min size for list
-
-            dynLst.append(facei);
+            // Existing or auto-vivify DynamicList
+            mpf(pointi).append(facei);
         }
     }
 
@@ -86,11 +78,8 @@ void Foam::enrichedPatch::calcMasterPointFaces() const
             // Index of projected point corresponding to this slave point
             const label mergedPointi = pointMergeMap()[slaveMeshPoints[pointi]];
 
-            DynamicList<label>& dynLst = mpf(mergedPointi); // Get or create
-
-            dynLst.reserve(primitiveMesh::facesPerPoint_); // Min size for list
-
-            dynLst.append(slavePointFaceHits_[pointi].hitObject());
+            // Existing or auto-vivify DynamicList
+            mpf(mergedPointi).append(slavePointFaceHits_[pointi].hitObject());
         }
     }
 
-- 
GitLab