From d17bc7258589d206a6c2fdb1267f615c648b4f60 Mon Sep 17 00:00:00 2001
From: Mark Olesen <Mark.Olesen@esi-group.com>
Date: Wed, 14 Mar 2018 21:08:29 +0100
Subject: [PATCH] ENH: consistency of HashSet setMany(), insertMany() with
 packed-list version

- this also provides a better separation of the intent
  (ie, inserting a single value, or inserting multiply values)
---
 applications/test/HashSet/Test-hashSet.C      |   6 +-
 applications/test/edges/Test-edges.C          |   6 +-
 applications/test/sizeof/Test-sizeof.C        |   5 +
 .../refineWallLayer/refineWallLayer.C         |   5 +-
 .../refinementLevel/refinementLevel.C         |   6 +-
 .../mesh/advanced/splitCells/splitCells.C     |   5 +-
 .../ideasUnvToFoam/ideasUnvToFoam.C           |   6 +-
 .../conversion/writeMeshObj/writeMeshObj.C    |   5 +-
 .../extrude/extrudeMesh/extrudeMesh.C         |   5 +-
 .../extrudeToRegionMesh/extrudeToRegionMesh.C |  10 +-
 .../conformalVoronoiMeshCalcDualMesh.C        |  18 +-
 .../conformalVoronoiMeshIO.C                  |   9 +-
 .../mesh/manipulation/refineMesh/refineMesh.C |   6 +-
 .../mesh/manipulation/splitMesh/regionSide.C  |   5 +-
 .../decomposePar/decomposePar.C               |   2 +-
 .../reconstructPar/reconstructPar.C           |   2 +-
 .../foamToEnsightParts/findFields.H           |   4 +-
 .../PVReaders/vtkPVFoam/vtkPVFoamUpdateInfo.C |   2 +-
 .../createZeroDirectory/boundaryInfo.C        |   2 +-
 .../surface/surfaceCheck/surfaceCheck.C       |   4 +-
 .../surfaceMeshTriangulate.C                  |   6 +-
 .../containers/HashTables/HashSet/HashSet.C   | 182 +++++++++++++-----
 .../containers/HashTables/HashSet/HashSet.H   | 168 +++++++++-------
 .../HashTables/HashTable/HashTable.C          |  73 +++----
 .../HashTables/HashTable/HashTable.H          |  46 ++---
 .../functionObjectList/functionObjectList.C   |   4 +-
 src/OpenFOAM/meshes/meshShapes/edge/edge.H    |  55 +++---
 src/OpenFOAM/meshes/meshShapes/edge/edgeI.H   | 139 ++++++-------
 .../polyBoundaryMesh/polyBoundaryMesh.C       |  12 +-
 .../primitiveMesh/primitiveMeshCellPoints.C   |   2 +-
 .../meshes/primitiveMesh/primitiveMeshEdges.C |   2 +-
 src/conversion/vtk/part/foamVtuSizing.C       |  10 +-
 .../vtk/part/foamVtuSizingTemplates.C         |   5 +-
 .../attachDetach/detachInterface.C            |  18 +-
 .../fvMeshDistribute/fvMeshDistribute.C       |   5 +-
 .../motionSmoother/motionSmootherAlgo.C       |  29 +--
 .../perfectInterface/perfectInterface.C       |   5 +-
 .../polyTopoChange/hexRef8/hexRef8.C          |  10 +-
 .../polyTopoChange/removePoints.C             |   5 +-
 .../slidingInterface/coupleSlidingInterface.C |  12 +-
 .../slidingInterfaceProjectPoints.C           |   3 +-
 .../faMesh/faMeshDemandDrivenData.C           |   6 +-
 .../fieldSelection/fieldSelectionTemplates.C  |   5 +-
 .../fileFieldSelectionTemplates.C             |   7 +-
 .../isoAdvection/isoAdvection/isoAdvection.C  |   5 +-
 .../globalIndexStencils/cellToCellStencil.C   |   5 +-
 .../globalIndexStencils/cellToFaceStencil.C   |  32 +--
 .../field/turbulenceFields/turbulenceFields.C |  16 +-
 .../ParticleErosion/ParticleErosion.C         |   2 +-
 .../PatchPostProcessing/PatchPostProcessing.C |   2 +-
 .../meshRefinement/meshRefinement.C           |   2 +-
 .../meshRefinement/meshRefinementBaffles.C    |  10 +-
 .../meshRefinement/meshRefinementMerge.C      |  15 +-
 .../cellClassification/cellClassification.C   |   5 +-
 src/meshTools/cellDist/cellDistFuncs.C        |   6 +-
 src/meshTools/meshTools/meshTools.C           |   6 +-
 .../faceSources/normalToFace/normalToFace.C   |   5 +-
 .../triSurfaceTools/triSurfaceTools.C         |   6 +-
 .../structuredDecomp/structuredDecomp.C       |   2 +-
 .../injectionModelList/injectionModelList.C   |   9 +-
 .../transferModelList/transferModelList.C     |   9 +-
 .../structuredRenumber/structuredRenumber.C   |   8 +-
 src/sampling/probes/probes.C                  |  26 ++-
 .../surfMeshSamplers/surfMeshSamplers.C       |  10 +-
 64 files changed, 494 insertions(+), 609 deletions(-)

diff --git a/applications/test/HashSet/Test-hashSet.C b/applications/test/HashSet/Test-hashSet.C
index eeae7ff0d0b..5316f05e3f7 100644
--- a/applications/test/HashSet/Test-hashSet.C
+++ b/applications/test/HashSet/Test-hashSet.C
@@ -188,10 +188,10 @@ int main(int argc, char *argv[])
     Info<< "setB : " << setB << endl;
 
     labelPair pair(12, 15);
-    setB.set(pair);
+    setB.setMany(pair);
 
     Info<< "setB : " << setB << endl;
-    setB.unset(pair);
+    setB.unsetMany(pair);
 
 
     labelHashSet setC(1);
@@ -257,7 +257,7 @@ int main(int argc, char *argv[])
         someLst[elemI] = elemI*elemI;
     }
 
-    label added = setD.set(someLst);
+    label added = setD.setMany(someLst);
     Info<< "added " << added << " from " << someLst.size() << endl;
     Info<< "setD : " << flatOutput(setD) << endl;
 
diff --git a/applications/test/edges/Test-edges.C b/applications/test/edges/Test-edges.C
index 51da417de3e..68de5446ee6 100644
--- a/applications/test/edges/Test-edges.C
+++ b/applications/test/edges/Test-edges.C
@@ -94,7 +94,7 @@ int main(int argc, char *argv[])
     e4.start() = e4.end() = -1;
     Info<< "insert from list\n";
     labelHashSet newIndices({2, -1, 2, 1, 4, 1, 2, 3});
-    e4.insert(newIndices.toc());
+    e4.insertMany(newIndices.toc());
     printInfo(e4);
 
     e4.start() = e4.end() = -1;
@@ -105,12 +105,12 @@ int main(int argc, char *argv[])
     FixedList<label, 8> otherIndices{12, 2, -1, 1, 4, 1, 2, 3};
     e4.start() = e4.end() = -1;
     Info<< "insert from list: " << otherIndices << nl;
-    e4.insert(otherIndices);
+    e4.insertMany(otherIndices);
     printInfo(e4);
 
     e4.start() = e4.end();
     Info<< "erase from list: " << otherIndices << nl;
-    Info<< "removed " << e4.erase(otherIndices) << " values" << nl;
+    Info<< "removed " << e4.eraseMany(otherIndices) << " values" << nl;
     printInfo(e4);
 
     for (label i : {-1, 0, 1, 3})
diff --git a/applications/test/sizeof/Test-sizeof.C b/applications/test/sizeof/Test-sizeof.C
index 93358f7af7b..40f33de650b 100644
--- a/applications/test/sizeof/Test-sizeof.C
+++ b/applications/test/sizeof/Test-sizeof.C
@@ -32,6 +32,8 @@ Description
 #include "dictionary.H"
 #include "nil.H"
 #include "IOstreams.H"
+#include "PstreamBuffers.H"
+#include "Time.H"
 
 namespace Foam
 {
@@ -101,6 +103,9 @@ int main(int argc, char *argv[])
         cout<<"string:" << sizeof(Foam::string) << nl;
     }
 
+    cout<<"IOstream:" << sizeof(Foam::IOstream) << nl;
+    cout<<"PstreamBuffers:" << sizeof(Foam::PstreamBuffers) << nl;
+    cout<<"Time:" << sizeof(Foam::Time) << nl;
 
     Info << "---\nEnd\n" << endl;
 
diff --git a/applications/utilities/mesh/advanced/refineWallLayer/refineWallLayer.C b/applications/utilities/mesh/advanced/refineWallLayer/refineWallLayer.C
index aac1d730d5a..f01fa003e44 100644
--- a/applications/utilities/mesh/advanced/refineWallLayer/refineWallLayer.C
+++ b/applications/utilities/mesh/advanced/refineWallLayer/refineWallLayer.C
@@ -122,10 +122,7 @@ int main(int argc, char *argv[])
 
             const labelList& pCells = mesh.pointCells()[meshPointi];
 
-            forAll(pCells, pCelli)
-            {
-                cutCells.insert(pCells[pCelli]);
-            }
+            cutCells.insertMany(pCells);
         }
     }
 
diff --git a/applications/utilities/mesh/advanced/refinementLevel/refinementLevel.C b/applications/utilities/mesh/advanced/refinementLevel/refinementLevel.C
index 463d1b689e7..468ede34537 100644
--- a/applications/utilities/mesh/advanced/refinementLevel/refinementLevel.C
+++ b/applications/utilities/mesh/advanced/refinementLevel/refinementLevel.C
@@ -184,11 +184,7 @@ int main(int argc, char *argv[])
         const DynamicList<label>& bin = bins[binI];
 
         cellSet cells(mesh, "vol" + name(binI), bin.size());
-
-        forAll(bin, i)
-        {
-            cells.insert(bin[i]);
-        }
+        cells.insertMany(bin);
 
         Info<< "    " << lowerLimits[binI] << " .. " << upperLimits[binI]
             << "  : writing " << bin.size() << " cells to cellSet "
diff --git a/applications/utilities/mesh/advanced/splitCells/splitCells.C b/applications/utilities/mesh/advanced/splitCells/splitCells.C
index 96028a969e4..6bd54ba6d9c 100644
--- a/applications/utilities/mesh/advanced/splitCells/splitCells.C
+++ b/applications/utilities/mesh/advanced/splitCells/splitCells.C
@@ -633,10 +633,7 @@ int main(int argc, char *argv[])
         );
 
         cellSet cutSet(mesh, "cutSet", cutCells.size());
-        forAll(cutCells, i)
-        {
-            cutSet.insert(cutCells[i]);
-        }
+        cutSet.insertMany(cutCells);
 
         // Gets cuts across cells from cuts through edges.
         Info<< "Writing " << cutSet.size() << " cells to cut to cellSet "
diff --git a/applications/utilities/mesh/conversion/ideasUnvToFoam/ideasUnvToFoam.C b/applications/utilities/mesh/conversion/ideasUnvToFoam/ideasUnvToFoam.C
index 621ced981d4..021ac49b875 100644
--- a/applications/utilities/mesh/conversion/ideasUnvToFoam/ideasUnvToFoam.C
+++ b/applications/utilities/mesh/conversion/ideasUnvToFoam/ideasUnvToFoam.C
@@ -956,11 +956,7 @@ int main(int argc, char *argv[])
         forAll(dofVertIndices, patchi)
         {
             const labelList& foamVerts = dofVertIndices[patchi];
-
-            forAll(foamVerts, i)
-            {
-                dofGroups[patchi].insert(foamVerts[i]);
-            }
+            dofGroups[patchi].insertMany(foamVerts);
         }
 
         List<DynamicList<face>> dynPatchFaces(dofVertIndices.size());
