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 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2017 OpenFOAM Foundation \\ / A nd | Copyright (C) 2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -85,9 +85,8 @@ VoFPatchTransfer::VoFPatchTransfer
Info<< " applying to patches:" << nl; Info<< " applying to patches:" << nl;
label pidi = 0; label pidi = 0;
forAllConstIter(labelHashSet, patchSet, iter) for (const label patchi : patchSet)
{ {
const label patchi = iter.key();
patchIDs_[pidi++] = patchi; patchIDs_[pidi++] = patchi;
Info<< " " << pbm[patchi].name() << endl; Info<< " " << pbm[patchi].name() << endl;
} }

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -339,16 +339,17 @@ void subsetTopoSets
// Map the data // Map the data
bitSet isSet(set.maxSize(mesh)); bitSet isSet(set.maxSize(mesh));
forAllConstIter(labelHashSet, set, iter) for (const label id : set)
{ {
isSet.set(iter.key()); isSet.set(id);
} }
label nSet = 0; label nSet = 0;
forAll(map, i) for (const label id : map)
{ {
if (isSet[map[i]]) if (isSet.test(id))
{ {
nSet++; ++nSet;
} }
} }
@ -358,9 +359,10 @@ void subsetTopoSets
new TopoSet(subMesh, set.name(), nSet, IOobject::AUTO_WRITE) new TopoSet(subMesh, set.name(), nSet, IOobject::AUTO_WRITE)
); );
TopoSet& subSet = subSets[i]; TopoSet& subSet = subSets[i];
forAll(map, i) forAll(map, i)
{ {
if (isSet[map[i]]) if (isSet.test(map[i]))
{ {
subSet.insert(i); subSet.insert(i);
} }

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -92,12 +92,12 @@ label mergePatchFaces
{ {
// Store the faces of the face sets // Store the faces of the face sets
List<faceList> allFaceSetsFaces(allFaceSets.size()); List<faceList> allFaceSetsFaces(allFaceSets.size());
forAll(allFaceSets, setI) forAll(allFaceSets, seti)
{ {
allFaceSetsFaces[setI] = UIndirectList<face> allFaceSetsFaces[seti] = UIndirectList<face>
( (
mesh.faces(), mesh.faces(),
allFaceSets[setI] allFaceSets[seti]
); );
} }
@ -146,13 +146,13 @@ label mergePatchFaces
// Sets where the master is in error // Sets where the master is in error
labelHashSet errorSets; labelHashSet errorSets;
forAll(allFaceSets, setI) forAll(allFaceSets, seti)
{ {
label newMasterI = map().reverseFaceMap()[allFaceSets[setI][0]]; label newMasterI = map().reverseFaceMap()[allFaceSets[seti][0]];
if (errorFaces.found(newMasterI)) if (errorFaces.found(newMasterI))
{ {
errorSets.insert(setI); errorSets.insert(seti);
} }
} }
label nErrorSets = returnReduce(errorSets.size(), sumOp<label>()); label nErrorSets = returnReduce(errorSets.size(), sumOp<label>());
@ -162,14 +162,12 @@ label mergePatchFaces
<< " These will be restored to their original faces." << " These will be restored to their original faces."
<< endl; << endl;
if (nErrorSets > 0) if (nErrorSets)
{ {
// Renumber stored faces to new vertex numbering. // Renumber stored faces to new vertex numbering.
forAllConstIter(labelHashSet, errorSets, iter) for (const label seti : errorSets)
{ {
label setI = iter.key(); faceList& setFaceVerts = allFaceSetsFaces[seti];
faceList& setFaceVerts = allFaceSetsFaces[setI];
forAll(setFaceVerts, i) forAll(setFaceVerts, i)
{ {
@ -183,8 +181,8 @@ label mergePatchFaces
if (newVertI < 0) if (newVertI < 0)
{ {
FatalErrorInFunction FatalErrorInFunction
<< "In set:" << setI << " old face labels:" << "In set:" << seti << " old face labels:"
<< allFaceSets[setI] << " new face vertices:" << allFaceSets[seti] << " new face vertices:"
<< setFaceVerts[i] << " are unmapped vertices!" << setFaceVerts[i] << " are unmapped vertices!"
<< abort(FatalError); << abort(FatalError);
} }
@ -198,12 +196,10 @@ label mergePatchFaces
// Restore faces // Restore faces
forAllConstIter(labelHashSet, errorSets, iter) for (const label seti : errorSets)
{ {
label setI = iter.key(); const labelList& setFaces = allFaceSets[seti];
const faceList& setFaceVerts = allFaceSetsFaces[seti];
const labelList& setFaces = allFaceSets[setI];
const faceList& setFaceVerts = allFaceSetsFaces[setI];
label newMasterI = map().reverseFaceMap()[setFaces[0]]; label newMasterI = map().reverseFaceMap()[setFaces[0]];
@ -241,7 +237,7 @@ label mergePatchFaces
// Add the previously removed faces // Add the previously removed faces
for (label i = 1; i < setFaces.size(); i++) for (label i = 1; i < setFaces.size(); ++i)
{ {
Pout<< "Restoring removed face " << setFaces[i] Pout<< "Restoring removed face " << setFaces[i]
<< " with vertices " << setFaceVerts[i] << endl; << " with vertices " << setFaceVerts[i] << endl;

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -300,9 +300,8 @@ void addCutNeighbours
labelHashSet addCutFaces(cutCells.size()); labelHashSet addCutFaces(cutCells.size());
forAllConstIter(labelHashSet, cutCells, iter) for (const label celli : cutCells)
{ {
const label celli = iter.key();
const labelList& cFaces = mesh.cells()[celli]; const labelList& cFaces = mesh.cells()[celli];
forAll(cFaces, i) forAll(cFaces, i)
@ -333,9 +332,9 @@ void addCutNeighbours
Info<< " Selected an additional " << addCutFaces.size() Info<< " Selected an additional " << addCutFaces.size()
<< " neighbours of cutCells to refine" << endl; << " neighbours of cutCells to refine" << endl;
forAllConstIter(labelHashSet, addCutFaces, iter) for (const label facei : addCutFaces)
{ {
cutCells.insert(iter.key()); cutCells.insert(facei);
} }
} }
@ -383,10 +382,9 @@ bool limitRefinementLevel
labelHashSet addCutCells(cutCells.size()); labelHashSet addCutCells(cutCells.size());
forAllConstIter(labelHashSet, cutCells, iter) for (const label celli : cutCells)
{ {
// cellI will be refined. // celli will be refined.
const label celli = iter.key();
const labelList& cCells = mesh.cellCells()[celli]; const labelList& cCells = mesh.cellCells()[celli];
forAll(cCells, i) forAll(cCells, i)
@ -411,9 +409,9 @@ bool limitRefinementLevel
<< " to satisfy 1:" << limitDiff << " refinement level" << " to satisfy 1:" << limitDiff << " refinement level"
<< endl; << endl;
forAllConstIter(labelHashSet, addCutCells, iter) for (const label celli : addCutCells)
{ {
cutCells.insert(iter.key()); cutCells.insert(celli);
} }
return true; return true;
} }

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -360,9 +360,9 @@ void writePointCells
label vertI = 0; label vertI = 0;
forAllConstIter(labelHashSet, allEdges, iter) for (const label edgei : allEdges)
{ {
const edge& e = mesh.edges()[iter.key()]; const edge& e = mesh.edges()[edgei];
meshTools::writeOBJ(pointStream, mesh.points()[e[0]]); vertI++; meshTools::writeOBJ(pointStream, mesh.points()[e[0]]); vertI++;
meshTools::writeOBJ(pointStream, mesh.points()[e[1]]); vertI++; meshTools::writeOBJ(pointStream, mesh.points()[e[1]]); vertI++;

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -886,10 +886,10 @@ void Foam::conformalVoronoiMesh::checkCellSizing()
labelHashSet cellsToResizeMap(pMesh.nFaces()/100); labelHashSet cellsToResizeMap(pMesh.nFaces()/100);
// Find cells that are attached to the faces in wrongFaces. // Find cells that are attached to the faces in wrongFaces.
forAllConstIter(labelHashSet, wrongFaces, iter) for (const label facei : wrongFaces)
{ {
const label faceOwner = pMesh.faceOwner()[iter.key()]; const label faceOwner = pMesh.faceOwner()[facei];
const label faceNeighbour = pMesh.faceNeighbour()[iter.key()]; const label faceNeighbour = pMesh.faceNeighbour()[facei];
if (!cellsToResizeMap.found(faceOwner)) if (!cellsToResizeMap.found(faceOwner))
{ {
@ -1105,9 +1105,9 @@ Foam::labelHashSet Foam::conformalVoronoiMesh::checkPolyMeshQuality
bitSet ptToBeLimited(pts.size(), false); bitSet ptToBeLimited(pts.size(), false);
forAllConstIter(labelHashSet, wrongFaces, iter) for (const label facei : wrongFaces)
{ {
const face f = pMesh.faces()[iter.key()]; const face f = pMesh.faces()[facei];
ptToBeLimited.setMany(f); ptToBeLimited.setMany(f);
} }
@ -1118,9 +1118,9 @@ Foam::labelHashSet Foam::conformalVoronoiMesh::checkPolyMeshQuality
// const labelListList& ptCells = pMesh.pointCells(); // const labelListList& ptCells = pMesh.pointCells();
// forAllConstIter(labelHashSet, wrongFaces, iter) // for (const label facei : wrongFaces)
// { // {
// const face f = pMesh.faces()[iter.key()]; // const face f = pMesh.faces()[facei];
// forAll(f, fPtI) // forAll(f, fPtI)
// { // {
@ -1132,10 +1132,8 @@ Foam::labelHashSet Foam::conformalVoronoiMesh::checkPolyMeshQuality
// const labelListList& cellPts = pMesh.cellPoints(); // const labelListList& cellPts = pMesh.cellPoints();
// forAllConstIter(labelHashSet, limitCells, iter) // for (const label celli : limitCells)
// { // {
// label celli = iter.key();
// const labelList& cP = cellPts[celli]; // const labelList& cP = cellPts[celli];
// ptToBeLimited.setMany(cP); // ptToBeLimited.setMany(cP);

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2015-2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -394,9 +394,9 @@ void extractSurface
// processor patches) // processor patches)
HashTable<label> patchSize(1024); HashTable<label> patchSize(1024);
label nFaces = 0; label nFaces = 0;
forAllConstIter(labelHashSet, includePatches, iter) for (const label patchi : includePatches)
{ {
const polyPatch& pp = bMesh[iter.key()]; const polyPatch& pp = bMesh[patchi];
patchSize.insert(pp.name(), pp.size()); patchSize.insert(pp.name(), pp.size());
nFaces += pp.size(); nFaces += pp.size();
} }
@ -427,9 +427,9 @@ void extractSurface
// Collect faces on zones // Collect faces on zones
DynamicList<label> faceLabels(nFaces); DynamicList<label> faceLabels(nFaces);
DynamicList<label> compactZones(nFaces); DynamicList<label> compactZones(nFaces);
forAllConstIter(labelHashSet, includePatches, iter) for (const label patchi : includePatches)
{ {
const polyPatch& pp = bMesh[iter.key()]; const polyPatch& pp = bMesh[patchi];
forAll(pp, i) forAll(pp, i)
{ {
faceLabels.append(pp.start()+i); faceLabels.append(pp.start()+i);

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -837,9 +837,9 @@ int main(int argc, char *argv[])
fvMeshMapper mapper(mesh, map()); fvMeshMapper mapper(mesh, map());
bool hasWarned = false; bool hasWarned = false;
forAllConstIter(wordHashSet, bafflePatches, iter) for (const word& patchName : bafflePatches)
{ {
label patchi = mesh.boundaryMesh().findPatchID(iter.key()); label patchi = mesh.boundaryMesh().findPatchID(patchName);
const fvPatchMapper& pm = mapper.boundaryMap()[patchi]; const fvPatchMapper& pm = mapper.boundaryMap()[patchi];

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -699,9 +699,9 @@ int main(int argc, char *argv[])
); );
// Repatch faces of the patches. // Repatch faces of the patches.
forAllConstIter(labelHashSet, patchSources, iter) for (const label patchi : patchSources)
{ {
const polyPatch& pp = patches[iter.key()]; const polyPatch& pp = patches[patchi];
Info<< "Moving faces from patch " << pp.name() Info<< "Moving faces from patch " << pp.name()
<< " to patch " << destPatchi << endl; << " to patch " << destPatchi << endl;

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / 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 License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -1131,9 +1131,8 @@ int main(int argc, char *argv[])
// Detect any flips. // Detect any flips.
const labelHashSet& fff = map().flipFaceFlux(); const labelHashSet& fff = map().flipFaceFlux();
forAllConstIter(labelHashSet, fff, iter) for (const label facei : fff)
{ {
label facei = iter.key();
label masterFacei = faceProcAddressing[facei]; label masterFacei = faceProcAddressing[facei];
faceProcAddressing[facei] = -masterFacei; faceProcAddressing[facei] = -masterFacei;

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -296,9 +296,8 @@ void Foam::regionSide::walkAllPointConnectedFaces
// //
labelHashSet regionEdges(4*regionFaces.size()); labelHashSet regionEdges(4*regionFaces.size());
forAllConstIter(labelHashSet, regionFaces, iter) for (const label facei : regionFaces)
{ {
const label facei = iter.key();
const labelList& fEdges = mesh.faceEdges()[facei]; const labelList& fEdges = mesh.faceEdges()[facei];
regionEdges.insertMany(fEdges); regionEdges.insertMany(fEdges);
@ -313,9 +312,9 @@ void Foam::regionSide::walkAllPointConnectedFaces
labelHashSet visitedPoint(4*regionFaces.size()); labelHashSet visitedPoint(4*regionFaces.size());
// Insert fence points so we don't visit them // Insert fence points so we don't visit them
forAllConstIter(labelHashSet, fencePoints, iter) for (const label pointi : fencePoints)
{ {
visitedPoint.insert(iter.key()); visitedPoint.insert(pointi);
} }
labelHashSet visitedEdges(2*fencePoints.size()); labelHashSet visitedEdges(2*fencePoints.size());
@ -326,10 +325,8 @@ void Foam::regionSide::walkAllPointConnectedFaces
Info<< "Excluding visit of points:" << visitedPoint << endl; Info<< "Excluding visit of points:" << visitedPoint << endl;
} }
forAllConstIter(labelHashSet, regionFaces, iter) for (const label facei : regionFaces)
{ {
const label facei = iter.key();
// Get side of face. // Get side of face.
label celli; label celli;
@ -436,9 +433,9 @@ Foam::regionSide::regionSide
labelHashSet fencePoints(fenceEdges.size()); labelHashSet fencePoints(fenceEdges.size());
forAllConstIter(labelHashSet, fenceEdges, iter) for (const label edgei : fenceEdges)
{ {
const edge& e = mesh.edges()[iter.key()]; const edge& e = mesh.edges()[edgei];
fencePoints.insert(e.start()); fencePoints.insert(e.start());
fencePoints.insert(e.end()); fencePoints.insert(e.end());

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -90,9 +90,8 @@ triSurface triangulate
label newPatchI = 0; label newPatchI = 0;
label localTriFaceI = 0; label localTriFaceI = 0;
forAllConstIter(labelHashSet, includePatches, iter) for (const label patchI : includePatches)
{ {
const label patchI = iter.key();
const polyPatch& patch = bMesh[patchI]; const polyPatch& patch = bMesh[patchI];
const pointField& points = patch.points(); const pointField& points = patch.points();
@ -147,9 +146,8 @@ triSurface triangulate
newPatchI = 0; newPatchI = 0;
forAllConstIter(labelHashSet, includePatches, iter) for (const label patchI : includePatches)
{ {
const label patchI = iter.key();
const polyPatch& patch = bMesh[patchI]; const polyPatch& patch = bMesh[patchI];
surface.patches()[newPatchI].index() = patchI; surface.patches()[newPatchI].index() = patchI;

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2017-2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -210,7 +210,6 @@ int main(int argc, char *argv[])
<< "Cannot find any faceZone name matching " << "Cannot find any faceZone name matching "
<< zoneName << endl; << zoneName << endl;
} }
} }
Info<< "Additionally triangulating faceZones " Info<< "Additionally triangulating faceZones "
<< UIndirectList<word> << UIndirectList<word>
@ -234,17 +233,17 @@ int main(int argc, char *argv[])
// processor patches) // processor patches)
HashTable<label> patchSize(1024); HashTable<label> patchSize(1024);
label nFaces = 0; label nFaces = 0;
forAllConstIter(labelHashSet, includePatches, iter) for (const label patchi : includePatches)
{ {
const polyPatch& pp = bMesh[iter.key()]; const polyPatch& pp = bMesh[patchi];
patchSize.insert(pp.name(), pp.size()); patchSize.insert(pp.name(), pp.size());
nFaces += pp.size(); nFaces += pp.size();
} }
HashTable<label> zoneSize(1024); HashTable<label> zoneSize(1024);
forAllConstIter(labelHashSet, includeFaceZones, iter) for (const label zonei : includeFaceZones)
{ {
const faceZone& pp = fzm[iter.key()]; const faceZone& pp = fzm[zonei];
zoneSize.insert(pp.name(), pp.size()); zoneSize.insert(pp.name(), pp.size());
nFaces += pp.size(); nFaces += pp.size();
} }
@ -295,9 +294,9 @@ int main(int argc, char *argv[])
compactZones.setCapacity(nFaces); compactZones.setCapacity(nFaces);
// Collect faces on patches // Collect faces on patches
forAllConstIter(labelHashSet, includePatches, iter) for (const label patchi : includePatches)
{ {
const polyPatch& pp = bMesh[iter.key()]; const polyPatch& pp = bMesh[patchi];
forAll(pp, i) forAll(pp, i)
{ {
faceLabels.append(pp.start()+i); faceLabels.append(pp.start()+i);
@ -305,9 +304,9 @@ int main(int argc, char *argv[])
} }
} }
// Collect faces on faceZones // Collect faces on faceZones
forAllConstIter(labelHashSet, includeFaceZones, iter) for (const label zonei : includeFaceZones)
{ {
const faceZone& pp = fzm[iter.key()]; const faceZone& pp = fzm[zonei];
forAll(pp, i) forAll(pp, i)
{ {
faceLabels.append(pp[i]); faceLabels.append(pp[i]);

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2015-2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -70,7 +70,7 @@ Foam::wordList Foam::fieldNames
} }
} }
forAllConstIter(wordHashSet, localNamesSet, iter) if (localNamesSet.size())
{ {
FatalErrorInFunction FatalErrorInFunction
<< "Fields not synchronised across processors." << endl << "Fields not synchronised across processors." << endl

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -408,7 +408,7 @@ void Foam::readUniformFields
} }
} }
forAllConstIter(wordHashSet, localNamesSet, iter) if (localNamesSet.size())
{ {
FatalErrorInFunction FatalErrorInFunction
<< "Fields not synchronised across processors." << endl << "Fields not synchronised across processors." << endl

View File

@ -312,10 +312,9 @@ void Foam::fileOperation::addWatches
DynamicList<label> newWatchIndices; DynamicList<label> newWatchIndices;
labelHashSet removedWatches(watchIndices); labelHashSet removedWatches(watchIndices);
forAll(files, i) for (const fileName& f : files)
{ {
const fileName& f = files[i]; const label index = findWatch(watchIndices, f);
label index = findWatch(watchIndices, f);
if (index == -1) if (index == -1)
{ {
@ -330,9 +329,9 @@ void Foam::fileOperation::addWatches
} }
// Remove any unused watches // Remove any unused watches
forAllConstIter(labelHashSet, removedWatches, iter) for (const label index : removedWatches)
{ {
removeWatch(watchIndices[iter.key()]); removeWatch(watchIndices[index]);
} }
rio.watchIndices() = newWatchIndices; rio.watchIndices() = newWatchIndices;

View File

@ -1732,10 +1732,9 @@ void Foam::fileOperations::masterUncollatedFileOperation::addWatches
DynamicList<label> newWatchIndices; DynamicList<label> newWatchIndices;
labelHashSet removedWatches(watchIndices); labelHashSet removedWatches(watchIndices);
forAll(files, i) for (const fileName& f : files)
{ {
const fileName& f = files[i]; const label index = findWatch(watchIndices, f);
label index = findWatch(watchIndices, f);
if (index == -1) if (index == -1)
{ {
@ -1750,9 +1749,9 @@ void Foam::fileOperations::masterUncollatedFileOperation::addWatches
} }
// Remove any unused watches // Remove any unused watches
forAllConstIter(labelHashSet, removedWatches, iter) for (const label index : removedWatches)
{ {
removeWatch(watchIndices[iter.key()]); removeWatch(watchIndices[index]);
} }
rio.watchIndices() = newWatchIndices; rio.watchIndices() = newWatchIndices;

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -66,31 +66,29 @@ const Foam::labelList& Foam::primitiveMesh::cellPoints
{ {
return cellPoints()[celli]; return cellPoints()[celli];
} }
else
const faceList& fcs = faces();
const labelList& cFaces = cells()[celli];
set.clear();
for (const label facei : cFaces)
{ {
const faceList& fcs = faces(); set.insertMany(fcs[facei]);
const labelList& cFaces = cells()[celli];
set.clear();
for (const label facei : cFaces)
{
set.insertMany(fcs[facei]);
}
storage.clear();
if (set.size() > storage.capacity())
{
storage.setCapacity(set.size());
}
for (const label pointi : set)
{
storage.append(pointi);
}
return storage;
} }
storage.clear();
if (set.size() > storage.capacity())
{
storage.setCapacity(set.size());
}
for (const label pointi : set)
{
storage.append(pointi);
}
return storage;
} }

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -593,31 +593,29 @@ const Foam::labelList& Foam::primitiveMesh::faceEdges
{ {
return faceEdges()[facei]; return faceEdges()[facei];
} }
else
const labelListList& pointEs = pointEdges();
const face& f = faces()[facei];
storage.clear();
if (f.size() > storage.capacity())
{ {
const labelListList& pointEs = pointEdges(); storage.setCapacity(f.size());
const face& f = faces()[facei];
storage.clear();
if (f.size() > storage.capacity())
{
storage.setCapacity(f.size());
}
forAll(f, fp)
{
storage.append
(
findFirstCommonElementFromSortedLists
(
pointEs[f[fp]],
pointEs[f.nextLabel(fp)]
)
);
}
return storage;
} }
forAll(f, fp)
{
storage.append
(
findFirstCommonElementFromSortedLists
(
pointEs[f[fp]],
pointEs[f.nextLabel(fp)]
)
);
}
return storage;
} }
@ -638,30 +636,28 @@ const Foam::labelList& Foam::primitiveMesh::cellEdges
{ {
return cellEdges()[celli]; return cellEdges()[celli];
} }
else
const labelList& cFaces = cells()[celli];
set.clear();
for (const label facei : cFaces)
{ {
const labelList& cFaces = cells()[celli]; set.insertMany(faceEdges(facei));
set.clear();
for (const label facei : cFaces)
{
set.insertMany(faceEdges(facei));
}
storage.clear();
if (set.size() > storage.capacity())
{
storage.setCapacity(set.size());
}
for (const label edgei : set)
{
storage.append(edgei);
}
return storage;
} }
storage.clear();
if (set.size() > storage.capacity())
{
storage.setCapacity(set.size());
}
for (const label edgei : set)
{
storage.append(edgei);
}
return storage;
} }

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -424,10 +424,8 @@ Foam::labelList Foam::globalIndexAndTransform::transformIndicesForPatches
return selectedTransformIs; return selectedTransformIs;
} }
forAllConstIter(labelHashSet, patchis, iter) for (const label patchi : patchis)
{ {
label patchi = iter.key();
const labelPair& transSign = patchTransformSign_[patchi]; const labelPair& transSign = patchTransformSign_[patchi];
label matchTransI = transSign.first(); label matchTransI = transSign.first();

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd. \\ / A nd | Copyright (C) 2016-2018 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -183,10 +183,8 @@ Foam::label Foam::checkFireEdges
<< "edge points" << nl << "edge points" << nl
<< "~~~~~~~~~~~" << endl; << "~~~~~~~~~~~" << endl;
for (edge thisEdge : failedEdges) // Use copy of edge
forAllConstIter(edgeHashSet, failedEdges, citer)
{ {
edge thisEdge = citer.key();
if (thisEdge.start() > thisEdge.end()) if (thisEdge.start() > thisEdge.end())
{ {
thisEdge.flip(); thisEdge.flip();
@ -262,9 +260,8 @@ Foam::label Foam::checkFireEdges
else else
{ {
// get the max point addressed // get the max point addressed
forAll(faces, faceI) for (const face& f : faces)
{ {
const face& f = faces[faceI];
forAll(f, fp) forAll(f, fp)
{ {
if (nPoints < f[fp]) if (nPoints < f[fp])

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -395,10 +395,8 @@ Foam::dynamicRefineFvMesh::refine
} }
// Update master faces // Update master faces
forAllConstIter(labelHashSet, masterFaces, iter) for (const label facei : masterFaces)
{ {
label facei = iter.key();
if (isInternalFace(facei)) if (isInternalFace(facei))
{ {
phi[facei] = phiU[facei]; phi[facei] = phiU[facei];

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2015-2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -2102,10 +2102,9 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
faceMap[faceI] += 1; faceMap[faceI] += 1;
} }
const labelHashSet& flip = subMap().flipFaceFlux(); const labelHashSet& flip = subMap().flipFaceFlux();
forAllConstIter(labelHashSet, flip, iter) for (const label facei : flip)
{ {
label faceI = iter.key(); faceMap[facei] = -faceMap[facei];
faceMap[faceI] = -faceMap[faceI];
} }
subPointMap[Pstream::myProcNo()] = subMap().pointMap(); subPointMap[Pstream::myProcNo()] = subMap().pointMap();
subPatchMap[Pstream::myProcNo()] = identity(patches.size()); subPatchMap[Pstream::myProcNo()] = identity(patches.size());
@ -2567,9 +2566,8 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
// Added processor // Added processor
inplaceRenumber(map().addedCellMap(), constructCellMap[sendProc]); inplaceRenumber(map().addedCellMap(), constructCellMap[sendProc]);
// Add flip // Add flip
forAllConstIter(labelHashSet, flippedAddedFaces, iter) for (const label domainFaceI : flippedAddedFaces)
{ {
label domainFaceI = iter.key();
label& val = constructFaceMap[sendProc][domainFaceI]; label& val = constructFaceMap[sendProc][domainFaceI];
val = -val; val = -val;
} }

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -153,9 +153,9 @@ void Foam::layerAdditionRemoval::removeCellLayer
} }
} }
forAllConstIter(labelHashSet, facesToRemoveMap, iter) for (const label facei : facesToRemoveMap)
{ {
ref.setAction(polyRemoveFace(iter.key())); ref.setAction(polyRemoveFace(facei));
} }
// Remove all points that will be collapsed // Remove all points that will be collapsed

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -30,7 +30,6 @@ License
// * * * * * * * * * * * * * * * Static Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Static Functions * * * * * * * * * * * * * //
// Update stored refine list using map // Update stored refine list using map
void Foam::edgeVertex::updateLabels void Foam::edgeVertex::updateLabels
( (
@ -131,11 +130,11 @@ void Foam::edgeVertex::updateLabels
// Iterate over map to see if anything changed // Iterate over map to see if anything changed
bool changed = false; bool changed = false;
forAllConstIter(labelHashSet, cells, iter) for (const label celli : cells)
{ {
const label newCelli = map[iter.key()]; const label newCelli = map[celli];
if (newCelli != iter.key()) if (newCelli != celli)
{ {
changed = true; changed = true;
@ -148,9 +147,9 @@ void Foam::edgeVertex::updateLabels
{ {
labelHashSet newCells(2*cells.size()); labelHashSet newCells(2*cells.size());
forAllConstIter(labelHashSet, cells, iter) for (const label celli : cells)
{ {
const label newCelli = map[iter.key()]; const label newCelli = map[celli];
if (newCelli != -1) if (newCelli != -1)
{ {

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -257,11 +257,11 @@ void Foam::motionSmootherAlgo::subtractField
pointScalarField& fld pointScalarField& fld
) const ) const
{ {
forAllConstIter(labelHashSet, pointLabels, iter) for (const label pointi : pointLabels)
{ {
if (isInternalPoint(iter.key())) if (isInternalPoint(pointi))
{ {
fld[iter.key()] = max(0.0, fld[iter.key()]-f); fld[pointi] = max(0.0, fld[pointi]-f);
} }
} }
@ -306,7 +306,7 @@ void Foam::motionSmootherAlgo::getAffectedFacesAndPoints
bitSet& isAffectedPoint bitSet& isAffectedPoint
) const ) const
{ {
isAffectedPoint.setSize(mesh_.nPoints()); isAffectedPoint.resize(mesh_.nPoints());
isAffectedPoint = false; isAffectedPoint = false;
faceSet nbrFaces(mesh_, "checkFaces", wrongFaces); faceSet nbrFaces(mesh_, "checkFaces", wrongFaces);
@ -320,9 +320,9 @@ void Foam::motionSmootherAlgo::getAffectedFacesAndPoints
{ {
pointSet nbrPoints(mesh_, "grownPoints", getPoints(nbrFaces.toc())); pointSet nbrPoints(mesh_, "grownPoints", getPoints(nbrFaces.toc()));
forAllConstIter(pointSet, nbrPoints, iter) for (const label pointi : nbrPoints)
{ {
const labelList& pCells = mesh_.pointCells(iter.key()); const labelList& pCells = mesh_.pointCells(pointi);
forAll(pCells, pCelli) forAll(pCells, pCelli)
{ {
@ -335,9 +335,9 @@ void Foam::motionSmootherAlgo::getAffectedFacesAndPoints
if (i == nPointIter - 2) if (i == nPointIter - 2)
{ {
forAllConstIter(faceSet, nbrFaces, iter) for (const label facei : nbrFaces)
{ {
const face& f = mesh_.faces()[iter.key()]; const face& f = mesh_.faces()[facei];
isAffectedPoint.setMany(f); isAffectedPoint.setMany(f);
} }
} }
@ -939,16 +939,16 @@ bool Foam::motionSmootherAlgo::scaleMesh
if (mag(errorReduction) < SMALL) if (mag(errorReduction) < SMALL)
{ {
labelHashSet newWrongFaces(wrongFaces); labelHashSet newWrongFaces(wrongFaces);
forAllConstIter(labelHashSet, wrongFaces, iter) for (const label facei : wrongFaces)
{ {
label own = mesh_.faceOwner()[iter.key()]; const label own = mesh_.faceOwner()[facei];
const cell& ownFaces = mesh_.cells()[own]; const cell& ownFaces = mesh_.cells()[own];
newWrongFaces.insertMany(ownFaces); newWrongFaces.insertMany(ownFaces);
if (iter.key() < mesh_.nInternalFaces()) if (facei < mesh_.nInternalFaces())
{ {
label nei = mesh_.faceNeighbour()[iter.key()]; const label nei = mesh_.faceNeighbour()[facei];
const cell& neiFaces = mesh_.cells()[nei]; const cell& neiFaces = mesh_.cells()[nei];
newWrongFaces.insertMany(neiFaces); newWrongFaces.insertMany(neiFaces);

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -288,9 +288,8 @@ void Foam::perfectInterface::setRefinement
// 2. Renumber (non patch0/1) faces. // 2. Renumber (non patch0/1) faces.
forAllConstIter(labelHashSet, affectedFaces, iter) for (const label facei : affectedFaces)
{ {
const label facei = iter.key();
const face& f = mesh.faces()[facei]; const face& f = mesh.faces()[facei];
face newFace(f.size()); face newFace(f.size());

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -70,9 +70,8 @@ void Foam::pointPatchDist::correct()
label nPoints = 0; label nPoints = 0;
forAllConstIter(labelHashSet, patchIDs_, iter) for (const label patchi : patchIDs_)
{ {
label patchi = iter.key();
nPoints += pbm[patchi].meshPoints().size(); nPoints += pbm[patchi].meshPoints().size();
} }
@ -83,9 +82,8 @@ void Foam::pointPatchDist::correct()
labelList wallPoints(nPoints); labelList wallPoints(nPoints);
nPoints = 0; nPoints = 0;
forAllConstIter(labelHashSet, patchIDs_, iter) for (const label patchi : patchIDs_)
{ {
label patchi = iter.key();
// Retrieve the patch now we have its index in patches. // Retrieve the patch now we have its index in patches.
const labelList& mp = pbm[patchi].meshPoints(); const labelList& mp = pbm[patchi].meshPoints();

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -309,10 +309,8 @@ Foam::labelListList Foam::combineFaces::getMergeSets
DynamicList<label> storage; DynamicList<label> storage;
// On all cells regionise the faces // On all cells regionise the faces
forAllConstIter(labelHashSet, boundaryCells, iter) for (const label celli : boundaryCells)
{ {
label celli = iter.key();
const cell& cFaces = mesh_.cells()[celli]; const cell& cFaces = mesh_.cells()[celli];
const labelList& cEdges = mesh_.cellEdges(celli, set, storage); const labelList& cEdges = mesh_.cellEdges(celli, set, storage);

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -495,9 +495,9 @@ void Foam::faceCollapser::setRefinement
// Modify faces affected (but not removed) // Modify faces affected (but not removed)
// //
forAllConstIter(labelHashSet, affectedFaces, iter) for (const label facei : affectedFaces)
{ {
filterFace(splitEdges, iter.key(), meshMod); filterFace(splitEdges, facei, meshMod);
} }
} }

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -170,9 +170,9 @@ Foam::boolList Foam::removeFaces::getFacesAffected
} }
// Mark faces affected by removal of edges // Mark faces affected by removal of edges
forAllConstIter(labelHashSet, edgesToRemove, iter) for (const label edgei : edgesToRemove)
{ {
const labelList& eFaces = mesh_.edgeFaces(iter.key()); const labelList& eFaces = mesh_.edgeFaces(edgei);
forAll(eFaces, eFacei) forAll(eFaces, eFacei)
{ {
@ -181,10 +181,8 @@ Foam::boolList Foam::removeFaces::getFacesAffected
} }
// Mark faces affected by removal of points // Mark faces affected by removal of points
forAllConstIter(labelHashSet, pointsToRemove, iter) for (const label pointi : pointsToRemove)
{ {
label pointi = iter.key();
const labelList& pFaces = mesh_.pointFaces()[pointi]; const labelList& pFaces = mesh_.pointFaces()[pointi];
forAll(pFaces, pFacei) forAll(pFaces, pFacei)
@ -1100,10 +1098,10 @@ void Foam::removeFaces::setRefinement
Pout<< "Dumping edgesToRemove to " << str.name() << endl; Pout<< "Dumping edgesToRemove to " << str.name() << endl;
label vertI = 0; label vertI = 0;
forAllConstIter(labelHashSet, edgesToRemove, iter) for (const label edgei : edgesToRemove)
{ {
// Edge will get removed. // Edge will get removed.
const edge& e = mesh_.edges()[iter.key()]; const edge& e = mesh_.edges()[edgei];
meshTools::writeOBJ(str, mesh_.points()[e[0]]); meshTools::writeOBJ(str, mesh_.points()[e[0]]);
vertI++; vertI++;
@ -1260,10 +1258,10 @@ void Foam::removeFaces::setRefinement
nEdgesPerPoint[pointi] = pointEdges[pointi].size(); nEdgesPerPoint[pointi] = pointEdges[pointi].size();
} }
forAllConstIter(labelHashSet, edgesToRemove, iter) for (const label edgei : edgesToRemove)
{ {
// Edge will get removed. // Edge will get removed.
const edge& e = mesh_.edges()[iter.key()]; const edge& e = mesh_.edges()[edgei];
forAll(e, i) forAll(e, i)
{ {
@ -1318,9 +1316,9 @@ void Foam::removeFaces::setRefinement
OFstream str(mesh_.time().path()/"pointsToRemove.obj"); OFstream str(mesh_.time().path()/"pointsToRemove.obj");
Pout<< "Dumping pointsToRemove to " << str.name() << endl; Pout<< "Dumping pointsToRemove to " << str.name() << endl;
forAllConstIter(labelHashSet, pointsToRemove, iter) for (const label pointi : pointsToRemove)
{ {
meshTools::writeOBJ(str, mesh_.points()[iter.key()]); meshTools::writeOBJ(str, mesh_.points()[pointi]);
} }
} }
@ -1374,10 +1372,8 @@ void Foam::removeFaces::setRefinement
// Remove points. // Remove points.
forAllConstIter(labelHashSet, pointsToRemove, iter) for (const label pointi : pointsToRemove)
{ {
label pointi = iter.key();
meshMod.setAction(polyRemovePoint(pointi, -1)); meshMod.setAction(polyRemovePoint(pointi, -1));
} }

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -360,10 +360,8 @@ void Foam::removePoints::setRefinement
} }
label nSaved = 0; label nSaved = 0;
forAllConstIter(labelHashSet, facesAffected, iter) for (const label facei : facesAffected)
{ {
label facei = iter.key();
const face& f = mesh_.faces()[facei]; const face& f = mesh_.faces()[facei];
face newFace(f.size()); face newFace(f.size());

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -278,9 +278,9 @@ Foam::MRFZone::MRFZone
excludedPatchLabels_.setSize(excludedPatchSet.size()); excludedPatchLabels_.setSize(excludedPatchSet.size());
label i = 0; label i = 0;
forAllConstIter(labelHashSet, excludedPatchSet, iter) for (const label patchi : excludedPatchSet)
{ {
excludedPatchLabels_[i++] = iter.key(); excludedPatchLabels_[i++] = patchi;
} }
bool cellZoneFound = (cellZoneID_ != -1); bool cellZoneFound = (cellZoneID_ != -1);

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -138,19 +138,19 @@ void Foam::cellToCellStencil::merge
) )
{ {
labelHashSet set; labelHashSet set;
forAll(cCells, i) for (const label celli : cCells)
{ {
if (cCells[i] != globalI) if (celli != globalI)
{ {
set.insert(cCells[i]); set.insert(celli);
} }
} }
forAll(pGlobals, i) for (const label celli : pGlobals)
{ {
if (pGlobals[i] != globalI) if (celli != globalI)
{ {
set.insert(pGlobals[i]); set.insert(celli);
} }
} }
@ -158,9 +158,9 @@ void Foam::cellToCellStencil::merge
label n = 0; label n = 0;
cCells[n++] = globalI; cCells[n++] = globalI;
forAllConstIter(labelHashSet, set, iter) for (const label seti : set)
{ {
cCells[n++] = iter.key(); cCells[n++] = seti;
} }
} }
@ -171,10 +171,8 @@ void Foam::cellToCellStencil::validBoundaryFaces(boolList& isValidBFace) const
isValidBFace.setSize(mesh().nFaces()-mesh().nInternalFaces(), true); isValidBFace.setSize(mesh().nFaces()-mesh().nInternalFaces(), true);
forAll(patches, patchi) for (const polyPatch& pp : patches)
{ {
const polyPatch& pp = patches[patchi];
if (pp.coupled() || isA<emptyPolyPatch>(pp)) if (pp.coupled() || isA<emptyPolyPatch>(pp))
{ {
label bFacei = pp.start()-mesh().nInternalFaces(); label bFacei = pp.start()-mesh().nInternalFaces();
@ -194,10 +192,8 @@ Foam::cellToCellStencil::allCoupledFacesPatch() const
label nCoupled = 0; label nCoupled = 0;
forAll(patches, patchi) for (const polyPatch& pp : patches)
{ {
const polyPatch& pp = patches[patchi];
if (pp.coupled()) if (pp.coupled())
{ {
nCoupled += pp.size(); nCoupled += pp.size();
@ -206,10 +202,8 @@ Foam::cellToCellStencil::allCoupledFacesPatch() const
labelList coupledFaces(nCoupled); labelList coupledFaces(nCoupled);
nCoupled = 0; nCoupled = 0;
forAll(patches, patchi) for (const polyPatch& pp : patches)
{ {
const polyPatch& pp = patches[patchi];
if (pp.coupled()) if (pp.coupled())
{ {
label facei = pp.start(); label facei = pp.start();

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -159,11 +159,11 @@ void Foam::extendedUpwindCellToFaceStencil::transportStencil
transportedStencil[n++] = globalOwn; transportedStencil[n++] = globalOwn;
transportedStencil[n++] = globalNei; transportedStencil[n++] = globalNei;
forAllConstIter(labelHashSet, faceStencilSet, iter) for (const label stencili : faceStencilSet)
{ {
if (iter.key() != globalOwn && iter.key() != globalNei) if (stencili != globalOwn && stencili != globalNei)
{ {
transportedStencil[n++] = iter.key(); transportedStencil[n++] = stencili;
} }
} }
if (n != transportedStencil.size()) if (n != transportedStencil.size())
@ -179,11 +179,11 @@ void Foam::extendedUpwindCellToFaceStencil::transportStencil
label n = 0; label n = 0;
transportedStencil[n++] = globalOwn; transportedStencil[n++] = globalOwn;
forAllConstIter(labelHashSet, faceStencilSet, iter) for (const label stencili : faceStencilSet)
{ {
if (iter.key() != globalOwn) if (stencili != globalOwn)
{ {
transportedStencil[n++] = iter.key(); transportedStencil[n++] = stencili;
} }
} }
if (n != transportedStencil.size()) if (n != transportedStencil.size())

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -41,10 +41,8 @@ void Foam::FECCellToFaceStencil::calcEdgeBoundaryData
labelHashSet edgeGlobals; labelHashSet edgeGlobals;
forAll(boundaryEdges, i) for (const label edgeI : boundaryEdges)
{ {
label edgeI = boundaryEdges[i];
neiGlobal.insert neiGlobal.insert
( (
mesh().edges()[edgeI], mesh().edges()[edgeI],
@ -204,15 +202,15 @@ void Foam::FECCellToFaceStencil::calcFaceStencil
label n = 0; label n = 0;
faceStencil[facei][n++] = globalOwn; faceStencil[facei][n++] = globalOwn;
faceStencil[facei][n++] = globalNei; faceStencil[facei][n++] = globalNei;
forAllConstIter(labelHashSet, faceStencilSet, iter) for (const label stencili : faceStencilSet)
{ {
if (iter.key() == globalOwn || iter.key() == globalNei) if (stencili == globalOwn || stencili == globalNei)
{ {
FatalErrorInFunction FatalErrorInFunction
<< "problem:" << faceStencilSet << "problem:" << faceStencilSet
<< abort(FatalError); << abort(FatalError);
} }
faceStencil[facei][n++] = iter.key(); faceStencil[facei][n++] = stencili;
} }
} }
forAll(patches, patchi) forAll(patches, patchi)
@ -265,15 +263,15 @@ void Foam::FECCellToFaceStencil::calcFaceStencil
label n = 0; label n = 0;
faceStencil[facei][n++] = globalOwn; faceStencil[facei][n++] = globalOwn;
faceStencil[facei][n++] = globalNei; faceStencil[facei][n++] = globalNei;
forAllConstIter(labelHashSet, faceStencilSet, iter) for (const label stencili : faceStencilSet)
{ {
if (iter.key() == globalOwn || iter.key() == globalNei) if (stencili == globalOwn || stencili == globalNei)
{ {
FatalErrorInFunction FatalErrorInFunction
<< "problem:" << faceStencilSet << "problem:" << faceStencilSet
<< abort(FatalError); << abort(FatalError);
} }
faceStencil[facei][n++] = iter.key(); faceStencil[facei][n++] = stencili;
} }
if (n != faceStencil[facei].size()) if (n != faceStencil[facei].size())
@ -329,15 +327,15 @@ void Foam::FECCellToFaceStencil::calcFaceStencil
faceStencil[facei].setSize(faceStencilSet.size()+1); faceStencil[facei].setSize(faceStencilSet.size()+1);
label n = 0; label n = 0;
faceStencil[facei][n++] = globalOwn; faceStencil[facei][n++] = globalOwn;
forAllConstIter(labelHashSet, faceStencilSet, iter) for (const label stencili : faceStencilSet)
{ {
if (iter.key() == globalOwn) if (stencili == globalOwn)
{ {
FatalErrorInFunction FatalErrorInFunction
<< "problem:" << faceStencilSet << "problem:" << faceStencilSet
<< abort(FatalError); << abort(FatalError);
} }
faceStencil[facei][n++] = iter.key(); faceStencil[facei][n++] = stencili;
} }
facei++; facei++;

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -66,10 +66,8 @@ void Foam::cellToFaceStencil::merge
// For all in listA see if they are present // For all in listA see if they are present
label nInsert = 0; label nInsert = 0;
forAll(listA, i) for (const label elem : listA)
{ {
label elem = listA[i];
if (elem != global0 && elem != global1) if (elem != global0 && elem != global1)
{ {
if (findSortedIndex(listB, elem) == -1) if (findSortedIndex(listB, elem) == -1)
@ -96,10 +94,8 @@ void Foam::cellToFaceStencil::merge
// Insert listB // Insert listB
forAll(listB, i) for (const label elem : listB)
{ {
label elem = listB[i];
if (elem != global0 && elem != global1) if (elem != global0 && elem != global1)
{ {
result[resultI++] = elem; result[resultI++] = elem;
@ -108,10 +104,8 @@ void Foam::cellToFaceStencil::merge
// Insert listA // Insert listA
forAll(listA, i) for (const label elem : listA)
{ {
label elem = listA[i];
if (elem != global0 && elem != global1) if (elem != global0 && elem != global1)
{ {
if (findSortedIndex(listB, elem) == -1) if (findSortedIndex(listB, elem) == -1)
@ -159,9 +153,9 @@ void Foam::cellToFaceStencil::merge
label n = 0; label n = 0;
cCells[n++] = globalI; cCells[n++] = globalI;
forAllConstIter(labelHashSet, set, iter) for (const label seti : set)
{ {
cCells[n++] = iter.key(); cCells[n++] = seti;
} }
} }
@ -399,11 +393,11 @@ void Foam::cellToFaceStencil::calcFaceStencil
label n = 0; label n = 0;
faceStencil[facei][n++] = globalOwn; faceStencil[facei][n++] = globalOwn;
faceStencil[facei][n++] = globalNei; faceStencil[facei][n++] = globalNei;
forAllConstIter(labelHashSet, faceStencilSet, iter) for (const label stencili : faceStencilSet)
{ {
if (iter.key() != globalOwn && iter.key() != globalNei) if (stencili != globalOwn && stencili != globalNei)
{ {
faceStencil[facei][n++] = iter.key(); faceStencil[facei][n++] = stencili;
} }
} }
//Pout<< "internalface:" << facei << " toc:" << faceStencilSet.toc() //Pout<< "internalface:" << facei << " toc:" << faceStencilSet.toc()
@ -435,11 +429,11 @@ void Foam::cellToFaceStencil::calcFaceStencil
label n = 0; label n = 0;
faceStencil[facei][n++] = globalOwn; faceStencil[facei][n++] = globalOwn;
faceStencil[facei][n++] = globalNei; faceStencil[facei][n++] = globalNei;
forAllConstIter(labelHashSet, faceStencilSet, iter) for (const label stencili : faceStencilSet)
{ {
if (iter.key() != globalOwn && iter.key() != globalNei) if (stencili != globalOwn && stencili != globalNei)
{ {
faceStencil[facei][n++] = iter.key(); faceStencil[facei][n++] = stencili;
} }
} }
@ -464,11 +458,11 @@ void Foam::cellToFaceStencil::calcFaceStencil
faceStencil[facei].setSize(faceStencilSet.size()); faceStencil[facei].setSize(faceStencilSet.size());
label n = 0; label n = 0;
faceStencil[facei][n++] = globalOwn; faceStencil[facei][n++] = globalOwn;
forAllConstIter(labelHashSet, faceStencilSet, iter) for (const label stencili : faceStencilSet)
{ {
if (iter.key() != globalOwn) if (stencili != globalOwn)
{ {
faceStencil[facei][n++] = iter.key(); faceStencil[facei][n++] = stencili;
} }
} }

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2015-2017 OpenFOAM Foundation \\ / A nd | Copyright (C) 2015-2017 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -112,9 +112,8 @@ bool Foam::patchDistMethods::advectionDiffusion::correct
const fvPatchList& patches = mesh_.boundary(); const fvPatchList& patches = mesh_.boundary();
volVectorField::Boundary& nybf = ny.boundaryFieldRef(); volVectorField::Boundary& nybf = ny.boundaryFieldRef();
forAllConstIter(labelHashSet, patchIDs_, iter) for (const label patchi : patchIDs_)
{ {
label patchi = iter.key();
nybf[patchi] == -patches[patchi].nf(); nybf[patchi] == -patches[patchi].nf();
} }

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -40,9 +40,9 @@ Foam::wordList Foam::patchDistMethod::patchTypes
zeroGradientFvPatchField<Type>::typeName zeroGradientFvPatchField<Type>::typeName
); );
forAllConstIter(labelHashSet, patchIDs, iter) for (const label patchi : patchIDs)
{ {
yTypes[iter.key()] = fixedValueFvPatchField<Type>::typeName; yTypes[patchi] = fixedValueFvPatchField<Type>::typeName;
} }
return yTypes; return yTypes;

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2015-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2015-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -58,9 +58,8 @@ void Foam::wallDist::constructn() const
volVectorField::Boundary& nbf = n_.ref().boundaryFieldRef(); volVectorField::Boundary& nbf = n_.ref().boundaryFieldRef();
forAllConstIter(labelHashSet, patchIDs_, iter) for (const label patchi : patchIDs_)
{ {
label patchi = iter.key();
nbf[patchi] == patches[patchi].nf(); nbf[patchi] == patches[patchi].nf();
} }
} }

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2015-2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -48,9 +48,8 @@ void Foam::functionObjects::nearWallFields::calcAddressing()
{ {
// Count number of faces // Count number of faces
label nPatchFaces = 0; label nPatchFaces = 0;
forAllConstIter(labelHashSet, patchSet_, iter) for (const label patchi : patchSet_)
{ {
label patchi = iter.key();
nPatchFaces += mesh_.boundary()[patchi].size(); nPatchFaces += mesh_.boundary()[patchi].size();
} }
@ -70,9 +69,8 @@ void Foam::functionObjects::nearWallFields::calcAddressing()
// Add particles to track to sample locations // Add particles to track to sample locations
nPatchFaces = 0; nPatchFaces = 0;
forAllConstIter(labelHashSet, patchSet_, iter) for (const label patchi : patchSet_)
{ {
label patchi = iter.key();
const fvPatch& patch = mesh_.boundary()[patchi]; const fvPatch& patch = mesh_.boundary()[patchi];
vectorField nf(patch.nf()); vectorField nf(patch.nf());

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2015-2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -105,10 +105,8 @@ void Foam::functionObjects::nearWallFields::sampleBoundaryField
// Pick up data // Pick up data
label nPatchFaces = 0; label nPatchFaces = 0;
forAllConstIter(labelHashSet, patchSet_, iter) for (const label patchi : patchSet_)
{ {
label patchi = iter.key();
fvPatchField<Type>& pfld = fldBf[patchi]; fvPatchField<Type>& pfld = fldBf[patchi];
Field<Type> newFld(pfld.size()); Field<Type> newFld(pfld.size());

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -169,25 +169,25 @@ Foam::functionObjects::regionSizeDistribution::findPatchRegions
const labelHashSet patchIDs(mesh_.boundaryMesh().patchSet(patchNames_)); const labelHashSet patchIDs(mesh_.boundaryMesh().patchSet(patchNames_));
label nPatchFaces = 0; label nPatchFaces = 0;
forAllConstIter(labelHashSet, patchIDs, iter) for (const label patchi : patchIDs)
{ {
nPatchFaces += mesh_.boundaryMesh()[iter.key()].size(); nPatchFaces += mesh_.boundaryMesh()[patchi].size();
} }
Map<label> patchRegions(nPatchFaces); Map<label> patchRegions(nPatchFaces);
forAllConstIter(labelHashSet, patchIDs, iter) for (const label patchi : patchIDs)
{ {
const polyPatch& pp = mesh_.boundaryMesh()[iter.key()]; const polyPatch& pp = mesh_.boundaryMesh()[patchi];
// Collect all regions on the patch // Collect all regions on the patch
const labelList& faceCells = pp.faceCells(); const labelList& faceCells = pp.faceCells();
forAll(faceCells, i) for (const label celli : faceCells)
{ {
patchRegions.insert patchRegions.insert
( (
regions[faceCells[i]], regions[celli],
Pstream::myProcNo() // dummy value Pstream::myProcNo() // dummy value
); );
} }
@ -581,10 +581,9 @@ bool Foam::functionObjects::regionSizeDistribution::write()
<< token::TAB << "Volume(mesh)" << token::TAB << "Volume(mesh)"
<< token::TAB << "Volume(" << alpha.name() << "):" << token::TAB << "Volume(" << alpha.name() << "):"
<< endl; << endl;
forAllConstIter(Map<label>, patchRegions, iter) for (const label regioni : patchRegions)
{ {
label regioni = iter.key(); Info<< " " << token::TAB << regioni
Info<< " " << token::TAB << iter.key()
<< token::TAB << allRegionVolume[regioni] << token::TAB << allRegionVolume[regioni]
<< token::TAB << allRegionAlphaVolume[regioni] << endl; << token::TAB << allRegionAlphaVolume[regioni] << endl;

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2015-2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -36,9 +36,9 @@ void Foam::functionObjects::surfaceInterpolate::interpolateFields()
// Convert field to map // Convert field to map
HashTable<word> fieldMap(2*fieldSet_.size()); HashTable<word> fieldMap(2*fieldSet_.size());
forAll(fieldSet_, i) for (const auto& namePair : fieldSet_)
{ {
fieldMap.insert(fieldSet_[i].first(), fieldSet_[i].second()); fieldMap.insert(namePair.first(), namePair.second());
} }

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2016-2017 OpenFOAM Foundation \\ / A nd | Copyright (C) 2016-2017 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -171,9 +171,8 @@ bool Foam::functionObjects::wallHeatFlux::read(const dictionary& dict)
{ {
Info<< " processing wall patches: " << nl; Info<< " processing wall patches: " << nl;
labelHashSet filteredPatchSet; labelHashSet filteredPatchSet;
forAllConstIter(labelHashSet, patchSet_, iter) for (const label patchi : patchSet_)
{ {
label patchi = iter.key();
if (isA<wallPolyPatch>(pbm[patchi])) if (isA<wallPolyPatch>(pbm[patchi]))
{ {
filteredPatchSet.insert(patchi); filteredPatchSet.insert(patchi);
@ -265,9 +264,8 @@ bool Foam::functionObjects::wallHeatFlux::write()
const surfaceScalarField::Boundary& magSf = const surfaceScalarField::Boundary& magSf =
mesh_.magSf().boundaryField(); mesh_.magSf().boundaryField();
forAllConstIter(labelHashSet, patchSet_, iter) for (const label patchi : patchSet_)
{ {
label patchi = iter.key();
const fvPatch& pp = patches[patchi]; const fvPatch& pp = patches[patchi];
const scalarField& hfp = wallHeatFlux.boundaryField()[patchi]; const scalarField& hfp = wallHeatFlux.boundaryField()[patchi];

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2017-2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -65,10 +65,8 @@ void Foam::functionObjects::wallShearStress::calcShearStress
{ {
shearStress.dimensions().reset(Reff.dimensions()); shearStress.dimensions().reset(Reff.dimensions());
forAllConstIter(labelHashSet, patchSet_, iter) for (const label patchi : patchSet_)
{ {
label patchi = iter.key();
vectorField& ssp = shearStress.boundaryFieldRef()[patchi]; vectorField& ssp = shearStress.boundaryFieldRef()[patchi];
const vectorField& Sfp = mesh_.Sf().boundaryField()[patchi]; const vectorField& Sfp = mesh_.Sf().boundaryField()[patchi];
const scalarField& magSfp = mesh_.magSf().boundaryField()[patchi]; const scalarField& magSfp = mesh_.magSf().boundaryField()[patchi];
@ -156,9 +154,8 @@ bool Foam::functionObjects::wallShearStress::read(const dictionary& dict)
{ {
Info<< " processing wall patches: " << nl; Info<< " processing wall patches: " << nl;
labelHashSet filteredPatchSet; labelHashSet filteredPatchSet;
forAllConstIter(labelHashSet, patchSet_, iter) for (const label patchi : patchSet_)
{ {
label patchi = iter.key();
if (isA<wallPolyPatch>(pbm[patchi])) if (isA<wallPolyPatch>(pbm[patchi]))
{ {
filteredPatchSet.insert(patchi); filteredPatchSet.insert(patchi);
@ -223,9 +220,8 @@ bool Foam::functionObjects::wallShearStress::write()
const fvPatchList& patches = mesh_.boundary(); const fvPatchList& patches = mesh_.boundary();
forAllConstIter(labelHashSet, patchSet_, iter) for (const label patchi : patchSet_)
{ {
label patchi = iter.key();
const fvPatch& pp = patches[patchi]; const fvPatch& pp = patches[patchi];
const vectorField& ssp = wallShearStress.boundaryField()[patchi]; const vectorField& ssp = wallShearStress.boundaryField()[patchi];

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2015-2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -222,9 +222,8 @@ void Foam::functionObjects::forces::initialiseBins()
// Determine extents of patches // Determine extents of patches
binMin_ = GREAT; binMin_ = GREAT;
scalar binMax = -GREAT; scalar binMax = -GREAT;
forAllConstIter(labelHashSet, patchSet_, iter) for (const label patchi : patchSet_)
{ {
label patchi = iter.key();
const polyPatch& pp = pbm[patchi]; const polyPatch& pp = pbm[patchi];
scalarField d(pp.faceCentres() & binDir_); scalarField d(pp.faceCentres() & binDir_);
binMin_ = min(min(d), binMin_); binMin_ = min(min(d), binMin_);
@ -244,9 +243,8 @@ void Foam::functionObjects::forces::initialiseBins()
const porosityModel& pm = *iter(); const porosityModel& pm = *iter();
const labelList& cellZoneIDs = pm.cellZoneIDs(); const labelList& cellZoneIDs = pm.cellZoneIDs();
forAll(cellZoneIDs, i) for (const label zonei : cellZoneIDs)
{ {
label zonei = cellZoneIDs[i];
const cellZone& cZone = mesh_.cellZones()[zonei]; const cellZone& cZone = mesh_.cellZones()[zonei];
const scalarField d(dd, cZone); const scalarField d(dd, cZone);
binMin_ = min(min(d), binMin_); binMin_ = min(min(d), binMin_);
@ -982,10 +980,8 @@ void Foam::functionObjects::forces::calcForcesMoment()
const surfaceVectorField::Boundary& Sfb = mesh_.Sf().boundaryField(); const surfaceVectorField::Boundary& Sfb = mesh_.Sf().boundaryField();
forAllConstIter(labelHashSet, patchSet_, iter) for (const label patchi : patchSet_)
{ {
label patchi = iter.key();
vectorField Md vectorField Md
( (
mesh_.C().boundaryField()[patchi] - coordSys_.origin() mesh_.C().boundaryField()[patchi] - coordSys_.origin()
@ -1026,10 +1022,8 @@ void Foam::functionObjects::forces::calcForcesMoment()
// Scale pRef by density for incompressible simulations // Scale pRef by density for incompressible simulations
scalar pRef = pRef_/rho(p); scalar pRef = pRef_/rho(p);
forAllConstIter(labelHashSet, patchSet_, iter) for (const label patchi : patchSet_)
{ {
label patchi = iter.key();
vectorField Md vectorField Md
( (
mesh_.C().boundaryField()[patchi] - coordSys_.origin() mesh_.C().boundaryField()[patchi] - coordSys_.origin()
@ -1076,9 +1070,8 @@ void Foam::functionObjects::forces::calcForcesMoment()
const labelList& cellZoneIDs = pm.cellZoneIDs(); const labelList& cellZoneIDs = pm.cellZoneIDs();
forAll(cellZoneIDs, i) for (const label zonei : cellZoneIDs)
{ {
label zonei = cellZoneIDs[i];
const cellZone& cZone = mesh_.cellZones()[zonei]; const cellZone& cZone = mesh_.cellZones()[zonei];
const vectorField d(mesh_.C(), cZone); const vectorField d(mesh_.C(), cZone);

View File

@ -244,9 +244,9 @@ bool Foam::functionObjects::ensightWrite::write()
} }
} }
forAllConstIter(wordHashSet, candidates, iter) for (const word& cand : candidates)
{ {
process(iter.key()); process(cand);
} }
Log << " )" << endl; Log << " )" << endl;

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -267,9 +267,8 @@ Foam::MGridGenGAMGAgglomeration::MGridGenGAMGAgglomeration
// Should not be. fluke? // Should not be. fluke?
//scalarField weights(*faceWeightsPtr); //scalarField weights(*faceWeightsPtr);
scalarField weights = *magSfPtr; scalarField weights = *magSfPtr;
forAllConstIter(labelHashSet, sharedFaces, iter) for (const label facei : sharedFaces)
{ {
label facei= iter.key();
weights[facei] *= 2.0; weights[facei] *= 2.0;
} }

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -75,14 +75,14 @@ void Foam::inverseFaceDistanceDiffusivity::correct()
label nPatchFaces = 0; label nPatchFaces = 0;
forAll(patchNames_, i) for (const word& patchName : patchNames_)
{ {
const label pID = bdry.findPatchID(patchNames_[i]); const label patchi = bdry.findPatchID(patchName);
if (pID > -1) if (patchi >= 0)
{ {
patchSet.insert(pID); patchSet.insert(patchi);
nPatchFaces += bdry[pID].size(); nPatchFaces += bdry[patchi].size();
} }
} }
@ -91,9 +91,9 @@ void Foam::inverseFaceDistanceDiffusivity::correct()
nPatchFaces = 0; nPatchFaces = 0;
forAllConstIter(labelHashSet, patchSet, iter) for (const label patchi : patchSet)
{ {
const polyPatch& patch = bdry[iter.key()]; const polyPatch& patch = bdry[patchi];
const vectorField::subField fc(patch.faceCentres()); const vectorField::subField fc(patch.faceCentres());

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -69,9 +69,9 @@ void Foam::inversePointDistanceDiffusivity::correct()
label nPatchEdges = 0; label nPatchEdges = 0;
forAllConstIter(labelHashSet, patchSet, iter) for (const label patchi : patchSet)
{ {
nPatchEdges += bdry[iter.key()].nEdges(); nPatchEdges += bdry[patchi].nEdges();
} }
// Distance to wall on points and edges. // Distance to wall on points and edges.
@ -88,16 +88,14 @@ void Foam::inversePointDistanceDiffusivity::correct()
nPatchEdges = 0; nPatchEdges = 0;
forAllConstIter(labelHashSet, patchSet, iter) for (const label patchi : patchSet)
{ {
const polyPatch& patch = bdry[iter.key()]; const polyPatch& patch = bdry[patchi];
const labelList& meshPoints = patch.meshPoints(); const labelList& meshPoints = patch.meshPoints();
forAll(meshPoints, i) for (const label pointi : meshPoints)
{ {
label pointi = meshPoints[i];
if (!pointWallDist[pointi].valid(dummyTrackData)) if (!pointWallDist[pointi].valid(dummyTrackData))
{ {
// Not yet seeded // Not yet seeded
@ -131,7 +129,7 @@ void Foam::inversePointDistanceDiffusivity::correct()
} }
for (label facei=0; facei<mesh().nInternalFaces(); facei++) for (label facei=0; facei<mesh().nInternalFaces(); ++facei)
{ {
const face& f = mesh().faces()[facei]; const face& f = mesh().faces()[facei];

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2015-2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -234,12 +234,12 @@ void Foam::meshRefinement::calcCellCellRays
forAll(testFaces, i) forAll(testFaces, i)
{ {
label facei = testFaces[i]; const label facei = testFaces[i];
label own = mesh_.faceOwner()[facei]; const label own = mesh_.faceOwner()[facei];
if (mesh_.isInternalFace(facei)) if (mesh_.isInternalFace(facei))
{ {
label nei = mesh_.faceNeighbour()[facei]; const label nei = mesh_.faceNeighbour()[facei];
start[i] = cellCentres[own]; start[i] = cellCentres[own];
end[i] = cellCentres[nei]; end[i] = cellCentres[nei];
@ -247,7 +247,7 @@ void Foam::meshRefinement::calcCellCellRays
} }
else else
{ {
label bFacei = facei - mesh_.nInternalFaces(); const label bFacei = facei - mesh_.nInternalFaces();
start[i] = cellCentres[own]; start[i] = cellCentres[own];
end[i] = neiCc[bFacei]; end[i] = neiCc[bFacei];
@ -2541,13 +2541,13 @@ void Foam::meshRefinement::updateMesh
// Update faceToCoupledPatch_ // Update faceToCoupledPatch_
{ {
Map<label> newFaceToPatch(faceToCoupledPatch_.size()); Map<label> newFaceToPatch(faceToCoupledPatch_.size());
forAllConstIter(Map<label>, faceToCoupledPatch_, iter) forAllConstIters(faceToCoupledPatch_, iter)
{ {
label newFacei = map.reverseFaceMap()[iter.key()]; const label newFacei = map.reverseFaceMap()[iter.key()];
if (newFacei >= 0) if (newFacei >= 0)
{ {
newFaceToPatch.insert(newFacei, iter()); newFaceToPatch.insert(newFacei, iter.object());
} }
} }
faceToCoupledPatch_.transfer(newFaceToPatch); faceToCoupledPatch_.transfer(newFaceToPatch);

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -51,11 +51,9 @@ Foam::label Foam::meshRefinement::mergePatchFaces
// Pick up all candidate cells on boundary // Pick up all candidate cells on boundary
labelHashSet boundaryCells(mesh_.nFaces()-mesh_.nInternalFaces()); labelHashSet boundaryCells(mesh_.nFaces()-mesh_.nInternalFaces());
forAll(patchIDs, i) for (const label patchi : patchIDs)
{ {
label patchI = patchIDs[i]; const polyPatch& patch = patches[patchi];
const polyPatch& patch = patches[patchI];
if (!patch.coupled()) if (!patch.coupled())
{ {
@ -221,17 +219,17 @@ Foam::label Foam::meshRefinement::mergePatchFaces
// //
// const cellList& cells = mesh_.cells(); // const cellList& cells = mesh_.cells();
// //
// forAllConstIter(labelHashSet, retestOldFaces, iter) // for (const label oldFacei : retestOldFaces)
// { // {
// label faceI = map().reverseFaceMap()[iter.key()]; // const label facei = map().reverseFaceMap()[oldFacei];
// //
// const cell& ownFaces = cells[mesh_.faceOwner()[faceI]]; // const cell& ownFaces = cells[mesh_.faceOwner()[facei]];
// //
// retestFaces.insertMany(ownFaces); // retestFaces.insertMany(ownFaces);
// //
// if (mesh_.isInternalFace(faceI)) // if (mesh_.isInternalFace(facei))
// { // {
// const cell& neiFaces = cells[mesh_.faceNeighbour()[faceI]]; // const cell& neiFaces = cells[mesh_.faceNeighbour()[facei]];
// //
// retestFaces.insertMany(neiFaces); // retestFaces.insertMany(neiFaces);
// } // }
@ -579,7 +577,7 @@ Foam::label Foam::meshRefinement::mergePatchFacesUndo
// (unless the faces are absolutely planar) // (unless the faces are absolutely planar)
labelHashSet retestFaces(2*restoredFaces.size()); labelHashSet retestFaces(2*restoredFaces.size());
forAllConstIter(Map<label>, restoredFaces, iter) forAllConstIters(restoredFaces, iter)
{ {
retestFaces.insert(iter.key()); retestFaces.insert(iter.key());
} }
@ -656,12 +654,11 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::doRemovePoints
// Retest all affected faces and all the cells using them // Retest all affected faces and all the cells using them
labelHashSet retestFaces(pointRemover.savedFaceLabels().size()); labelHashSet retestFaces(pointRemover.savedFaceLabels().size());
forAll(pointRemover.savedFaceLabels(), i) for (const label facei : pointRemover.savedFaceLabels())
{ {
label faceI = pointRemover.savedFaceLabels()[i]; if (facei >= 0)
if (faceI >= 0)
{ {
retestFaces.insert(faceI); retestFaces.insert(facei);
} }
} }
updateMesh(map, growFaceCellFace(retestFaces)); updateMesh(map, growFaceCellFace(retestFaces));
@ -761,13 +758,11 @@ Foam::labelList Foam::meshRefinement::collectFaces
// Has face been selected? // Has face been selected?
boolList selected(mesh_.nFaces(), false); boolList selected(mesh_.nFaces(), false);
forAll(candidateFaces, i) for (const label facei : candidateFaces)
{ {
label faceI = candidateFaces[i]; if (set.found(facei))
if (set.found(faceI))
{ {
selected[faceI] = true; selected[facei] = true;
} }
} }
syncTools::syncFaceList syncTools::syncFaceList
@ -797,9 +792,9 @@ namespace Foam
const label own = pMesh.faceOwner()[faceI]; const label own = pMesh.faceOwner()[faceI];
const cell& ownFaces = pMesh.cells()[own]; const cell& ownFaces = pMesh.cells()[own];
forAll(ownFaces, ownFaceI) for (const label facei : ownFaces)
{ {
selected[ownFaces[ownFaceI]] = true; selected[facei] = true;
} }
if (pMesh.isInternalFace(faceI)) if (pMesh.isInternalFace(faceI))
@ -824,9 +819,9 @@ Foam::labelList Foam::meshRefinement::growFaceCellFace
{ {
boolList selected(mesh_.nFaces(), false); boolList selected(mesh_.nFaces(), false);
for (auto faceI : set) for (const label facei : set)
{ {
markGrowFaceCellFace(mesh_, faceI, selected); markGrowFaceCellFace(mesh_, facei, selected);
} }
syncTools::syncFaceList syncTools::syncFaceList
@ -847,10 +842,9 @@ Foam::labelList Foam::meshRefinement::growFaceCellFace
{ {
boolList selected(mesh_.nFaces(), false); boolList selected(mesh_.nFaces(), false);
forAllConstIter(labelHashSet, set, iter) for (const label facei : set)
{ {
const label faceI = iter.key(); markGrowFaceCellFace(mesh_, facei, selected);
markGrowFaceCellFace(mesh_, faceI, selected);
} }
syncTools::syncFaceList syncTools::syncFaceList

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2015-2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -57,16 +57,16 @@ void Foam::meshRefinement::markBoundaryFace
const labelList& fEdges = mesh_.faceEdges(facei); 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]; 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 // 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()]; const cell& cFaces = mesh_.cells()[iter.key()];
@ -832,30 +832,26 @@ Foam::labelList Foam::meshRefinement::markFacesOnProblemCells
DynamicList<label> dynPCells; DynamicList<label> dynPCells;
forAllConstIter(labelHashSet, nonBoundaryAnchors, iter) for (const label pointi : nonBoundaryAnchors)
{ {
label pointi = iter.key();
const labelList& pCells = mesh_.pointCells(pointi, dynPCells); const labelList& pCells = mesh_.pointCells(pointi, dynPCells);
// Count number of 'hasSevenBoundaryAnchorPoints' cells. // Count number of 'hasSevenBoundaryAnchorPoints' cells.
label n = 0; 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) if (n > 3)
{ {
// Point in danger of being what? Remove all 7-cells. // 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 (hasSevenBoundaryAnchorPoints.test(celli))
{ {
if if
@ -878,10 +874,8 @@ Foam::labelList Foam::meshRefinement::markFacesOnProblemCells
{ {
const cell& cFaces = mesh_.cells()[celli]; const cell& cFaces = mesh_.cells()[celli];
forAll(cFaces, cf) for (const label facei : cFaces)
{ {
label facei = cFaces[cf];
if if
( (
facePatch[facei] == -1 facePatch[facei] == -1
@ -943,11 +937,11 @@ Foam::labelList Foam::meshRefinement::markFacesOnProblemCells
const labelList& fEdges = mesh_.faceEdges(facei, dynFEdges); const labelList& fEdges = mesh_.faceEdges(facei, dynFEdges);
label nFaceBoundaryEdges = 0; 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()) if (pp.coupled())
{ {
label facei = pp.start(); label facei = pp.start();
@ -1000,11 +992,11 @@ Foam::labelList Foam::meshRefinement::markFacesOnProblemCells
const labelList& fEdges = mesh_.faceEdges(facei, dynFEdges); const labelList& fEdges = mesh_.faceEdges(facei, dynFEdges);
label nFaceBoundaryEdges = 0; label nFaceBoundaryEdges = 0;
forAll(fEdges, fe) for (const label edgei : fEdges)
{ {
if (isBoundaryEdge[fEdges[fe]]) if (isBoundaryEdge[edgei])
{ {
nFaceBoundaryEdges++; ++nFaceBoundaryEdges;
} }
} }

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -280,10 +280,8 @@ Foam::layerParameters::layerParameters
{ {
const dictionary& layerDict = iter().dict(); const dictionary& layerDict = iter().dict();
forAllConstIter(labelHashSet, patchIDs, patchiter) for (const label patchi : patchIDs)
{ {
label patchi = patchiter.key();
numLayers_[patchi] = numLayers_[patchi] =
readLabel(layerDict.lookup("nSurfaceLayers")); readLabel(layerDict.lookup("nSurfaceLayers"));

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2015-2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -1074,7 +1074,7 @@ Foam::label Foam::snappyRefineDriver::refinementInterfaceRefine
//forAllConstIter(cellSet, transitionCells, iter) //forAllConstIter(cellSet, transitionCells, iter)
//{ //{
// label celli = iter.key(); // const label celli : iter.key();
// const cell& cFaces = cells[celli]; // const cell& cFaces = cells[celli];
// const point& cc = cellCentres[celli]; // const point& cc = cellCentres[celli];
// const scalar rCVol = pow(cellVolumes[celli], -5.0/3.0); // const scalar rCVol = pow(cellVolumes[celli], -5.0/3.0);
@ -1859,10 +1859,10 @@ void Foam::snappyRefineDriver::addFaceZones
const polyMesh& mesh = meshRefiner.mesh(); const polyMesh& mesh = meshRefiner.mesh();
// Add patches for added inter-region faceZones // Add patches for added inter-region faceZones
forAllConstIter(HashTable<Pair<word>>, faceZoneToPatches, iter) forAllConstIters(faceZoneToPatches, iter)
{ {
const word& fzName = iter.key(); const word& fzName = iter.key();
const Pair<word>& patchNames = iter(); const Pair<word>& patchNames = iter.object();
// Get any user-defined faceZone data // Get any user-defined faceZone data
surfaceZonesInfo::faceZoneType fzType; surfaceZonesInfo::faceZoneType fzType;

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -425,10 +425,9 @@ restartUncoveredSourceFace
// list of faces currently visited for srcFacei to avoid multiple hits // list of faces currently visited for srcFacei to avoid multiple hits
DynamicList<label> visitedFaces(10); DynamicList<label> visitedFaces(10);
forAllConstIter(labelHashSet, lowWeightFaces, iter) for (const label srcFacei : lowWeightFaces)
{ {
label srcFacei = iter.key(); const label tgtFacei = this->findTargetFace(srcFacei);
label tgtFacei = this->findTargetFace(srcFacei);
if (tgtFacei != -1) if (tgtFacei != -1)
{ {
//bool faceProcessed = //bool faceProcessed =

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -57,9 +57,8 @@ void Foam::patchPatchDist::correct()
{ {
// Mark all edge connected to a nbrPatch. // Mark all edge connected to a nbrPatch.
label nBnd = 0; label nBnd = 0;
forAllConstIter(labelHashSet, nbrPatchIDs_, iter) for (const label nbrPatchi : nbrPatchIDs_)
{ {
label nbrPatchi = iter.key();
const polyPatch& nbrPatch = patch_.boundaryMesh()[nbrPatchi]; const polyPatch& nbrPatch = patch_.boundaryMesh()[nbrPatchi];
nBnd += nbrPatch.nEdges()-nbrPatch.nInternalEdges(); nBnd += nbrPatch.nEdges()-nbrPatch.nInternalEdges();
} }
@ -68,9 +67,8 @@ void Foam::patchPatchDist::correct()
// functionality for these. // functionality for these.
EdgeMap<label> nbrEdges(2*nBnd); EdgeMap<label> nbrEdges(2*nBnd);
forAllConstIter(labelHashSet, nbrPatchIDs_, iter) for (const label nbrPatchi : nbrPatchIDs_)
{ {
label nbrPatchi = iter.key();
const polyPatch& nbrPatch = patch_.boundaryMesh()[nbrPatchi]; const polyPatch& nbrPatch = patch_.boundaryMesh()[nbrPatchi];
const labelList& nbrMp = nbrPatch.meshPoints(); const labelList& nbrMp = nbrPatch.meshPoints();
@ -78,7 +76,7 @@ void Foam::patchPatchDist::correct()
( (
label edgeI = nbrPatch.nInternalEdges(); label edgeI = nbrPatch.nInternalEdges();
edgeI < nbrPatch.nEdges(); edgeI < nbrPatch.nEdges();
edgeI++ ++edgeI
) )
{ {
const edge& e = nbrPatch.edges()[edgeI]; const edge& e = nbrPatch.edges()[edgeI];

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -805,7 +805,7 @@ Foam::label Foam::cellClassification::fillRegionPoints
{ {
label nTotChanged = 0; label nTotChanged = 0;
for (label iter = 0; iter < maxIter; iter++) for (label iter = 0; iter < maxIter; ++iter)
{ {
// Get interface between meshType cells and non-meshType cells as a list // Get interface between meshType cells and non-meshType cells as a list
// of faces and for each face the cell which is the meshType. // of faces and for each face the cell which is the meshType.
@ -826,26 +826,25 @@ Foam::label Foam::cellClassification::fillRegionPoints
label nChanged = 0; label nChanged = 0;
forAllConstIter(labelHashSet, nonManifoldPoints, iter) for (const label nonManPti : nonManifoldPoints)
{ {
// Find a face on fp using point and remove it. // Find a face on fp using point and remove it.
const label patchPointi = meshPointMap[iter.key()]; const label patchPointi = meshPointMap[nonManPti];
const labelList& pFaces = fp.pointFaces()[patchPointi]; const labelList& pFaces = fp.pointFaces()[patchPointi];
// Remove any face using conflicting point. Does first face which // Remove any face using conflicting point. Does first face which
// has not yet been done. Could be more intelligent and decide which // has not yet been done. Could be more intelligent and decide which
// one would be best to remove. // one would be best to remove.
forAll(pFaces, i) for (const label patchFacei : pFaces)
{ {
const label patchFacei = pFaces[i];
const label ownerCell = outsideOwner[patchFacei]; const label ownerCell = outsideOwner[patchFacei];
if (operator[](ownerCell) == meshType) if (operator[](ownerCell) == meshType)
{ {
operator[](ownerCell) = fillType; operator[](ownerCell) = fillType;
nChanged++; ++nChanged;
break; break;
} }
} }

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -61,10 +61,8 @@ void Foam::patchToFace::combine(topoSet& set, const bool add) const
true // use patch groups if available true // use patch groups if available
); );
forAllConstIter(labelHashSet, patchIDs, iter) for (const label patchi : patchIDs)
{ {
label patchi = iter.key();
const polyPatch& pp = mesh_.boundaryMesh()[patchi]; const polyPatch& pp = mesh_.boundaryMesh()[patchi];
Info<< " Found matching patch " << pp.name() Info<< " Found matching patch " << pp.name()

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -136,23 +136,24 @@ void Foam::topoSet::updateLabels(const labelList& map)
// Iterate over map to see if anything changed // Iterate over map to see if anything changed
bool changed = false; bool changed = false;
forAllConstIter(labelHashSet, *this, iter) const labelHashSet& labels = *this;
for (const label oldId : labels)
{ {
if ((iter.key() < 0) || (iter.key() > map.size())) if (oldId < 0 || oldId > map.size())
{ {
FatalErrorInFunction FatalErrorInFunction
<< "Illegal content " << iter.key() << " of set:" << name() << "Illegal content " << oldId << " of set:" << name()
<< " of type " << type() << endl << " of type " << type() << endl
<< "Value should be between 0 and " << map.size()-1 << "Value should be between [0," << map.size() << ')'
<< abort(FatalError); << abort(FatalError);
} }
const label newCelli = map[iter.key()]; const label newId = map[oldId];
if (newCelli != iter.key()) if (newId != oldId)
{ {
changed = true; changed = true;
break; break;
} }
} }
@ -162,13 +163,13 @@ void Foam::topoSet::updateLabels(const labelList& map)
{ {
labelHashSet newSet(2*size()); labelHashSet newSet(2*size());
forAllConstIter(labelHashSet, *this, iter) for (const label oldId : labels)
{ {
const label newCelli = map[iter.key()]; const label newId = map[oldId];
if (newCelli >= 0) if (newId >= 0)
{ {
newSet.insert(newCelli); newSet.insert(newId);
} }
} }
@ -179,14 +180,16 @@ void Foam::topoSet::updateLabels(const labelList& map)
void Foam::topoSet::check(const label maxLabel) void Foam::topoSet::check(const label maxLabel)
{ {
forAllConstIter(topoSet, *this, iter) const labelHashSet& labels = *this;
for (const label oldId : labels)
{ {
if ((iter.key() < 0) || (iter.key() > maxLabel)) if (oldId < 0 || oldId > maxLabel)
{ {
FatalErrorInFunction FatalErrorInFunction
<< "Illegal content " << iter.key() << " of set:" << name() << "Illegal content " << oldId << " of set:" << name()
<< " of type " << type() << endl << " of type " << type() << nl
<< "Value should be between 0 and " << maxLabel << "Value should be between [0," << maxLabel << ']'
<< abort(FatalError); << abort(FatalError);
} }
} }
@ -206,14 +209,14 @@ void Foam::topoSet::writeDebug
for (; (iter != end()) && (n < maxElem); ++iter) for (; (iter != end()) && (n < maxElem); ++iter)
{ {
if ((n != 0) && ((n % 10) == 0)) if (n && ((n % 10) == 0))
{ {
os << endl; os << endl;
} }
os << iter.key() << ' '; os << iter.key() << ' ';
n++; ++n;
elemI++; ++elemI;
} }
} }
@ -232,14 +235,14 @@ void Foam::topoSet::writeDebug
for (; (iter != end()) && (n < maxElem); ++iter) for (; (iter != end()) && (n < maxElem); ++iter)
{ {
if ((n != 0) && ((n % 3) == 0)) if (n && ((n % 3) == 0))
{ {
os << endl; os << endl;
} }
os << iter.key() << coords[iter.key()] << ' '; os << iter.key() << coords[iter.key()] << ' ';
n++; ++n;
elemI++; ++elemI;
} }
} }
@ -488,12 +491,12 @@ void Foam::topoSet::subset(const topoSet& set)
clear(); clear();
resize(2*min(currentSet.size(), set.size())); resize(2*min(currentSet.size(), set.size()));
forAllConstIter(labelHashSet, currentSet, iter) for (const label currId : currentSet)
{ {
if (set.found(iter.key())) if (set.found(currId))
{ {
// element present in both currentSet and set. // element present in both currentSet and set.
insert(iter.key()); insert(currId);
} }
} }
} }
@ -501,18 +504,20 @@ void Foam::topoSet::subset(const topoSet& set)
void Foam::topoSet::addSet(const topoSet& set) void Foam::topoSet::addSet(const topoSet& set)
{ {
forAllConstIter(topoSet, set, iter) const labelHashSet& labels = set;
for (const label id : labels)
{ {
insert(iter.key()); insert(id);
} }
} }
void Foam::topoSet::deleteSet(const topoSet& set) void Foam::topoSet::deleteSet(const topoSet& set)
{ {
forAllConstIter(topoSet, set, iter) const labelHashSet& labels = set;
for (const label id : labels)
{ {
erase(iter.key()); erase(id);
} }
} }

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -121,18 +121,16 @@ License
// // Snap outside points to surface // // Snap outside points to surface
// pointField newPoints(points); // pointField newPoints(points);
// //
// forAllConstIter(labelHashSet, flatCandidates, iter) // for (const label celli : flatCandidates)
// { // {
// const cell& cFaces = cells[iter.key()]; // const cell& cFaces = cells[celli];
// //
// forAll(cFaces, cFacei) // for (const label facei : cFaces)
// { // {
// const face& f = faces[cFaces[cFacei]]; // const face& f = faces[facei];
// //
// forAll(f, fp) // for (const label pointi : f)
// { // {
// label pointi = f[fp];
//
// if (outsidePoints.insert(pointi)) // if (outsidePoints.insert(pointi))
// { // {
// // Calculate new position for this outside point // // Calculate new position for this outside point
@ -147,10 +145,8 @@ License
// //
// // Calculate new volume for mixed cells // // Calculate new volume for mixed cells
// label nRemoved = 0; // label nRemoved = 0;
// forAllConstIter(labelHashSet, flatCandidates, iter) // for (const label celli : flatCandidates)
// { // {
// label celli = iter.key();
//
// const cell& cll = cells[celli]; // const cell& cll = cells[celli];
// //
// scalar newVol = cll.mag(newPoints, faces); // scalar newVol = cll.mag(newPoints, faces);
@ -374,20 +370,19 @@ Foam::labelHashSet Foam::surfaceSets::getHangingCells
labelHashSet mixedOnlyCells(internalCells.size()); labelHashSet mixedOnlyCells(internalCells.size());
forAllConstIter(labelHashSet, internalCells, iter) for (const label celli : internalCells)
{ {
const label celli = iter.key();
const cell& cFaces = cells[celli]; const cell& cFaces = cells[celli];
label usesMixedOnly = true; label usesMixedOnly = true;
forAll(cFaces, i) for (const label facei : cFaces)
{ {
const face& f = faces[cFaces[i]]; const face& f = faces[facei];
forAll(f, fp) for (const label pointi : f)
{ {
if (pointSide[f[fp]] != MIXED) if (pointSide[pointi] != MIXED)
{ {
usesMixedOnly = false; usesMixedOnly = false;
break; break;

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -2294,31 +2294,26 @@ Foam::triSurface Foam::triSurfaceTools::triangulate
label newPatchi = 0; label newPatchi = 0;
forAllConstIter(labelHashSet, includePatches, iter) for (const label patchi : includePatches)
{ {
const label patchi = iter.key();
const polyPatch& patch = bMesh[patchi]; const polyPatch& patch = bMesh[patchi];
const pointField& points = patch.points(); const pointField& points = patch.points();
label nTriTotal = 0; label nTriTotal = 0;
forAll(patch, patchFacei) for (const face& f : patch)
{ {
const face& f = patch[patchFacei];
faceList triFaces(f.nTriangles(points)); faceList triFaces(f.nTriangles(points));
label nTri = 0; label nTri = 0;
f.triangles(points, nTri, triFaces); f.triangles(points, nTri, triFaces);
forAll(triFaces, triFacei) for (const face& f : triFaces)
{ {
const face& f = triFaces[triFacei];
triangles.append(labelledTri(f[0], f[1], f[2], newPatchi)); triangles.append(labelledTri(f[0], f[1], f[2], newPatchi));
nTriTotal++; ++nTriTotal;
} }
} }
@ -2348,9 +2343,8 @@ Foam::triSurface Foam::triSurfaceTools::triangulate
newPatchi = 0; newPatchi = 0;
forAllConstIter(labelHashSet, includePatches, iter) for (const label patchi : includePatches)
{ {
const label patchi = iter.key();
const polyPatch& patch = bMesh[patchi]; const polyPatch& patch = bMesh[patchi];
surface.patches()[newPatchi].name() = patch.name(); surface.patches()[newPatchi].name() = patch.name();
@ -2399,9 +2393,8 @@ Foam::triSurface Foam::triSurfaceTools::triangulateFaceCentre
label newPatchi = 0; label newPatchi = 0;
forAllConstIter(labelHashSet, includePatches, iter) for (const label patchi : includePatches)
{ {
const label patchi = iter.key();
const polyPatch& patch = bMesh[patchi]; const polyPatch& patch = bMesh[patchi];
label nTriTotal = 0; label nTriTotal = 0;
@ -2451,9 +2444,8 @@ Foam::triSurface Foam::triSurfaceTools::triangulateFaceCentre
newPatchi = 0; newPatchi = 0;
forAllConstIter(labelHashSet, includePatches, iter) for (const label patchi : includePatches)
{ {
const label patchi = iter.key();
const polyPatch& patch = bMesh[patchi]; const polyPatch& patch = bMesh[patchi];
surface.patches()[newPatchi].name() = patch.name(); surface.patches()[newPatchi].name() = patch.name();

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -61,9 +61,8 @@ void contactAngleForce::initialise()
labelHashSet patchIDs = pbm.patchSet(zeroForcePatches); labelHashSet patchIDs = pbm.patchSet(zeroForcePatches);
forAllConstIter(labelHashSet, patchIDs, iter) for (const label patchi : patchIDs)
{ {
label patchi = iter.key();
Info<< " " << pbm[patchi].name() << endl; Info<< " " << pbm[patchi].name() << endl;
} }

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -65,7 +65,7 @@ injectionModelList::injectionModelList
wordHashSet models(activeModels); wordHashSet models(activeModels);
Info<< " Selecting film injection models" << endl; Info<< " Selecting film injection models" << endl;
if (models.size() > 0) if (models.size())
{ {
this->setSize(models.size()); this->setSize(models.size());

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2015-2017 OpenFOAM Foundation \\ / A nd | Copyright (C) 2015-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -65,9 +65,8 @@ patchInjection::patchInjection
Info<< " applying to patches:" << nl; Info<< " applying to patches:" << nl;
label pidi = 0; label pidi = 0;
forAllConstIter(labelHashSet, patchSet, iter) for (const label patchi : patchSet)
{ {
label patchi = iter.key();
patchIDs_[pidi++] = patchi; patchIDs_[pidi++] = patchi;
Info<< " " << pbm[patchi].name() << endl; Info<< " " << pbm[patchi].name() << endl;
} }

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2012-2017 OpenFOAM Foundation \\ / A nd | Copyright (C) 2012-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -150,9 +150,9 @@ Foam::labelList Foam::structuredRenumber::renumber
const labelHashSet patchIDs(pbm.patchSet(patches_)); const labelHashSet patchIDs(pbm.patchSet(patches_));
label nFaces = 0; label nFaces = 0;
forAllConstIter(labelHashSet, patchIDs, iter) for (const label patchi : patchIDs)
{ {
nFaces += pbm[iter.key()].size(); nFaces += pbm[patchi].size();
} }
@ -205,9 +205,9 @@ Foam::labelList Foam::structuredRenumber::renumber
labelList patchFaces(nFaces); labelList patchFaces(nFaces);
List<topoDistanceData> patchData(nFaces); List<topoDistanceData> patchData(nFaces);
nFaces = 0; nFaces = 0;
forAllConstIter(labelHashSet, patchIDs, iter) for (const label patchi : patchIDs)
{ {
const polyPatch& pp = pbm[iter.key()]; const polyPatch& pp = pbm[patchi];
const labelUList& fc = pp.faceCells(); const labelUList& fc = pp.faceCells();
forAll(fc, i) forAll(fc, i)
{ {

View File

@ -247,10 +247,8 @@ void Foam::rigidBodyMeshMotionSolver::solve()
// Update the displacements // Update the displacements
forAll(bodyMeshes_, bi) forAll(bodyMeshes_, bi)
{ {
forAllConstIter(labelHashSet, bodyMeshes_[bi].patchSet_, iter) for (const label patchi : bodyMeshes_[bi].patchSet_)
{ {
label patchi = iter.key();
pointField patchPoints0 pointField patchPoints0
( (
meshSolver_.pointDisplacement().boundaryField()[patchi] meshSolver_.pointDisplacement().boundaryField()[patchi]

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2012-2017 OpenFOAM Foundation \\ / A nd | Copyright (C) 2012-2017 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2015-2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -790,10 +790,10 @@ void Foam::meshToMesh::constructFromCuttingPatches
DynamicList<label> srcIDs(patchMap.size()); DynamicList<label> srcIDs(patchMap.size());
DynamicList<label> tgtIDs(patchMap.size()); DynamicList<label> tgtIDs(patchMap.size());
forAllConstIter(HashTable<word>, patchMap, iter) forAllConstIters(patchMap, iter)
{ {
const word& tgtPatchName = iter.key(); const word& tgtPatchName = iter.key();
const word& srcPatchName = iter(); const word& srcPatchName = iter.object();
const polyPatch& srcPatch = srcBm[srcPatchName]; const polyPatch& srcPatch = srcBm[srcPatchName];

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2017-2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -60,9 +60,9 @@ void Foam::patchCloudSet::calcSamples
// Construct search tree for all patch faces. // Construct search tree for all patch faces.
label sz = 0; label sz = 0;
forAllConstIter(labelHashSet, patchSet_, iter) for (const label patchi : patchSet_)
{ {
const polyPatch& pp = mesh().boundaryMesh()[iter.key()]; const polyPatch& pp = mesh().boundaryMesh()[patchi];
sz += pp.size(); sz += pp.size();
@ -75,9 +75,9 @@ void Foam::patchCloudSet::calcSamples
labelList patchFaces(sz); labelList patchFaces(sz);
sz = 0; sz = 0;
treeBoundBox bb(boundBox::invertedBox); treeBoundBox bb(boundBox::invertedBox);
forAllConstIter(labelHashSet, patchSet_, iter) for (const label patchi : patchSet_)
{ {
const polyPatch& pp = mesh().boundaryMesh()[iter.key()]; const polyPatch& pp = mesh().boundaryMesh()[patchi];
forAll(pp, i) forAll(pp, i)
{ {

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -60,9 +60,9 @@ void Foam::patchSeedSet::calcSamples
// Construct search tree for all patch faces. // Construct search tree for all patch faces.
label sz = 0; label sz = 0;
forAllConstIter(labelHashSet, patchSet_, iter) for (const label patchi : patchSet_)
{ {
const polyPatch& pp = mesh().boundaryMesh()[iter.key()]; const polyPatch& pp = mesh().boundaryMesh()[patchi];
sz += pp.size(); sz += pp.size();
@ -74,9 +74,9 @@ void Foam::patchSeedSet::calcSamples
labelList patchFaces(sz); labelList patchFaces(sz);
sz = 0; sz = 0;
forAllConstIter(labelHashSet, patchSet_, iter) for (const label patchi : patchSet_)
{ {
const polyPatch& pp = mesh().boundaryMesh()[iter.key()]; const polyPatch& pp = mesh().boundaryMesh()[patchi];
forAll(pp, i) forAll(pp, i)
{ {
patchFaces[sz++] = pp.start()+i; patchFaces[sz++] = pp.start()+i;

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2017-2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -87,25 +87,17 @@ Foam::triSurface Foam::faceShading::triangulate
label newPatchI = 0; label newPatchI = 0;
forAllConstIter(labelHashSet, includePatches, iter) for (const label patchI : includePatches)
{ {
const label patchI = iter.key();
const polyPatch& patch = bMesh[patchI]; const polyPatch& patch = bMesh[patchI];
const pointField& points = patch.points(); const pointField& points = patch.points();
label nTriTotal = 0; label nTriTotal = 0;
if (includeAllFacesPerPatch[patchI].size() > 0) if (includeAllFacesPerPatch[patchI].size())
{ {
forAllConstIter for (const label patchFaceI : includeAllFacesPerPatch[patchI])
(
labelHashSet,
includeAllFacesPerPatch[patchI],
iter1
)
{ {
const label patchFaceI = iter1.key();
const face& f = patch[patchFaceI]; const face& f = patch[patchFaceI];
faceList triFaces(f.nTriangles(points)); faceList triFaces(f.nTriangles(points));
@ -146,12 +138,11 @@ Foam::triSurface Foam::faceShading::triangulate
newPatchI = 0; newPatchI = 0;
forAllConstIter(labelHashSet, includePatches, iter) for (const label patchI : includePatches)
{ {
const label patchI = iter.key();
const polyPatch& patch = bMesh[patchI]; const polyPatch& patch = bMesh[patchI];
if (includeAllFacesPerPatch[patchI].size() > 0) if (includeAllFacesPerPatch[patchI].size())
{ {
surface.patches()[newPatchI].name() = patch.name(); surface.patches()[newPatchI].name() = patch.name();
surface.patches()[newPatchI].geometricType() = patch.type(); surface.patches()[newPatchI].geometricType() = patch.type();

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -98,9 +98,8 @@ void Foam::radiation::solarLoad::updateAbsorptivity
const boundaryRadiationProperties& boundaryRadiation = const boundaryRadiationProperties& boundaryRadiation =
boundaryRadiationProperties::New(mesh_); boundaryRadiationProperties::New(mesh_);
forAllConstIter(labelHashSet, includePatches, iter) for (const label patchID : includePatches)
{ {
const label patchID = iter.key();
absorptivity_[patchID].setSize(nBands_); absorptivity_[patchID].setSize(nBands_);
for (label bandI = 0; bandI < nBands_; bandI++) for (label bandI = 0; bandI < nBands_; bandI++)
{ {
@ -174,9 +173,8 @@ void Foam::radiation::solarLoad::updateSkyDiffusiveRadiation
case solarCalculator::mSunLoadFairWeatherConditions: case solarCalculator::mSunLoadFairWeatherConditions:
case solarCalculator::mSunLoadTheoreticalMaximum: case solarCalculator::mSunLoadTheoreticalMaximum:
{ {
forAllConstIter(labelHashSet, includePatches, iter) for (const label patchID : includePatches)
{ {
const label patchID = iter.key();
const polyPatch& pp = patches[patchID]; const polyPatch& pp = patches[patchID];
const scalarField& sf = mesh_.magSf().boundaryField()[patchID]; const scalarField& sf = mesh_.magSf().boundaryField()[patchID];
@ -255,9 +253,8 @@ void Foam::radiation::solarLoad::updateSkyDiffusiveRadiation
case solarCalculator::mSunLoadConstant: case solarCalculator::mSunLoadConstant:
{ {
forAllConstIter(labelHashSet, includePatches, iter) for (const label patchID : includePatches)
{ {
const label patchID = iter.key();
const polyPatch& pp = patches[patchID]; const polyPatch& pp = patches[patchID];
const scalarField& sf = mesh_.magSf().boundaryField()[patchID]; const scalarField& sf = mesh_.magSf().boundaryField()[patchID];
@ -589,9 +586,8 @@ void Foam::radiation::solarLoad::calculateQdiff
const polyBoundaryMesh& patches = mesh_.boundaryMesh(); const polyBoundaryMesh& patches = mesh_.boundaryMesh();
volScalarField::Boundary& qrBf = qr_.boundaryFieldRef(); volScalarField::Boundary& qrBf = qr_.boundaryFieldRef();
forAllConstIter(labelHashSet, includePatches, iter) for (const label patchID : includePatches)
{ {
const label patchID = iter.key();
const scalarField& qSecond = qsecondRad_.boundaryField()[patchID]; const scalarField& qSecond = qsecondRad_.boundaryField()[patchID];
if (includeMappedPatchBasePatches[patchID]) if (includeMappedPatchBasePatches[patchID])
{ {