STYLE: use direct iteration for HashSet

- The iterator for a HashSet dereferences directly to its key.

- Eg,

      for (const label patchi : patchSet)
      {
          ...
      }
  vs.
      forAllConstIter(labelHashSet, patchSet, iter)
      {
          const label patchi = iter.key();
          ...
      }
This commit is contained in:
Mark Olesen
2018-03-06 00:29:03 +01:00
parent 2a6ac7edce
commit 4fe8ed8245
73 changed files with 475 additions and 602 deletions

View File

@ -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) 2015 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015-2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -57,16 +57,16 @@ void Foam::meshRefinement::markBoundaryFace
const labelList& fEdges = mesh_.faceEdges(facei);
forAll(fEdges, fp)
for (const label edgei : fEdges)
{
isBoundaryEdge[fEdges[fp]] = true;
isBoundaryEdge[edgei] = true;
}
const face& f = mesh_.faces()[facei];
forAll(f, fp)
for (const label pointi : f)
{
isBoundaryPoint[f[fp]] = true;
isBoundaryPoint[pointi] = true;
}
}
@ -551,7 +551,7 @@ Foam::labelList Foam::meshRefinement::markFacesOnProblemCells
);
// Baffle all faces of cells that need to be removed
forAllConstIter(Map<label>, problemCells, iter)
forAllConstIters(problemCells, iter)
{
const cell& cFaces = mesh_.cells()[iter.key()];
@ -832,30 +832,26 @@ Foam::labelList Foam::meshRefinement::markFacesOnProblemCells
DynamicList<label> dynPCells;
forAllConstIter(labelHashSet, nonBoundaryAnchors, iter)
for (const label pointi : nonBoundaryAnchors)
{
label pointi = iter.key();
const labelList& pCells = mesh_.pointCells(pointi, dynPCells);
// Count number of 'hasSevenBoundaryAnchorPoints' cells.
label n = 0;
forAll(pCells, i)
for (const label celli : pCells)
{
if (hasSevenBoundaryAnchorPoints.test(pCells[i]))
if (hasSevenBoundaryAnchorPoints.test(celli))
{
n++;
++n;
}
}
if (n > 3)
{
// Point in danger of being what? Remove all 7-cells.
forAll(pCells, i)
for (const label celli : pCells)
{
label celli = pCells[i];
if (hasSevenBoundaryAnchorPoints.test(celli))
{
if
@ -878,10 +874,8 @@ Foam::labelList Foam::meshRefinement::markFacesOnProblemCells
{
const cell& cFaces = mesh_.cells()[celli];
forAll(cFaces, cf)
for (const label facei : cFaces)
{
label facei = cFaces[cf];
if
(
facePatch[facei] == -1
@ -943,11 +937,11 @@ Foam::labelList Foam::meshRefinement::markFacesOnProblemCells
const labelList& fEdges = mesh_.faceEdges(facei, dynFEdges);
label nFaceBoundaryEdges = 0;
forAll(fEdges, fe)
for (const label edgei : fEdges)
{
if (isBoundaryEdge[fEdges[fe]])
if (isBoundaryEdge[edgei])
{
nFaceBoundaryEdges++;
++nFaceBoundaryEdges;
}
}
@ -985,10 +979,8 @@ Foam::labelList Foam::meshRefinement::markFacesOnProblemCells
}
}
forAll(patches, patchi)
for (const polyPatch& pp : patches)
{
const polyPatch& pp = patches[patchi];
if (pp.coupled())
{
label facei = pp.start();
@ -1000,11 +992,11 @@ Foam::labelList Foam::meshRefinement::markFacesOnProblemCells
const labelList& fEdges = mesh_.faceEdges(facei, dynFEdges);
label nFaceBoundaryEdges = 0;
forAll(fEdges, fe)
for (const label edgei : fEdges)
{
if (isBoundaryEdge[fEdges[fe]])
if (isBoundaryEdge[edgei])
{
nFaceBoundaryEdges++;
++nFaceBoundaryEdges;
}
}