diff --git a/applications/utilities/mesh/conversion/writeMeshObj/writeMeshObj.C b/applications/utilities/mesh/conversion/writeMeshObj/writeMeshObj.C
index 9e7f4f424c5..3e06227f01c 100644
--- a/applications/utilities/mesh/conversion/writeMeshObj/writeMeshObj.C
+++ b/applications/utilities/mesh/conversion/writeMeshObj/writeMeshObj.C
@@ -344,10 +344,7 @@ void writePointCells
     {
         const labelList& cEdges = mesh.cellEdges()[pCells[i]];
 
-        forAll(cEdges, i)
-        {
-            allEdges.insert(cEdges[i]);
-        }
+        allEdges.insertMany(cEdges);
     }
 
 
diff --git a/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMesh.C b/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMesh.C
index 6f16a6beb5a..1c0d36af439 100644
--- a/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMesh.C
+++ b/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMesh.C
@@ -795,10 +795,7 @@ int main(int argc, char *argv[])
             forAll(addedCells, facei)
             {
                 const labelList& aCells = addedCells[facei];
-                forAll(aCells, i)
-                {
-                    addedCellsSet.insert(aCells[i]);
-                }
+                addedCellsSet.insertMany(aCells);
             }
         }
     }
diff --git a/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C
index 22277cabc8e..dd1830e4c26 100644
--- a/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C
+++ b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C
@@ -527,10 +527,7 @@ label findUncoveredPatchFace
 {
     // Make set of extruded faces.
     labelHashSet extrudeFaceSet(extrudeMeshFaces.size());
-    forAll(extrudeMeshFaces, i)
-    {
-        extrudeFaceSet.insert(extrudeMeshFaces[i]);
-    }
+    extrudeFaceSet.insertMany(extrudeMeshFaces);
 
     const polyBoundaryMesh& pbm = mesh.boundaryMesh();
     const labelList& eFaces = mesh.edgeFaces()[meshEdgeI];
@@ -564,10 +561,7 @@ label findUncoveredCyclicPatchFace
 {
     // Make set of extruded faces.
     labelHashSet extrudeFaceSet(extrudeMeshFaces.size());
-    forAll(extrudeMeshFaces, i)
-    {
-        extrudeFaceSet.insert(extrudeMeshFaces[i]);
-    }
+    extrudeFaceSet.insertMany(extrudeMeshFaces);
 
     const polyBoundaryMesh& pbm = mesh.boundaryMesh();
     const labelList& eFaces = mesh.edgeFaces()[meshEdgeI];
diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshCalcDualMesh.C b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshCalcDualMesh.C
index 5cfd3efee7f..bc7cd7f7ad3 100644
--- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshCalcDualMesh.C
+++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshCalcDualMesh.C
@@ -1053,10 +1053,7 @@ Foam::labelHashSet Foam::conformalVoronoiMesh::checkPolyMeshQuality
 
                 nInvalidPolyhedra++;
 
-                forAll(cells[cI], cFI)
-                {
-                    wrongFaces.insert(cells[cI][cFI]);
-                }
+                wrongFaces.insertMany(cells[cI]);
             }
         }
 
@@ -1096,11 +1093,7 @@ Foam::labelHashSet Foam::conformalVoronoiMesh::checkPolyMeshQuality
             if (nInternalFaces[cI] <= 1)
             {
                 oneInternalFaceCells++;
-
-                forAll(cells[cI], cFI)
-                {
-                    wrongFaces.insert(cells[cI][cFI]);
-                }
+                wrongFaces.insertMany(cells[cI]);
             }
         }
 
@@ -1132,13 +1125,8 @@ Foam::labelHashSet Foam::conformalVoronoiMesh::checkPolyMeshQuality
     //     forAll(f, fPtI)
     //     {
     //         label ptI = f[fPtI];
-
     //         const labelList& pC = ptCells[ptI];
-
-    //         forAll(pC, pCI)
-    //         {
-    //             limitCells.insert(pC[pCI]);
-    //         }
+    //         limitCells.insertMany(pC);
     //     }
     // }
 
diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshIO.C b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshIO.C
index f18bb544dc7..63d7542ceef 100644
--- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshIO.C
+++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshIO.C
@@ -1366,15 +1366,10 @@ Foam::labelHashSet Foam::conformalVoronoiMesh::findRemainingProtrusionSet
         mesh.nCells()/1000
     );
 
-    forAllConstIter(labelHashSet, protrudingBoundaryPoints, iter)
+    for (const label pointi : protrudingBoundaryPoints)
     {
-        const label pointi = iter.key();
         const labelList& pCells = mesh.pointCells()[pointi];
-
-        forAll(pCells, pCI)
-        {
-            protrudingCells.insert(pCells[pCI]);
-        }
+        protrudingCells.insertMany(pCells);
     }
 
     label protrudingCellsSize = protrudingCells.size();
diff --git a/applications/utilities/mesh/manipulation/refineMesh/refineMesh.C b/applications/utilities/mesh/manipulation/refineMesh/refineMesh.C
index 94ec49005b9..367e62392a4 100644
--- a/applications/utilities/mesh/manipulation/refineMesh/refineMesh.C
+++ b/applications/utilities/mesh/manipulation/refineMesh/refineMesh.C
@@ -349,11 +349,7 @@ int main(int argc, char *argv[])
     forAll(oldToNew, oldCelli)
     {
         const labelList& added = oldToNew[oldCelli];
-
-        forAll(added, i)
-        {
-            newCells.insert(added[i]);
-        }
+        newCells.insertMany(added);
     }
 
     Info<< "Writing refined cells ("
diff --git a/applications/utilities/mesh/manipulation/splitMesh/regionSide.C b/applications/utilities/mesh/manipulation/splitMesh/regionSide.C
index fb7c8305733..f06cfe28ea5 100644
--- a/applications/utilities/mesh/manipulation/splitMesh/regionSide.C
+++ b/applications/utilities/mesh/manipulation/splitMesh/regionSide.C
@@ -301,10 +301,7 @@ void Foam::regionSide::walkAllPointConnectedFaces
         const label facei = iter.key();
         const labelList& fEdges = mesh.faceEdges()[facei];
 
-        forAll(fEdges, fEdgeI)
-        {
-            regionEdges.insert(fEdges[fEdgeI]);
-        }
+        regionEdges.insertMany(fEdges);
     }
 
 
diff --git a/applications/utilities/parallelProcessing/decomposePar/decomposePar.C b/applications/utilities/parallelProcessing/decomposePar/decomposePar.C
index 0ac8b9af1b9..fa0dd946bd5 100644
--- a/applications/utilities/parallelProcessing/decomposePar/decomposePar.C
+++ b/applications/utilities/parallelProcessing/decomposePar/decomposePar.C
@@ -311,7 +311,7 @@ int main(int argc, char *argv[])
         wordHashSet names;
         forAllConstIters(rp, iter)
         {
-            names.insert(iter.object());
+            names.insertMany(iter.object());
         }
 
         regionNames = names.sortedToc();
diff --git a/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C b/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C
index cdd092b1276..c8ab33cfa24 100644
--- a/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C
+++ b/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C
@@ -186,7 +186,7 @@ int main(int argc, char *argv[])
         wordHashSet names;
         forAllConstIters(rp, iter)
         {
-            names.insert(iter.object());
+            names.insertMany(iter.object());
         }
 
         regionNames = names.sortedToc();
diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/findFields.H b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/findFields.H
index 1172760228e..1a98fcd52e8 100644
--- a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/findFields.H
+++ b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/findFields.H
@@ -103,9 +103,9 @@ if (timeDirs.size())
             fileName::FILE
         );
 
-        forAll(contents, fileI)
+        for (const fileName& file : contents)
         {
-            missing.erase(contents[fileI].name());
+            missing.erase(file.name());
         }
 
         volumeFields.erase(missing);
diff --git a/applications/utilities/postProcessing/graphics/PVReaders/vtkPVFoam/vtkPVFoamUpdateInfo.C b/applications/utilities/postProcessing/graphics/PVReaders/vtkPVFoam/vtkPVFoamUpdateInfo.C
index 290f4ad41be..391bf077821 100644
--- a/applications/utilities/postProcessing/graphics/PVReaders/vtkPVFoam/vtkPVFoamUpdateInfo.C
+++ b/applications/utilities/postProcessing/graphics/PVReaders/vtkPVFoam/vtkPVFoamUpdateInfo.C
@@ -227,7 +227,7 @@ void Foam::vtkPVFoam::updateInfoLagrangian
 
     for (const instant& t : dbPtr_().times())
     {
-        names.insert
+        names.insertMany
         (
             readDir
             (
diff --git a/applications/utilities/preProcessing/createZeroDirectory/boundaryInfo.C b/applications/utilities/preProcessing/createZeroDirectory/boundaryInfo.C
index a44a9066642..16671a4ec2b 100644
--- a/applications/utilities/preProcessing/createZeroDirectory/boundaryInfo.C
+++ b/applications/utilities/preProcessing/createZeroDirectory/boundaryInfo.C
@@ -123,7 +123,7 @@ Foam::boundaryInfo::boundaryInfo(const Time& runTime, const word& regionName)
         if (dict.found("inGroups"))
         {
             dict.lookup("inGroups") >> groups_[patchI];
-            allGroupNames_.insert(groups_[patchI]);
+            allGroupNames_.insertMany(groups_[patchI]);
         }
     }
 }
diff --git a/applications/utilities/surface/surfaceCheck/surfaceCheck.C b/applications/utilities/surface/surfaceCheck/surfaceCheck.C
index 1fc36e78cce..1b76d0a8add 100644
--- a/applications/utilities/surface/surfaceCheck/surfaceCheck.C
+++ b/applications/utilities/surface/surfaceCheck/surfaceCheck.C
@@ -225,9 +225,9 @@ void syncEdges(const triSurface& p, labelHashSet& markedEdges)
     const edgeList& edges = p.edges();
     edgeHashSet edgeSet(2*markedEdges.size());
 
-    forAllConstIter(labelHashSet, markedEdges, iter)
+    for (const label edgei : markedEdges)
     {
-        edgeSet.insert(edges[iter.key()]);
+        edgeSet.insert(edges[edgei]);
     }
 
     forAll(edges, edgei)
diff --git a/applications/utilities/surface/surfaceMeshTriangulate/surfaceMeshTriangulate.C b/applications/utilities/surface/surfaceMeshTriangulate/surfaceMeshTriangulate.C
index 86f35516b15..b5b2421b609 100644
--- a/applications/utilities/surface/surfaceMeshTriangulate/surfaceMeshTriangulate.C
+++ b/applications/utilities/surface/surfaceMeshTriangulate/surfaceMeshTriangulate.C
@@ -202,11 +202,7 @@ int main(int argc, char *argv[])
             for (const wordRe& zoneName : zoneNames)
             {
                 labelList zoneIDs = findStrings(zoneName, allZoneNames);
-
-                forAll(zoneIDs, j)
-                {
-                    includeFaceZones.insert(zoneIDs[j]);
-                }
+                includeFaceZones.insertMany(zoneIDs);
 
                 if (zoneIDs.empty())
                 {
diff --git a/src/OpenFOAM/containers/HashTables/HashSet/HashSet.C b/src/OpenFOAM/containers/HashTables/HashSet/HashSet.C
index 9fc7370d103..90dcbea5ebb 100644
--- a/src/OpenFOAM/containers/HashTables/HashSet/HashSet.C
+++ b/src/OpenFOAM/containers/HashTables/HashSet/HashSet.C
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
-     \\/     M anipulation  | Copyright (C) 2016-2017 OpenCFD Ltd.
+     \\/     M anipulation  | Copyright (C) 2016-2018 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -33,55 +33,36 @@ License
 
 template<class Key, class Hash>
 template<class InputIter>
-inline Foam::label Foam::HashSet<Key, Hash>::insertMultiple
+inline Foam::label Foam::HashSet<Key, Hash>::assignMany
 (
-    const InputIter begIter,
-    const InputIter endIter
-)
-{
-    label changed = 0;
-    for (InputIter iter = begIter; iter != endIter; ++iter)
-    {
-        if (insert(*iter))
-        {
-            ++changed;
-        }
-    }
-    return changed;
-}
-
-
-template<class Key, class Hash>
-template<class InputIter>
-inline Foam::label Foam::HashSet<Key, Hash>::assignMultiple
-(
-    const InputIter begIter,
-    const InputIter endIter,
-    const label sz
+    const label nItems,
+    InputIter first,
+    InputIter last
 )
 {
     if (!this->capacity())
     {
         // Could be zero-sized from a previous transfer()?
-        this->resize(sz);
+        this->resize(2*nItems);
     }
     else
     {
         this->clear();
     }
 
-    return insertMultiple(begIter, endIter);
+    return insert(first, last);
 }
 
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
 template<class Key, class Hash>
-Foam::HashSet<Key, Hash>::HashSet(const UList<Key>& lst)
+template<unsigned Size>
+Foam::HashSet<Key, Hash>::HashSet(const FixedList<Key, Size>& list)
 :
-    parent_type(2*lst.size())
+    parent_type(2*list.size())
 {
-    for (const auto& k : lst)
+    for (const auto& k : list)
     {
         this->insert(k);
     }
@@ -89,12 +70,11 @@ Foam::HashSet<Key, Hash>::HashSet(const UList<Key>& lst)
 
 
 template<class Key, class Hash>
-template<unsigned Size>
-Foam::HashSet<Key, Hash>::HashSet(const FixedList<Key, Size>& lst)
+Foam::HashSet<Key, Hash>::HashSet(const UList<Key>& list)
 :
-    parent_type(2*lst.size())
+    parent_type(2*list.size())
 {
-    for (const auto& k : lst)
+    for (const auto& k : list)
     {
         this->insert(k);
     }
@@ -102,11 +82,23 @@ Foam::HashSet<Key, Hash>::HashSet(const FixedList<Key, Size>& lst)
 
 
 template<class Key, class Hash>
-Foam::HashSet<Key, Hash>::HashSet(std::initializer_list<Key> lst)
+Foam::HashSet<Key, Hash>::HashSet(const UIndirectList<Key>& list)
 :
-    parent_type(2*lst.size())
+    parent_type(2*list.size())
 {
-    for (const auto& k : lst)
+    for (const auto& k : list)
+    {
+        this->insert(k);
+    }
+}
+
+
+template<class Key, class Hash>
+Foam::HashSet<Key, Hash>::HashSet(std::initializer_list<Key> list)
+:
+    parent_type(2*list.size())
+{
+    for (const auto& k : list)
     {
         this->insert(k);
     }
@@ -132,24 +124,116 @@ Foam::HashSet<Key, Hash>::HashSet
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
 template<class Key, class Hash>
-Foam::label Foam::HashSet<Key, Hash>::insert(const UList<Key>& lst)
+template<class InputIter>
+inline Foam::label Foam::HashSet<Key, Hash>::insert
+(
+    InputIter first,
+    InputIter last
+)
+{
+    label changed = 0;
+    for (; first != last; ++first)
+    {
+        if (insert(*first))
+        {
+            ++changed;
+        }
+    }
+    return changed;
+}
+
+
+template<class Key, class Hash>
+inline Foam::label Foam::HashSet<Key, Hash>::insert
+(
+    std::initializer_list<Key> list
+)
 {
-    return insertMultiple(lst.begin(), lst.end());
+    return insert(list.begin(), list.end());
 }
 
 
 template<class Key, class Hash>
 template<unsigned Size>
-Foam::label Foam::HashSet<Key, Hash>::insert(const FixedList<Key, Size>& lst)
+inline Foam::label Foam::HashSet<Key, Hash>::insertMany
+(
+    const FixedList<Key, Size>& list
+)
 {
-    return insertMultiple(lst.begin(), lst.end());
+    return insert(list.begin(), list.end());
 }
 
 
 template<class Key, class Hash>
-Foam::label Foam::HashSet<Key, Hash>::insert(std::initializer_list<Key> lst)
+inline Foam::label Foam::HashSet<Key, Hash>::insertMany
+(
+    const UList<Key>& list
+)
 {
-    return insertMultiple(lst.begin(), lst.end());
+    return insert(list.begin(), list.end());
+}
+
+
+template<class Key, class Hash>
+inline  Foam::label Foam::HashSet<Key, Hash>::insertMany
+(
+    const UIndirectList<Key>& list
+)
+{
+    return insert(list.begin(), list.end());
+}
+
+
+template<class Key, class Hash>
+template<class InputIter>
+inline Foam::label Foam::HashSet<Key, Hash>::unset
+(
+    InputIter first,
+    InputIter last
+)
+{
+    return this->parent_type::erase(first, last);
+}
+
+
+template<class Key, class Hash>
+inline Foam::label Foam::HashSet<Key, Hash>::unset
+(
+    std::initializer_list<Key> list
+)
+{
+    return unset(list.begin(), list.end());
+}
+
+
+template<class Key, class Hash>
+template<unsigned Size>
+inline Foam::label Foam::HashSet<Key, Hash>::unsetMany
+(
+    const FixedList<Key, Size>& list
+)
+{
+    return unset(list.begin(), list.end());
+}
+
+
+template<class Key, class Hash>
+inline Foam::label Foam::HashSet<Key, Hash>::unsetMany
+(
+    const UList<Key>& list
+)
+{
+    return unset(list.begin(), list.end());
+}
+
+
+template<class Key, class Hash>
+inline Foam::label Foam::HashSet<Key, Hash>::unsetMany
+(
+    const UIndirectList<Key>& list
+)
+{
+    return unset(list.begin(), list.end());
 }
 
 
@@ -170,24 +254,24 @@ inline bool Foam::HashSet<Key, Hash>::operator[](const Key& key) const
 
 
 template<class Key, class Hash>
-void Foam::HashSet<Key, Hash>::operator=(const UList<Key>& rhs)
+template<unsigned Size>
+void Foam::HashSet<Key, Hash>::operator=(const FixedList<Key, Size>& rhs)
 {
-    assignMultiple(rhs.begin(), rhs.end(), 2*rhs.size());
+    assignMany(rhs.size(), rhs.begin(), rhs.end());
 }
 
 
 template<class Key, class Hash>
-template<unsigned Size>
-void Foam::HashSet<Key, Hash>::operator=(const FixedList<Key, Size>& rhs)
+void Foam::HashSet<Key, Hash>::operator=(const UList<Key>& rhs)
 {
-    assignMultiple(rhs.begin(), rhs.end(), 2*rhs.size());
+    assignMany(rhs.size(), rhs.begin(), rhs.end());
 }
 
 
 template<class Key, class Hash>
 void Foam::HashSet<Key, Hash>::operator=(std::initializer_list<Key> rhs)
 {
-    assignMultiple(rhs.begin(), rhs.end(), 2*rhs.size());
+    assignMany(rhs.size(), rhs.begin(), rhs.end());
 }
 
 
diff --git a/src/OpenFOAM/containers/HashTables/HashSet/HashSet.H b/src/OpenFOAM/containers/HashTables/HashSet/HashSet.H
index da024138b6d..343e4986d95 100644
--- a/src/OpenFOAM/containers/HashTables/HashSet/HashSet.H
+++ b/src/OpenFOAM/containers/HashTables/HashSet/HashSet.H
@@ -63,6 +63,7 @@ Description
 #define HashSet_H
 
 #include "HashTable.H"
+#include "UIndirectList.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
@@ -87,21 +88,13 @@ class HashSet
 {
     // Private Member Functions
 
-        //- Insert values, using begin/end iterators.
+        //- Assign from the input iterator range
         template<class InputIter>
-        inline label insertMultiple
+        inline label assignMany
         (
-            const InputIter begIter,
-            const InputIter endIter
-        );
-
-        //- Assign using begin/end iterators.
-        template<class InputIter>
-        inline label assignMultiple
-        (
-            const InputIter begIter,
-            const InputIter endIter,
-            const label sz
+            const label nItems,
+            InputIter first,
+            InputIter last
         );
 
 
@@ -140,15 +133,18 @@ public:
             parent_type(is)
         {}
 
-        //- Construct from UList of Key
-        explicit HashSet(const UList<Key>& lst);
-
         //- Construct from FixedList of Key
         template<unsigned Size>
-        explicit HashSet(const FixedList<Key, Size>& lst);
+        explicit HashSet(const FixedList<Key, Size>& list);
+
+        //- Construct from UList of Key
+        explicit HashSet(const UList<Key>& list);
+
+        //- Construct from an indirect list
+        explicit HashSet(const UIndirectList<Key>& list);
 
         //- Construct from an initializer list of Key
-        HashSet(std::initializer_list<Key> lst);
+        HashSet(std::initializer_list<Key> list);
 
         //- Copy construct
         HashSet(const this_type& hs)
@@ -180,96 +176,97 @@ public:
             return this->parent_type::insert(key, zero::null());
         }
 
-        //- Insert keys from the list of Key
+        //- Same as insert (no value to overwrite)
+        bool set(const Key& key)
+        {
+            return insert(key);
+        }
+
+        //- Unset the specified key - same as erase
+        //  \return True if the entry existed and was removed
+        bool unset(const Key& key)
+        {
+            return this->parent_type::erase(key);
+        }
+
+
+    // Convenience
+
+        //- Insert keys from the input iterator range
         //  \return The number of new elements inserted
-        label insert(const UList<Key>& lst);
+        template<class InputIter>
+        inline label insert(InputIter first, InputIter last);
+
+        //- Insert keys from a initializer list of Key
+        //  \return The number of new elements inserted
+        inline label insert(std::initializer_list<Key> list);
 
         //- Insert keys from the list of Key
         //  \return The number of new elements inserted
         template<unsigned Size>
-        label insert(const FixedList<Key, Size>& lst);
+        inline label insertMany(const FixedList<Key, Size>& list);
 
-        //- Insert keys from a initializer list of Key
+        //- Insert keys from the list of Key
         //  \return The number of new elements inserted
-        label insert(std::initializer_list<Key> lst);
+        inline label insertMany(const UList<Key>& list);
+
+        //- Insert keys from the list of Key
+        //  \return The number of new elements inserted
+        inline label insertMany(const UIndirectList<Key>& list);
 
         //- Same as insert (no value to overwrite)
-        bool set(const Key& key)
+        template<class InputIter>
+        inline label set(InputIter first, InputIter last)
         {
-            return insert(key);
+            return insert(first, last);
         }
 
         //- Same as insert (no value to overwrite)
-        label set(const UList<Key>& lst)
+        inline label set(std::initializer_list<Key> list)
         {
-            return insert(lst);
+            return insert(list);
         }
 
         //- Same as insert (no value to overwrite)
         template<unsigned Size>
-        label set(const FixedList<Key, Size>& lst)
+        inline label setMany(const FixedList<Key, Size>& list)
         {
-            return insert(lst);
+            return insertMany(list);
         }
 
-        //- Same as insert (no value to overwrite)
-        label set(std::initializer_list<Key> lst)
+        //- Same as insertMany (no value to overwrite)
+        inline label setMany(const UList<Key>& list)
         {
-            return insert(lst);
+            return insertMany(list);
         }
 
-        //- Unset the specified key - same as erase
-        //  \return True if the entry existed and was removed
-        bool unset(const Key& key)
+        //- Same as insertMany (no value to overwrite)
+        inline label setMany(const UIndirectList<Key>& list)
         {
-            return this->parent_type::erase(key);
+            return insertMany(list);
         }
 
+        //- Unset the keys listed in the input iterator range
+        //  \return The number of items removed
+        template<class InputIter>
+        inline label unset(InputIter first, const InputIter last);
+
         //- Unset the listed keys - same as erase
         //  \return The number of items removed
-        label unset(const UList<Key>& lst)
-        {
-            return this->parent_type::erase(lst);
-        }
+        inline label unset(std::initializer_list<Key> list);
 
         //- Unset the listed keys - same as erase
         //  \return The number of items removed
         template<unsigned Size>
-        label unset(const FixedList<Key, Size>& lst)
-        {
-            return this->parent_type::erase(lst);
-        }
+        inline label unsetMany(const FixedList<Key, Size>& list);
 
         //- Unset the listed keys - same as erase
         //  \return The number of items removed
-        label unset(std::initializer_list<Key> lst)
-        {
-            return this->parent_type::erase(lst);
-        }
+        inline label unsetMany(const UList<Key>& list);
 
-        //- Not applicable for HashSet
-        template<class UnaryPredicate>
-        List<Key> tocValues(const UnaryPredicate&, const bool) = delete;
-
-        //- Not applicable for HashSet
-        template<class BinaryPredicate>
-        List<Key> tocEntries(const BinaryPredicate&, const bool) = delete;
-
-        //- Not applicable for HashSet
-        template<class UnaryPredicate>
-        label countValues(const UnaryPredicate&, const bool) = delete;
-
-        //- Not applicable for HashSet
-        template<class BinaryPredicate>
-        label countEntries(const BinaryPredicate&, const bool) = delete;
-
-        //- Not applicable for HashSet
-        template<class UnaryPredicate>
-        label filterValues(const UnaryPredicate&, const bool) = delete;
-
-        //- Not applicable for HashSet
-        template<class BinaryPredicate>
-        label filterEntries(const BinaryPredicate&, const bool) = delete;
+        //- Unset the listed keys - same as erase
+        //  \return The number of items removed
+        inline label unsetMany(const UIndirectList<Key>& list);
 
 
     // STL iterators
@@ -330,7 +327,7 @@ public:
     // Assignment
 
         //- Assignment from a UList of keys
-        void operator=(const UList<Key>& lst);
+        void operator=(const UList<Key>& rhs);
 
         //- Assignment from a FixedList of keys
         template<unsigned Size>
@@ -369,6 +366,33 @@ public:
             const HashSet<Key, Hash>& tbl
         );
 
+
+    // Housekeeping
+
+        //- Not applicable for HashSet
+        template<class UnaryPredicate>
+        List<Key> tocValues(const UnaryPredicate&, const bool) = delete;
+
+        //- Not applicable for HashSet
+        template<class BinaryPredicate>
+        List<Key> tocEntries(const BinaryPredicate&, const bool) = delete;
+
+        //- Not applicable for HashSet
+        template<class UnaryPredicate>
+        label countValues(const UnaryPredicate&, const bool) = delete;
+
+        //- Not applicable for HashSet
+        template<class BinaryPredicate>
+        label countEntries(const BinaryPredicate&, const bool) = delete;
+
+        //- Not applicable for HashSet
+        template<class UnaryPredicate>
+        label filterValues(const UnaryPredicate&, const bool) = delete;
+
+        //- Not applicable for HashSet
+        template<class BinaryPredicate>
+        label filterEntries(const BinaryPredicate&, const bool) = delete;
+
 };
 
 
diff --git a/src/OpenFOAM/containers/HashTables/HashTable/HashTable.C b/src/OpenFOAM/containers/HashTables/HashTable/HashTable.C
index e96d1311e95..b57be56135f 100644
--- a/src/OpenFOAM/containers/HashTables/HashTable/HashTable.C
+++ b/src/OpenFOAM/containers/HashTables/HashTable/HashTable.C
@@ -30,35 +30,6 @@ License
 #include "List.H"
 #include "FixedList.H"
 
-// * * * * * * * * * * * * Protected Member Functions  * * * * * * * * * * * //
-
-template<class T, class Key, class Hash>
-template<class InputIter>
-Foam::label Foam::HashTable<T, Key, Hash>::eraseMultiple
-(
-    const InputIter begIter,
-    const InputIter endIter
-)
-{
-    const label nTotal = this->size();
-    label changed = 0;
-
-    for
-    (
-        InputIter iter = begIter;
-        changed < nTotal && iter != endIter; // terminate early
-        ++iter
-    )
-    {
-        if (this->erase(*iter))
-        {
-            ++changed;
-        }
-    }
-    return changed;
-}
-
-
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
 template<class T, class Key, class Hash>
@@ -435,30 +406,60 @@ bool Foam::HashTable<T, Key, Hash>::erase(const Key& key)
 
 
 template<class T, class Key, class Hash>
-Foam::label Foam::HashTable<T, Key, Hash>::erase(const UList<Key>& keys)
+template<class InputIter>
+inline Foam::label Foam::HashTable<T, Key, Hash>::erase
+(
+    InputIter first,
+    InputIter last
+)
 {
-    return eraseMultiple(keys.cbegin(), keys.cend());
+    label changed = 0;
+
+    for
+    (
+        const label nTotal = this->size();
+        changed < nTotal && first != last; // terminate early
+        ++first
+    )
+    {
+        if (this->erase(*first))
+        {
+            ++changed;
+        }
+    }
+
+    return changed;
+}
+
+
+template<class T, class Key, class Hash>
+inline Foam::label Foam::HashTable<T, Key, Hash>::erase
+(
+    std::initializer_list<Key> keys
+)
+{
+    return erase(keys.begin(), keys.end());
 }
 
 
 template<class T, class Key, class Hash>
 template<unsigned Size>
-Foam::label Foam::HashTable<T, Key, Hash>::erase
+inline Foam::label Foam::HashTable<T, Key, Hash>::eraseMany
 (
     const FixedList<Key, Size>& keys
 )
 {
-    return eraseMultiple(keys.cbegin(), keys.cend());
+    return erase(keys.cbegin(), keys.cend());
 }
 
 
 template<class T, class Key, class Hash>
-Foam::label Foam::HashTable<T, Key, Hash>::erase
+inline Foam::label Foam::HashTable<T, Key, Hash>::eraseMany
 (
-    std::initializer_list<Key> keys
+    const UList<Key>& keys
 )
 {
-    return eraseMultiple(keys.begin(), keys.end());
+    return erase(keys.cbegin(), keys.cend());
 }
 
 
diff --git a/src/OpenFOAM/containers/HashTables/HashTable/HashTable.H b/src/OpenFOAM/containers/HashTables/HashTable/HashTable.H
index 922fe917ced..6d67ba32649 100644
--- a/src/OpenFOAM/containers/HashTables/HashTable/HashTable.H
+++ b/src/OpenFOAM/containers/HashTables/HashTable/HashTable.H
@@ -311,18 +311,6 @@ protected:
         //- An iterator with non-const access to HashTable internals.
         friend class Iterator<false>;
 
-
-    // Protected Member Functions
-
-        //- Remove using begin/end iterators of listed keys
-        template<class InputIter>
-        inline label eraseMultiple
-        (
-            const InputIter begIter,
-            const InputIter endIter
-        );
-
-
 public:
 
     // Constructors
@@ -352,7 +340,7 @@ public:
 
     // Member Functions
 
-      // Access
+    // Access
 
         //- The size of the underlying table
         inline label capacity() const;
@@ -382,7 +370,7 @@ public:
         inline const T& lookup(const Key& key, const T& deflt) const;
 
 
-      // Table of contents
+    // Table of contents
 
         //- The table of contents (the keys) in unsorted order.
         List<Key> toc() const;
@@ -465,7 +453,7 @@ public:
         ) const;
 
 
-      // Edit
+    // Edit
 
         //- Insert a new entry, not overwriting existing entries.
         //  \return True if the entry inserted, which means that it did
@@ -495,27 +483,31 @@ public:
         //  \return True if the entry existed and was removed
         bool erase(const Key& key);
 
-        //- Remove table entries given by the listed keys
+        //- Remove table entries given by keys of the other hash-table.
+        //
+        //  The other hash-table must have the same type of key, but the
+        //  type of values held and the hashing function are arbitrary.
+        //
         //  \return The number of items removed
-        label erase(const UList<Key>& keys);
+        template<class AnyType, class AnyHash>
+        label erase(const HashTable<AnyType, Key, AnyHash>& other);
 
         //- Remove table entries given by the listed keys
         //  \return The number of items removed
-        template<unsigned Size>
-        label erase(const FixedList<Key, Size>& keys);
+        inline label erase(std::initializer_list<Key> keys);
+
+        //- Remove multiple entries using an iterator range of keys
+        template<class InputIter>
+        inline label erase(InputIter first, InputIter last);
 
         //- Remove table entries given by the listed keys
         //  \return The number of items removed
-        label erase(std::initializer_list<Key> keys);
+        template<unsigned Size>
+        inline label eraseMany(const FixedList<Key, Size>& keys);
 
-        //- Remove table entries given by keys of the other hash-table.
-        //
-        //  The other hash-table must have the same type of key, but the
-        //  type of values held and the hashing function are arbitrary.
-        //
+        //- Remove table entries given by the listed keys
         //  \return The number of items removed
-        template<class AnyType, class AnyHash>
-        label erase(const HashTable<AnyType, Key, AnyHash>& other);
+        inline label eraseMany(const UList<Key>& keys);
 
         //- Retain table entries given by keys of the other hash-table.
         //
diff --git a/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C b/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C
index 76ee09ff27f..86a07145d01 100644
--- a/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C
+++ b/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C
@@ -305,7 +305,7 @@ bool Foam::functionObjectList::readFunctionObject
     else if (args.size() > 1)
     {
         funcDict.set("fields", args);
-        requiredFields.insert(args);
+        requiredFields.insertMany(args);
     }
     else if (funcDict.found("field"))
     {
@@ -313,7 +313,7 @@ bool Foam::functionObjectList::readFunctionObject
     }
     else if (funcDict.found("fields"))
     {
-        requiredFields.insert(wordReList(funcDict.lookup("fields")));
+        requiredFields.insertMany(wordReList(funcDict.lookup("fields")));
     }
 
     // Insert named arguments
diff --git a/src/OpenFOAM/meshes/meshShapes/edge/edge.H b/src/OpenFOAM/meshes/meshShapes/edge/edge.H
index 7cff69f33e1..83e2b5ea303 100644
--- a/src/OpenFOAM/meshes/meshShapes/edge/edge.H
+++ b/src/OpenFOAM/meshes/meshShapes/edge/edge.H
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2011-2015 OpenFOAM Foundation
-     \\/     M anipulation  | Copyright (C) 2017 OpenCFD Ltd.
+     \\/     M anipulation  | Copyright (C) 2017-2018 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -62,25 +62,6 @@ class edge
 :
     public labelPair
 {
-    // Private Member Functions
-
-        //- Insert values, using begin/end iterators.
-        template<class InputIter>
-        inline label insertMultiple
-        (
-            const InputIter begIter,
-            const InputIter endIter
-        );
-
-        //- Remove values, using begin/end iterators.
-        template<class InputIter>
-        inline label eraseMultiple
-        (
-            const InputIter begIter,
-            const InputIter endIter
-        );
-
-
 public:
 
     // Static data members
@@ -100,13 +81,13 @@ public:
         inline edge(const labelPair& pair);
 
         //- Construct from list
-        inline edge(const FixedList<label, 2>& lst);
+        inline edge(const FixedList<label, 2>& list);
 
         //- Construct from two point labels, sorted with first less-than second
         inline edge(const label from, const label to, const bool doSort);
 
         //- Construct from list, sorted with first less-than second
-        inline edge(const FixedList<label, 2>& lst, const bool doSort);
+        inline edge(const FixedList<label, 2>& list, const bool doSort);
 
         //- Construct from Istream
         inline edge(Istream& is);
@@ -194,6 +175,7 @@ public:
         //- 'Clears' edge by setting both ends to invalid point labels.
         inline void clear();
 
+
         //- Fill any open slot with the index if it did not previously exist.
         //  Returns true on success. A negative label never inserts.
         //  Similar to a HashTable::insert().
@@ -203,20 +185,25 @@ public:
         //  Returns true on success. Negative labels never insert.
         //  Return the number of slots filled.
         //  Similar to a HashTable::insert().
-        inline label insert(const labelUList& lst);
+        inline label insert(std::initializer_list<label> list);
+
+        //- Insert values, using begin/end iterators.
+        template<class InputIter>
+        inline label insert(InputIter begIter, InputIter endIter);
 
         //- Fill open slots with the indices if they did not previously exist.
         //  Returns true on success. Negative labels never insert.
         //  Return the number of slots filled.
-        //  Similar to a HashTable::insert().
+        //  Similar to a HashTable::insertMany().
         template<unsigned Size>
-        inline label insert(const FixedList<label, Size>& lst);
+        inline label insertMany(const FixedList<label, Size>& list);
 
         //- Fill open slots with the indices if they did not previously exist.
         //  Returns true on success. Negative labels never insert.
         //  Return the number of slots filled.
-        //  Similar to a HashTable::insert().
-        inline label insert(std::initializer_list<label> lst);
+        //  Similar to a HashTable::insertMany().
+        inline label insertMany(const labelUList& list);
+
 
         //- Remove an existing index from the edge and set its location to '-1'.
         //  Returns the number of changes. A negative label never removes.
@@ -225,19 +212,23 @@ public:
 
         //- Remove existing indices from the edge and set locations to '-1'.
         //  Returns the number of changes.
-        inline label erase(const labelUList& lst);
+        inline label erase(std::initializer_list<label> list);
+
+        //- Remove values, using begin/end iterators.
+        template<class InputIter>
+        inline label erase(InputIter begIter, InputIter endIter);
 
         //- Remove existing indices from the edge and set locations to '-1'.
         //  Returns the number of changes.
         template<unsigned Size>
-        inline label erase(const FixedList<label, Size>& lst);
+        inline label eraseMany(const FixedList<label, Size>& list);
 
         //- Remove existing indices from the edge and set locations to '-1'.
         //  Returns the number of changes.
-        inline label erase(std::initializer_list<label> lst);
+        inline label eraseMany(const labelUList& list);
 
 
-     // Geometric functions
+    // Geometric functions
 
         //- Return centre point (centroid) of the edge.
         //  No special handling of negative point labels.
@@ -260,7 +251,7 @@ public:
         inline linePointRef line(const UList<point>& pts) const;
 
 
-     // Comparison
+    // Comparison
 
         //- Compare edges
         //  \return
diff --git a/src/OpenFOAM/meshes/meshShapes/edge/edgeI.H b/src/OpenFOAM/meshes/meshShapes/edge/edgeI.H
index 4957bd1336d..fcdaadc7167 100644
--- a/src/OpenFOAM/meshes/meshShapes/edge/edgeI.H
+++ b/src/OpenFOAM/meshes/meshShapes/edge/edgeI.H
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
-     \\/     M anipulation  | Copyright (C) 2017 OpenCFD Ltd.
+     \\/     M anipulation  | Copyright (C) 2017-2018 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -33,66 +33,6 @@ inline int Foam::edge::compare(const edge& a, const edge& b)
 }
 
 
-// * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
-
-template<class InputIter>
-inline Foam::label Foam::edge::insertMultiple
-(
-    const InputIter begIter,
-    const InputIter endIter
-)
-{
-    // Available slots.
-    // Don't use count() since it has special treatment for duplicates
-    const int maxChange = (first() < 0 ? 1 : 0) + (second() < 0 ? 1 : 0);
-
-    int changed = 0;
-    if (maxChange)
-    {
-        for (InputIter iter = begIter; iter != endIter; ++iter)
-        {
-            if (insert(*iter))
-            {
-                if (++changed >= maxChange)
-                {
-                    break;
-                }
-            }
-        }
-    }
-
-    return changed;
-}
-
-
-template<class InputIter>
-inline Foam::label Foam::edge::eraseMultiple
-(
-    const InputIter begIter,
-    const InputIter endIter
-)
-{
-    // Occupied slots.
-    // Don't use count() since it has special treatment for duplicates
-    const int maxChange = (first() >= 0 ? 1 : 0) + (second() >= 0 ? 1 : 0);
-
-    int changed = 0;
-    if (maxChange)
-    {
-        for (InputIter iter = begIter; iter != endIter; ++iter)
-        {
-            changed += erase(*iter);
-            if (changed >= maxChange)
-            {
-                break;
-            }
-        }
-    }
-
-    return changed;
-}
-
-
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
 inline Foam::edge::edge()
@@ -113,9 +53,9 @@ inline Foam::edge::edge(const labelPair& pair)
 {}
 
 
-inline Foam::edge::edge(const FixedList<label, 2>& lst)
+inline Foam::edge::edge(const FixedList<label, 2>& list)
 :
-    labelPair(lst.first(), lst.last())
+    labelPair(list.first(), list.last())
 {}
 
 
@@ -125,9 +65,9 @@ inline Foam::edge::edge(const label from, const label to, const bool doSort)
 {}
 
 
-inline Foam::edge::edge(const FixedList<label, 2>& lst, const bool doSort)
+inline Foam::edge::edge(const FixedList<label, 2>& list, const bool doSort)
 :
-    labelPair(lst, doSort)
+    labelPair(list, doSort)
 {}
 
 
@@ -329,22 +269,46 @@ inline bool Foam::edge::insert(const label index)
 }
 
 
-inline Foam::label Foam::edge::insert(const labelUList& lst)
+template<class InputIter>
+inline Foam::label Foam::edge::insert
+(
+    InputIter begIter,
+    InputIter endIter
+)
 {
-    return insertMultiple(lst.begin(), lst.end());
+    // Available slots.
+    // Don't use count() since it has special treatment for duplicates
+    const int maxChange = ((first() < 0 ? 1 : 0) + (second() < 0 ? 1 : 0));
+
+    int changed = 0;
+    for (; changed < maxChange && begIter != endIter; ++begIter)
+    {
+        if (insert(*begIter))
+        {
+            ++changed;
+        }
+    }
+
+    return changed;
+}
+
+
+inline Foam::label Foam::edge::insert(std::initializer_list<label> list)
+{
+    return insert(list.begin(), list.end());
 }
 
 
 template<unsigned Size>
-inline Foam::label Foam::edge::insert(const FixedList<label, Size>& lst)
+inline Foam::label Foam::edge::insertMany(const FixedList<label, Size>& list)
 {
-    return insertMultiple(lst.begin(), lst.end());
+    return insert(list.begin(), list.end());
 }
 
 
-inline Foam::label Foam::edge::insert(std::initializer_list<label> lst)
+inline Foam::label Foam::edge::insertMany(const labelUList& list)
 {
-    return insertMultiple(lst.begin(), lst.end());
+    return insert(list.begin(), list.end());
 }
 
 
@@ -374,22 +338,43 @@ inline Foam::label Foam::edge::erase(const label index)
 }
 
 
-inline Foam::label Foam::edge::erase(const labelUList& lst)
+template<class InputIter>
+inline Foam::label Foam::edge::erase
+(
+    InputIter begIter,
+    InputIter endIter
+)
+{
+    // Occupied slots.
+    // Don't use count() since it has special treatment for duplicates
+    const int maxChange = ((first() >= 0 ? 1 : 0) + (second() >= 0 ? 1 : 0));
+
+    int changed = 0;
+    for (; changed < maxChange && begIter != endIter; ++begIter)
+    {
+        changed += erase(*begIter);
+    }
+
+    return changed;
+}
+
+
+inline Foam::label Foam::edge::erase(std::initializer_list<label> list)
 {
-    return eraseMultiple(lst.begin(), lst.end());
+    return erase(list.begin(), list.end());
 }
 
 
 template<unsigned Size>
-inline Foam::label Foam::edge::erase(const FixedList<label, Size>& lst)
+inline Foam::label Foam::edge::eraseMany(const FixedList<label, Size>& list)
 {
-    return eraseMultiple(lst.begin(), lst.end());
+    return erase(list.begin(), list.end());
 }
 
 
-inline Foam::label Foam::edge::erase(std::initializer_list<label> lst)
+inline Foam::label Foam::edge::eraseMany(const labelUList& list)
 {
-    return eraseMultiple(lst.begin(), lst.end());
+    return erase(list.begin(), list.end());
 }
 
 
diff --git a/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C b/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C
index 3f75be93e5d..745fcb49584 100644
--- a/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C
+++ b/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C
@@ -784,11 +784,7 @@ Foam::labelHashSet Foam::polyBoundaryMesh::patchSet
         // Treat the given patch names as wild-cards and search the set
         // of all patch names for matches
         labelList patchIDs = findStrings(patchName, allPatchNames);
-
-        forAll(patchIDs, j)
-        {
-            ids.insert(patchIDs[j]);
-        }
+        ids.insertMany(patchIDs);
 
         if (patchIDs.empty())
         {
@@ -803,11 +799,7 @@ Foam::labelHashSet Foam::polyBoundaryMesh::patchSet
                 {
                     const word& name = allGroupNames[groupIDs[i]];
                     const labelList& extraPatchIDs = groupPatchIDs()[name];
-
-                    forAll(extraPatchIDs, extraI)
-                    {
-                        ids.insert(extraPatchIDs[extraI]);
-                    }
+                    ids.insertMany(extraPatchIDs);
                 }
 
                 if (groupIDs.empty() && warnNotFound)
diff --git a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCellPoints.C b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCellPoints.C
index 0f96e519cca..ab96883fbfd 100644
--- a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCellPoints.C
+++ b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCellPoints.C
@@ -75,7 +75,7 @@ const Foam::labelList& Foam::primitiveMesh::cellPoints
 
         for (const label facei : cFaces)
         {
-            set.insert(fcs[facei]);
+            set.insertMany(fcs[facei]);
         }
 
         storage.clear();
diff --git a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshEdges.C b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshEdges.C
index cc91132dc67..4e46d6294d0 100644
--- a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshEdges.C
+++ b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshEdges.C
@@ -646,7 +646,7 @@ const Foam::labelList& Foam::primitiveMesh::cellEdges
 
         for (const label facei : cFaces)
         {
-            set.insert(faceEdges(facei));
+            set.insertMany(faceEdges(facei));
         }
 
         storage.clear();
diff --git a/src/conversion/vtk/part/foamVtuSizing.C b/src/conversion/vtk/part/foamVtuSizing.C
index 07752d63dfe..0bb9fb5592d 100644
--- a/src/conversion/vtk/part/foamVtuSizing.C
+++ b/src/conversion/vtk/part/foamVtuSizing.C
@@ -124,9 +124,9 @@ void Foam::vtk::vtuSizing::reset
             bool first = true;
 
             const cell& cFaces = mesh.cells()[celli];
-            forAll(cFaces, cFaceI)
+            for (const label facei : cFaces)
             {
-                const face& f = mesh.faces()[cFaces[cFaceI]];
+                const face& f = mesh.faces()[facei];
 
                 // Face decomposed into triangles and quads
                 // Tri -> Tet, Quad -> Pyr
@@ -160,12 +160,12 @@ void Foam::vtk::vtuSizing::reset
             // number of faces, size of each face, vertices per face
             // [nFaces, nFace0Pts, id1, id2, ..., nFace1Pts, id1, id2, ...]
 
-            forAll(cFaces, cFaceI)
+            for (const label facei : cFaces)
             {
-                const face& f = mesh.faces()[cFaces[cFaceI]];
+                const face& f = mesh.faces()[facei];
                 nFaceLabels_ += f.size();
 
-                hashUniqId.insert(f);
+                hashUniqId.insertMany(f);
             }
 
             // Legacy format only uses the face-stream.
diff --git a/src/conversion/vtk/part/foamVtuSizingTemplates.C b/src/conversion/vtk/part/foamVtuSizingTemplates.C
index 76133d03a35..4bfda81ac63 100644
--- a/src/conversion/vtk/part/foamVtuSizingTemplates.C
+++ b/src/conversion/vtk/part/foamVtuSizingTemplates.C
@@ -545,10 +545,7 @@ void Foam::vtk::vtuSizing::populateArrays
                 const face& f = mesh.faces()[cFaces[cFaceI]];
                 const bool isOwner = (owner[cFaces[cFaceI]] == celli);
 
-                forAll(f, fp)
-                {
-                    hashUniqId.insert(f[fp]);
-                }
+                hashUniqId.insertMany(f);
 
                 // number of labels for this face
                 faceOutput[faceIndexer++] = f.size();
diff --git a/src/dynamicMesh/attachDetach/detachInterface.C b/src/dynamicMesh/attachDetach/detachInterface.C
index 76ced713a04..f00979846a0 100644
--- a/src/dynamicMesh/attachDetach/detachInterface.C
+++ b/src/dynamicMesh/attachDetach/detachInterface.C
@@ -329,11 +329,7 @@ void Foam::attachDetach::detachInterface
     { // Protection and memory management
         // Make a map of master cells for quick reject
         labelHashSet mcMap(2*mc.size());
-
-        forAll(mc, mcI)
-        {
-            mcMap.insert(mc[mcI]);
-        }
+        mcMap.insertMany(mc);
 
         // Go through all the faces in the masterCellFaceMap.  If the
         // cells around them are not already used, add all of their
@@ -349,11 +345,7 @@ void Foam::attachDetach::detachInterface
             {
                 // Cell not found. Add its faces to the map
                 const cell& curFaces = cells[ownCell];
-
-                forAll(curFaces, facei)
-                {
-                    masterCellFaceMap.insert(curFaces[facei]);
-                }
+                masterCellFaceMap.insertMany(curFaces);
             }
 
             // Do the neighbour side if face is internal
@@ -365,11 +357,7 @@ void Foam::attachDetach::detachInterface
                 {
                     // Cell not found. Add its faces to the map
                     const cell& curFaces = cells[neiCell];
-
-                    forAll(curFaces, facei)
-                    {
-                        masterCellFaceMap.insert(curFaces[facei]);
-                    }
+                    masterCellFaceMap.insertMany(curFaces);
                 }
             }
         }
diff --git a/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.C b/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.C
index 5a3b9b649c5..36df8b2dd3a 100644
--- a/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.C
+++ b/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.C
@@ -228,10 +228,7 @@ Foam::wordList Foam::fvMeshDistribute::mergeWordList(const wordList& procNames)
     wordHashSet mergedNames;
     forAll(allNames, proci)
     {
-        forAll(allNames[proci], i)
-        {
-            mergedNames.insert(allNames[proci][i]);
-        }
+        mergedNames.insertMany(allNames[proci]);
     }
     return mergedNames.toc();
 }
diff --git a/src/dynamicMesh/motionSmoother/motionSmootherAlgo.C b/src/dynamicMesh/motionSmoother/motionSmootherAlgo.C
index ba31bb9b0ab..9d2e584ef5f 100644
--- a/src/dynamicMesh/motionSmoother/motionSmootherAlgo.C
+++ b/src/dynamicMesh/motionSmoother/motionSmootherAlgo.C
@@ -99,7 +99,7 @@ Foam::labelHashSet Foam::motionSmootherAlgo::getPoints
 
     for (const label faceId : faceLabels)
     {
-        usedPoints.insert(mesh_.faces()[faceId]);
+        usedPoints.insertMany(mesh_.faces()[faceId]);
     }
 
     return usedPoints;
@@ -115,7 +115,7 @@ Foam::labelHashSet Foam::motionSmootherAlgo::getPoints
 
     for (const label faceId : faceLabels)
     {
-        usedPoints.insert(mesh_.faces()[faceId]);
+        usedPoints.insertMany(mesh_.faces()[faceId]);
     }
 
     return usedPoints;
@@ -217,11 +217,11 @@ void Foam::motionSmootherAlgo::scaleField
     pointScalarField& fld
 ) const
 {
-    forAllConstIter(labelHashSet, pointLabels, iter)
+    for (const label pointi : pointLabels)
     {
-        if (isInternalPoint(iter.key()))
+        if (isInternalPoint(pointi))
         {
-            fld[iter.key()] *= scale;
+            fld[pointi] *= scale;
         }
     }
 
@@ -239,10 +239,8 @@ void Foam::motionSmootherAlgo::scaleField
     pointScalarField& fld
 ) const
 {
-    forAll(meshPoints, i)
+    for (const label pointi : meshPoints)
     {
-        label pointi = meshPoints[i];
-
         if (pointLabels.found(pointi))
         {
             fld[pointi] *= scale;
@@ -330,10 +328,7 @@ void Foam::motionSmootherAlgo::getAffectedFacesAndPoints
             {
                 const cell& cFaces = mesh_.cells()[pCells[pCelli]];
 
-                forAll(cFaces, cFacei)
-                {
-                    nbrFaces.insert(cFaces[cFacei]);
-                }
+                nbrFaces.insertMany(cFaces);
             }
         }
         nbrFaces.sync(mesh_);
@@ -949,20 +944,14 @@ bool Foam::motionSmootherAlgo::scaleMesh
                 label own = mesh_.faceOwner()[iter.key()];
                 const cell& ownFaces = mesh_.cells()[own];
 
-                forAll(ownFaces, cfI)
-                {
-                    newWrongFaces.insert(ownFaces[cfI]);
-                }
+                newWrongFaces.insertMany(ownFaces);
 
                 if (iter.key() < mesh_.nInternalFaces())
                 {
                     label nei = mesh_.faceNeighbour()[iter.key()];
                     const cell& neiFaces = mesh_.cells()[nei];
 
-                    forAll(neiFaces, cfI)
-                    {
-                        newWrongFaces.insert(neiFaces[cfI]);
-                    }
+                    newWrongFaces.insertMany(neiFaces);
                 }
             }
             wrongFaces.transfer(newWrongFaces);
diff --git a/src/dynamicMesh/perfectInterface/perfectInterface.C b/src/dynamicMesh/perfectInterface/perfectInterface.C
index bca3bda87b3..81cf5fb4a62 100644
--- a/src/dynamicMesh/perfectInterface/perfectInterface.C
+++ b/src/dynamicMesh/perfectInterface/perfectInterface.C
@@ -262,10 +262,7 @@ void Foam::perfectInterface::setRefinement
         {
             const labelList& pFaces = mesh.pointFaces()[meshPointi];
 
-            forAll(pFaces, pFacei)
-            {
-                affectedFaces.insert(pFaces[pFacei]);
-            }
+            affectedFaces.insertMany(pFaces);
         }
     }
     forAll(pp1, i)
diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8/hexRef8.C b/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8/hexRef8.C
index 9bee5b3d068..e57fa3fd33e 100644
--- a/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8/hexRef8.C
+++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8/hexRef8.C
@@ -5523,10 +5523,7 @@ void Foam::hexRef8::setUnrefinement
         {
             const labelList& pCells = mesh_.pointCells(splitPointLabels[i]);
 
-            forAll(pCells, j)
-            {
-                cSet.insert(pCells[j]);
-            }
+            cSet.insertMany(pCells);
         }
         cSet.write();
 
@@ -5550,10 +5547,7 @@ void Foam::hexRef8::setUnrefinement
         {
             const labelList& pFaces = mesh_.pointFaces()[splitPointLabels[i]];
 
-            forAll(pFaces, j)
-            {
-                splitFaces.insert(pFaces[j]);
-            }
+            splitFaces.insertMany(pFaces);
         }
 
         // Check with faceRemover what faces will get removed. Note that this
diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/removePoints.C b/src/dynamicMesh/polyTopoChange/polyTopoChange/removePoints.C
index d5a3c44600f..7b6b04cc6b0 100644
--- a/src/dynamicMesh/polyTopoChange/polyTopoChange/removePoints.C
+++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/removePoints.C
@@ -343,10 +343,7 @@ void Foam::removePoints::setRefinement
             // Store faces affected
             const labelList& pFaces = mesh_.pointFaces()[pointi];
 
-            forAll(pFaces, i)
-            {
-                facesAffected.insert(pFaces[i]);
-            }
+            facesAffected.insertMany(pFaces);
         }
     }
 
diff --git a/src/dynamicMesh/slidingInterface/coupleSlidingInterface.C b/src/dynamicMesh/slidingInterface/coupleSlidingInterface.C
index edcdbb64a02..88b3f36be84 100644
--- a/src/dynamicMesh/slidingInterface/coupleSlidingInterface.C
+++ b/src/dynamicMesh/slidingInterface/coupleSlidingInterface.C
@@ -186,10 +186,7 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const
             // edges
             for (const label slaveEdgei : curSlaveEdges)
             {
-                usedMasterEdges[slaveEdgei].insert
-                (
-                    curMasterEdges
-                );
+                usedMasterEdges[slaveEdgei].insertMany(curMasterEdges);
             }
         }
         else if (slavePointEdgeHits[pointi] > -1)
@@ -214,7 +211,7 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const
         {
             const labelList& curMasterEdges = masterPointEdges[masterPointi];
 
-            usedMasterEdges[masterPointEdgeHits[masterPointi]].insert
+            usedMasterEdges[masterPointEdgeHits[masterPointi]].insertMany
             (
                 curMasterEdges
             );
@@ -574,10 +571,7 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const
                 //     << masterPatch.localFaces()[facei]
                 //     << endl;
 
-                curMasterEdgesMap.insert
-                (
-                    masterFaceEdges[facei]
-                );
+                curMasterEdgesMap.insertMany(masterFaceEdges[facei]);
             }
 
             const labelList curMasterEdges(curMasterEdgesMap.toc());
diff --git a/src/dynamicMesh/slidingInterface/slidingInterfaceProjectPoints.C b/src/dynamicMesh/slidingInterface/slidingInterfaceProjectPoints.C
index 2969cfa1a7c..c1ff91566f1 100644
--- a/src/dynamicMesh/slidingInterface/slidingInterfaceProjectPoints.C
+++ b/src/dynamicMesh/slidingInterface/slidingInterfaceProjectPoints.C
@@ -880,8 +880,7 @@ bool Foam::slidingInterface::projectPoints() const
             for (const label facei : curFaceMap)
             {
                 const face& f = masterLocalFaces[facei];
-
-                curPointMap.insert(f);  // Insert all face points
+                curPointMap.insertMany(f);  // Insert all face points
             }
 
             const labelList curMasterPoints = curPointMap.toc();
diff --git a/src/finiteArea/faMesh/faMeshDemandDrivenData.C b/src/finiteArea/faMesh/faMeshDemandDrivenData.C
index 01d3692ae4e..c64a1511e6b 100644
--- a/src/finiteArea/faMesh/faMeshDemandDrivenData.C
+++ b/src/finiteArea/faMesh/faMeshDemandDrivenData.C
@@ -1455,10 +1455,8 @@ void Foam::faMesh::calcPointAreaNormalsByQuadricsFit() const
                     procPatch.neighbPoints()[nonGlobalPatchPoints[pointI]];
 
                 labelHashSet faceSet;
-                forAll(pointFaces[curPoint], faceI)
-                {
-                    faceSet.insert(pointFaces[curPoint][faceI]);
-                }
+                faceSet.insertMany(pointFaces[curPoint]);
+
                 labelList curFaces = faceSet.toc();
 
                 labelHashSet pointSet;
diff --git a/src/finiteVolume/functionObjects/fieldSelection/fieldSelectionTemplates.C b/src/finiteVolume/functionObjects/fieldSelection/fieldSelectionTemplates.C
index 80c476a44e1..653de0edfaa 100644
--- a/src/finiteVolume/functionObjects/fieldSelection/fieldSelectionTemplates.C
+++ b/src/finiteVolume/functionObjects/fieldSelection/fieldSelectionTemplates.C
@@ -34,13 +34,10 @@ void Foam::functionObjects::fieldSelection::addRegistered
     wordHashSet& set
 ) const
 {
-    DynamicList<word> names;
     for (const wordRe& name : *this)
     {
-        names.append(obr_.names<Type>(name));
+        set.insertMany(obr_.names<Type>(name));
     }
-
-    set.insert(names);
 }
 
 
diff --git a/src/finiteVolume/functionObjects/fieldSelection/fileFieldSelectionTemplates.C b/src/finiteVolume/functionObjects/fieldSelection/fileFieldSelectionTemplates.C
index ecfa95bdb4a..9ea26d114f7 100644
--- a/src/finiteVolume/functionObjects/fieldSelection/fileFieldSelectionTemplates.C
+++ b/src/finiteVolume/functionObjects/fieldSelection/fileFieldSelectionTemplates.C
@@ -26,7 +26,6 @@ License
 #include "IOobjectList.H"
 #include "GeometricField.H"
 #include "fvMesh.H"
-#include "DynamicList.H"
 
 // * * * * * * * * * * * * * Protected Member Functions  * * * * * * * * * * //
 
@@ -37,14 +36,10 @@ void Foam::functionObjects::fileFieldSelection::addFromFile
     wordHashSet& set
 ) const
 {
-    DynamicList<word> names(this->size());
-
     for (const wordRe& fieldName : *this)
     {
-        names.append(allFileObjects.names(Type::typeName, fieldName));
+        set.insertMany(allFileObjects.names(Type::typeName, fieldName));
     }
-
-    set.insert(names);
 }
 
 
diff --git a/src/finiteVolume/fvMatrices/solvers/isoAdvection/isoAdvection/isoAdvection.C b/src/finiteVolume/fvMatrices/solvers/isoAdvection/isoAdvection/isoAdvection.C
index cb101d95ff7..57de8b3cce6 100644
--- a/src/finiteVolume/fvMatrices/solvers/isoAdvection/isoAdvection/isoAdvection.C
+++ b/src/finiteVolume/fvMatrices/solvers/isoAdvection/isoAdvection/isoAdvection.C
@@ -1050,10 +1050,7 @@ void Foam::isoAdvection::writeSurfaceCells() const
             )
         );
 
-        forAll(surfCells_, i)
-        {
-            cSet.insert(surfCells_[i]);
-        }
+        cSet.insertMany(surfCells_);
 
         cSet.write();
     }
diff --git a/src/finiteVolume/fvMesh/extendedStencil/cellToCell/globalIndexStencils/cellToCellStencil.C b/src/finiteVolume/fvMesh/extendedStencil/cellToCell/globalIndexStencils/cellToCellStencil.C
index afbb8a90fef..cec896d7e36 100644
--- a/src/finiteVolume/fvMesh/extendedStencil/cellToCell/globalIndexStencils/cellToCellStencil.C
+++ b/src/finiteVolume/fvMesh/extendedStencil/cellToCell/globalIndexStencils/cellToCellStencil.C
@@ -248,10 +248,7 @@ void Foam::cellToCellStencil::unionEqOp::operator()
         else
         {
             labelHashSet set(x);
-            forAll(y, i)
-            {
-                set.insert(y[i]);
-            }
+            set.insertMany(y);
             x = set.toc();
         }
     }
diff --git a/src/finiteVolume/fvMesh/extendedStencil/cellToFace/globalIndexStencils/cellToFaceStencil.C b/src/finiteVolume/fvMesh/extendedStencil/cellToFace/globalIndexStencils/cellToFaceStencil.C
index 46275af0ffb..2a78462fa2f 100644
--- a/src/finiteVolume/fvMesh/extendedStencil/cellToFace/globalIndexStencils/cellToFaceStencil.C
+++ b/src/finiteVolume/fvMesh/extendedStencil/cellToFace/globalIndexStencils/cellToFaceStencil.C
@@ -249,10 +249,7 @@ void Foam::cellToFaceStencil::unionEqOp::operator()
         else
         {
             labelHashSet set(x);
-            forAll(y, i)
-            {
-                set.insert(y[i]);
-            }
+            set.insertMany(y);
             x = set.toc();
         }
     }
@@ -391,19 +388,11 @@ void Foam::cellToFaceStencil::calcFaceStencil
 
         const labelList& ownCCells = globalCellCells[own[facei]];
         label globalOwn = ownCCells[0];
-        // Insert cellCells
-        forAll(ownCCells, i)
-        {
-            faceStencilSet.insert(ownCCells[i]);
-        }
+        faceStencilSet.insertMany(ownCCells);  // Insert cellCells
 
         const labelList& neiCCells = globalCellCells[nei[facei]];
         label globalNei = neiCCells[0];
-        // Insert cellCells
-        forAll(neiCCells, i)
-        {
-            faceStencilSet.insert(neiCCells[i]);
-        }
+        faceStencilSet.insertMany(neiCCells);  // Insert cellCells
 
         // Guarantee owner first, neighbour second.
         faceStencil[facei].setSize(faceStencilSet.size());
@@ -433,19 +422,13 @@ void Foam::cellToFaceStencil::calcFaceStencil
 
                 const labelList& ownCCells = globalCellCells[own[facei]];
                 label globalOwn = ownCCells[0];
-                forAll(ownCCells, i)
-                {
-                    faceStencilSet.insert(ownCCells[i]);
-                }
+                faceStencilSet.insertMany(ownCCells);
 
                 // And the neighbours of the coupled cell
                 const labelList& neiCCells =
                     neiGlobalCellCells[facei-mesh_.nInternalFaces()];
                 label globalNei = neiCCells[0];
-                forAll(neiCCells, i)
-                {
-                    faceStencilSet.insert(neiCCells[i]);
-                }
+                faceStencilSet.insertMany(neiCCells);
 
                 // Guarantee owner first, neighbour second.
                 faceStencil[facei].setSize(faceStencilSet.size());
@@ -475,10 +458,7 @@ void Foam::cellToFaceStencil::calcFaceStencil
 
                 const labelList& ownCCells = globalCellCells[own[facei]];
                 label globalOwn = ownCCells[0];
-                forAll(ownCCells, i)
-                {
-                    faceStencilSet.insert(ownCCells[i]);
-                }
+                faceStencilSet.insertMany(ownCCells);
 
                 // Guarantee owner first
                 faceStencil[facei].setSize(faceStencilSet.size());
diff --git a/src/functionObjects/field/turbulenceFields/turbulenceFields.C b/src/functionObjects/field/turbulenceFields/turbulenceFields.C
index 6c697271de6..054ad322cbe 100644
--- a/src/functionObjects/field/turbulenceFields/turbulenceFields.C
+++ b/src/functionObjects/field/turbulenceFields/turbulenceFields.C
@@ -146,16 +146,16 @@ bool Foam::functionObjects::turbulenceFields::read(const dictionary& dict)
     }
     else
     {
-        fieldSet_.insert(wordList(dict.lookup("fields")));
+        fieldSet_.insertMany(wordList(dict.lookup("fields")));
     }
 
     Info<< type() << " " << name() << ": ";
     if (fieldSet_.size())
     {
         Info<< "storing fields:" << nl;
-        forAllConstIter(wordHashSet, fieldSet_, iter)
+        for (const word& f : fieldSet_)
         {
-            Info<< "    " << modelName << ':' << iter.key() << nl;
+            Info<< "    " << modelName << ':' << f << nl;
         }
         Info<< endl;
     }
@@ -177,9 +177,8 @@ bool Foam::functionObjects::turbulenceFields::execute()
         const compressible::turbulenceModel& model =
             obr_.lookupObject<compressible::turbulenceModel>(modelName);
 
-        forAllConstIter(wordHashSet, fieldSet_, iter)
+        for (const word& f : fieldSet_)
         {
-            const word& f = iter.key();
             switch (compressibleFieldNames_[f])
             {
                 case cfK:
@@ -250,9 +249,8 @@ bool Foam::functionObjects::turbulenceFields::execute()
         const incompressible::turbulenceModel& model =
             obr_.lookupObject<incompressible::turbulenceModel>(modelName);
 
-        forAllConstIter(wordHashSet, fieldSet_, iter)
+        for (const word& f : fieldSet_)
         {
-            const word& f = iter.key();
             switch (incompressibleFieldNames_[f])
             {
                 case ifK:
@@ -315,9 +313,9 @@ bool Foam::functionObjects::turbulenceFields::execute()
 
 bool Foam::functionObjects::turbulenceFields::write()
 {
-    forAllConstIter(wordHashSet, fieldSet_, iter)
+    for (const word& f : fieldSet_)
     {
-        const word fieldName = modelName + ':' + iter.key();
+        const word fieldName = modelName + ':' + f;
         writeObject(fieldName);
     }
 
diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleErosion/ParticleErosion.C b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleErosion/ParticleErosion.C
index fec798351bd..4591d067f38 100644
--- a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleErosion/ParticleErosion.C
+++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleErosion/ParticleErosion.C
@@ -92,7 +92,7 @@ Foam::ParticleErosion<CloudType>::ParticleErosion
                 << endl;
         }
 
-        uniqIds.insert(ids);
+        uniqIds.insertMany(ids);
     }
 
     patchIDs_ = uniqIds.sortedToc();
diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/PatchPostProcessing/PatchPostProcessing.C b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/PatchPostProcessing/PatchPostProcessing.C
index 21752df47fd..6e849578d05 100644
--- a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/PatchPostProcessing/PatchPostProcessing.C
+++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/PatchPostProcessing/PatchPostProcessing.C
@@ -149,7 +149,7 @@ Foam::PatchPostProcessing<CloudType>::PatchPostProcessing
                 << endl;
         }
 
-        uniqIds.insert(ids);
+        uniqIds.insertMany(ids);
     }
 
     patchIDs_ = uniqIds.sortedToc();
diff --git a/src/mesh/snappyHexMesh/meshRefinement/meshRefinement.C b/src/mesh/snappyHexMesh/meshRefinement/meshRefinement.C
index ca7765e8b96..d8393007db0 100644
--- a/src/mesh/snappyHexMesh/meshRefinement/meshRefinement.C
+++ b/src/mesh/snappyHexMesh/meshRefinement/meshRefinement.C
@@ -1011,7 +1011,7 @@ Foam::label Foam::meshRefinement::splitFacesUndo
         {
             const labelList grownFaces(growFaceCellFace(errorFaces));
             errorFaces.clear();
-            errorFaces.insert(grownFaces);
+            errorFaces.insertMany(grownFaces);
         }
 
 
diff --git a/src/mesh/snappyHexMesh/meshRefinement/meshRefinementBaffles.C b/src/mesh/snappyHexMesh/meshRefinement/meshRefinementBaffles.C
index 62011f55452..16115116a66 100644
--- a/src/mesh/snappyHexMesh/meshRefinement/meshRefinementBaffles.C
+++ b/src/mesh/snappyHexMesh/meshRefinement/meshRefinementBaffles.C
@@ -625,10 +625,7 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::createBaffles
             {
                 const cell& ownFaces = mesh_.cells()[mesh_.faceOwner()[faceI]];
 
-                forAll(ownFaces, i)
-                {
-                    baffledFacesSet.insert(ownFaces[i]);
-                }
+                baffledFacesSet.insertMany(ownFaces);
             }
         }
         // Pick up neighbour side of baffle (added faces)
@@ -640,10 +637,7 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::createBaffles
             {
                 const cell& ownFaces = mesh_.cells()[mesh_.faceOwner()[faceI]];
 
-                forAll(ownFaces, i)
-                {
-                    baffledFacesSet.insert(ownFaces[i]);
-                }
+                baffledFacesSet.insertMany(ownFaces);
             }
         }
         baffledFacesSet.sync(mesh_);
diff --git a/src/mesh/snappyHexMesh/meshRefinement/meshRefinementMerge.C b/src/mesh/snappyHexMesh/meshRefinement/meshRefinementMerge.C
index aecae526748..e5df4137334 100644
--- a/src/mesh/snappyHexMesh/meshRefinement/meshRefinementMerge.C
+++ b/src/mesh/snappyHexMesh/meshRefinement/meshRefinementMerge.C
@@ -227,19 +227,13 @@ Foam::label Foam::meshRefinement::mergePatchFaces
 //
 //            const cell& ownFaces = cells[mesh_.faceOwner()[faceI]];
 //
-//            forAll(ownFaces, i)
-//            {
-//                retestFaces.insert(ownFaces[i]);
-//            }
+//            retestFaces.insertMany(ownFaces);
 //
 //            if (mesh_.isInternalFace(faceI))
 //            {
 //                const cell& neiFaces = cells[mesh_.faceNeighbour()[faceI]];
 //
-//                forAll(neiFaces, i)
-//                {
-//                    retestFaces.insert(neiFaces[i]);
-//                }
+//                retestFaces.insertMany(neiFaces);
 //            }
 //        }
 //        updateMesh(map, retestFaces.toc());
@@ -337,10 +331,7 @@ Foam::label Foam::meshRefinement::mergePatchFacesUndo
             faceSet allSets(mesh_, "allFaceSets", allFaceSets.size());
             forAll(allFaceSets, setI)
             {
-                forAll(allFaceSets[setI], i)
-                {
-                    allSets.insert(allFaceSets[setI][i]);
-                }
+                allSets.insertMany(allFaceSets[setI]);
             }
             Pout<< "Writing all faces to be merged to set "
                 << allSets.objectPath() << endl;
diff --git a/src/meshTools/cellClassification/cellClassification.C b/src/meshTools/cellClassification/cellClassification.C
index 294ececd2ef..3a26f978516 100644
--- a/src/meshTools/cellClassification/cellClassification.C
+++ b/src/meshTools/cellClassification/cellClassification.C
@@ -300,10 +300,7 @@ void Foam::cellClassification::markCells
 
             // Mark faces of celli
             const labelList& myFaces = mesh_.cells()[celli];
-            forAll(myFaces, myFacei)
-            {
-                outsideFacesMap.insert(myFaces[myFacei]);
-            }
+            outsideFacesMap.insertMany(myFaces);
         }
     }
 
diff --git a/src/meshTools/cellDist/cellDistFuncs.C b/src/meshTools/cellDist/cellDistFuncs.C
index 58b60a42586..718807bd89c 100644
--- a/src/meshTools/cellDist/cellDistFuncs.C
+++ b/src/meshTools/cellDist/cellDistFuncs.C
@@ -172,11 +172,7 @@ Foam::label Foam::cellDistFuncs::getPointNeighbours
         forAll(f, fp)
         {
             const labelList& pointNbs = patch.pointFaces()[f[fp]];
-
-            forAll(pointNbs, i)
-            {
-                nbs.insert(pointNbs[i]);
-            }
+            nbs.insertMany(pointNbs);
         }
 
         // Subtract ours.
diff --git a/src/meshTools/meshTools/meshTools.C b/src/meshTools/meshTools/meshTools.C
index cb90a991c99..4caac134517 100644
--- a/src/meshTools/meshTools/meshTools.C
+++ b/src/meshTools/meshTools/meshTools.C
@@ -301,11 +301,7 @@ void Foam::meshTools::writeOBJ
     forAll(cellLabels, i)
     {
         const cell& cFaces = cells[cellLabels[i]];
-
-        forAll(cFaces, j)
-        {
-            usedFaces.insert(cFaces[j]);
-        }
+        usedFaces.insertMany(cFaces);
     }
 
     writeOBJ(os, faces, points, usedFaces.toc());
diff --git a/src/meshTools/sets/faceSources/normalToFace/normalToFace.C b/src/meshTools/sets/faceSources/normalToFace/normalToFace.C
index eb289aa68c0..576aeae4494 100644
--- a/src/meshTools/sets/faceSources/normalToFace/normalToFace.C
+++ b/src/meshTools/sets/faceSources/normalToFace/normalToFace.C
@@ -160,10 +160,7 @@ void Foam::normalToFace::applyToSet
             }
         }
 
-        forAll(toBeRemoved, i)
-        {
-            set.erase(toBeRemoved[i]);
-        }
+        set.eraseMany(toBeRemoved);
     }
 }
 
diff --git a/src/meshTools/triSurface/triSurfaceTools/triSurfaceTools.C b/src/meshTools/triSurface/triSurfaceTools/triSurfaceTools.C
index 4b48447d2a7..5c546362ac2 100644
--- a/src/meshTools/triSurface/triSurfaceTools/triSurfaceTools.C
+++ b/src/meshTools/triSurface/triSurfaceTools/triSurfaceTools.C
@@ -384,11 +384,7 @@ Foam::labelHashSet Foam::triSurfaceTools::getCollapsedFaces
     const labelList& myFaces = surf.edgeFaces()[edgeI];
 
     labelHashSet facesToBeCollapsed(2*myFaces.size());
-
-    forAll(myFaces, myFacei)
-    {
-        facesToBeCollapsed.insert(myFaces[myFacei]);
-    }
+    facesToBeCollapsed.insertMany(myFaces);
 
     // From faces using v1 check if they share an edge with faces
     // using v2.
diff --git a/src/parallel/decompose/decompositionMethods/structuredDecomp/structuredDecomp.C b/src/parallel/decompose/decompositionMethods/structuredDecomp/structuredDecomp.C
index a2a68a871ec..a44e4b64a48 100644
--- a/src/parallel/decompose/decompositionMethods/structuredDecomp/structuredDecomp.C
+++ b/src/parallel/decompose/decompositionMethods/structuredDecomp/structuredDecomp.C
@@ -85,7 +85,7 @@ Foam::labelList Foam::structuredDecomp::decompose
     labelHashSet patchCells(2*nFaces);
     for (const label patchi : patchIDs)
     {
-        patchCells.insert(pbm[patchi].faceCells());
+        patchCells.insertMany(pbm[patchi].faceCells());
     }
 
     // Subset the layer of cells next to the patch
diff --git a/src/regionModels/surfaceFilmModels/submodels/kinematic/injectionModel/injectionModelList/injectionModelList.C b/src/regionModels/surfaceFilmModels/submodels/kinematic/injectionModel/injectionModelList/injectionModelList.C
index c71833509fc..16670279333 100644
--- a/src/regionModels/surfaceFilmModels/submodels/kinematic/injectionModel/injectionModelList/injectionModelList.C
+++ b/src/regionModels/surfaceFilmModels/submodels/kinematic/injectionModel/injectionModelList/injectionModelList.C
@@ -62,11 +62,7 @@ injectionModelList::injectionModelList
 {
     const wordList activeModels(dict.lookup("injectionModels"));
 
-    wordHashSet models;
-    forAll(activeModels, i)
-    {
-        models.insert(activeModels[i]);
-    }
+    wordHashSet models(activeModels);
 
     Info<< "    Selecting film injection models" << endl;
     if (models.size() > 0)
@@ -74,9 +70,8 @@ injectionModelList::injectionModelList
         this->setSize(models.size());
 
         label i = 0;
-        forAllConstIter(wordHashSet, models, iter)
+        for (const word& model : models)
         {
-            const word& model = iter.key();
             set(i, injectionModel::New(film, dict, model));
             i++;
         }
diff --git a/src/regionModels/surfaceFilmModels/submodels/kinematic/transferModels/transferModelList/transferModelList.C b/src/regionModels/surfaceFilmModels/submodels/kinematic/transferModels/transferModelList/transferModelList.C
index 123713b26b5..b3b0f9ef9c2 100644
--- a/src/regionModels/surfaceFilmModels/submodels/kinematic/transferModels/transferModelList/transferModelList.C
+++ b/src/regionModels/surfaceFilmModels/submodels/kinematic/transferModels/transferModelList/transferModelList.C
@@ -65,11 +65,7 @@ transferModelList::transferModelList
         dict.lookupOrDefault("transferModels", wordList())
     );
 
-    wordHashSet models;
-    forAll(activeModels, i)
-    {
-        models.insert(activeModels[i]);
-    }
+    wordHashSet models(activeModels);
 
     Info<< "    Selecting film transfer models" << endl;
     if (models.size() > 0)
@@ -77,9 +73,8 @@ transferModelList::transferModelList
         this->setSize(models.size());
 
         label i = 0;
-        forAllConstIter(wordHashSet, models, iter)
+        for (const word& model : models)
         {
-            const word& model = iter.key();
             set(i, transferModel::New(film, dict, model));
             i++;
         }
diff --git a/src/renumber/renumberMethods/structuredRenumber/structuredRenumber.C b/src/renumber/renumberMethods/structuredRenumber/structuredRenumber.C
index 2ee8a9f2765..d2c49eada05 100644
--- a/src/renumber/renumberMethods/structuredRenumber/structuredRenumber.C
+++ b/src/renumber/renumberMethods/structuredRenumber/structuredRenumber.C
@@ -158,13 +158,9 @@ Foam::labelList Foam::structuredRenumber::renumber
 
     // Extract a submesh.
     labelHashSet patchCells(2*nFaces);
-    forAllConstIter(labelHashSet, patchIDs, iter)
+    for (const label patchId : patchIDs)
     {
-        const labelUList& fc = pbm[iter.key()].faceCells();
-        forAll(fc, i)
-        {
-            patchCells.insert(fc[i]);
-        }
+        patchCells.insertMany(pbm[patchId].faceCells());
     }
 
     label nTotalSeeds = returnReduce(patchCells.size(), sumOp<label>());
diff --git a/src/sampling/probes/probes.C b/src/sampling/probes/probes.C
index 489c8e069e6..ad9c9fdb074 100644
--- a/src/sampling/probes/probes.C
+++ b/src/sampling/probes/probes.C
@@ -177,17 +177,17 @@ Foam::label Foam::probes::prepare()
     {
         wordHashSet currentFields;
 
-        currentFields.insert(scalarFields_);
-        currentFields.insert(vectorFields_);
-        currentFields.insert(sphericalTensorFields_);
-        currentFields.insert(symmTensorFields_);
-        currentFields.insert(tensorFields_);
-
-        currentFields.insert(surfaceScalarFields_);
-        currentFields.insert(surfaceVectorFields_);
-        currentFields.insert(surfaceSphericalTensorFields_);
-        currentFields.insert(surfaceSymmTensorFields_);
-        currentFields.insert(surfaceTensorFields_);
+        currentFields.insertMany(scalarFields_);
+        currentFields.insertMany(vectorFields_);
+        currentFields.insertMany(sphericalTensorFields_);
+        currentFields.insertMany(symmTensorFields_);
+        currentFields.insertMany(tensorFields_);
+
+        currentFields.insertMany(surfaceScalarFields_);
+        currentFields.insertMany(surfaceVectorFields_);
+        currentFields.insertMany(surfaceSphericalTensorFields_);
+        currentFields.insertMany(surfaceSymmTensorFields_);
+        currentFields.insertMany(surfaceTensorFields_);
 
         DebugInfo
             << "Probing fields: " << currentFields << nl
@@ -229,10 +229,8 @@ Foam::label Foam::probes::prepare()
         }
 
         // currentFields now just has the new fields - open streams for them
-        forAllConstIter(wordHashSet, currentFields, iter)
+        for (const word& fieldName : currentFields)
         {
-            const word& fieldName = iter.key();
-
             // Create directory if does not exist.
             mkDir(probeDir);
 
diff --git a/src/sampling/surfMeshSampler/surfMeshSamplers/surfMeshSamplers.C b/src/sampling/surfMeshSampler/surfMeshSamplers/surfMeshSamplers.C
index 7172d8164ae..8654729b8e6 100644
--- a/src/sampling/surfMeshSampler/surfMeshSamplers/surfMeshSamplers.C
+++ b/src/sampling/surfMeshSampler/surfMeshSamplers/surfMeshSamplers.C
@@ -236,11 +236,11 @@ bool Foam::surfMeshSamplers::execute()
 
         // The acceptable fields
         wordHashSet acceptable(added);
-        acceptable.insert(acceptType<scalar>());
-        acceptable.insert(acceptType<vector>());
-        acceptable.insert(acceptType<sphericalTensor>());
-        acceptable.insert(acceptType<symmTensor>());
-        acceptable.insert(acceptType<tensor>());
+        acceptable.insertMany(acceptType<scalar>());
+        acceptable.insertMany(acceptType<vector>());
+        acceptable.insertMany(acceptType<sphericalTensor>());
+        acceptable.insertMany(acceptType<symmTensor>());
+        acceptable.insertMany(acceptType<tensor>());
 
         const wordList fields = acceptable.sortedToc();
         if (!fields.empty())
-- 
GitLab