STYLE: use direct iteration for HashSet

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

- Eg,

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

View File

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

View File

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

View File

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

View File

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

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -360,9 +360,9 @@ void writePointCells
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[1]]); vertI++;

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -886,10 +886,10 @@ void Foam::conformalVoronoiMesh::checkCellSizing()
labelHashSet cellsToResizeMap(pMesh.nFaces()/100);
// 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 faceNeighbour = pMesh.faceNeighbour()[iter.key()];
const label faceOwner = pMesh.faceOwner()[facei];
const label faceNeighbour = pMesh.faceNeighbour()[facei];
if (!cellsToResizeMap.found(faceOwner))
{
@ -1105,9 +1105,9 @@ Foam::labelHashSet Foam::conformalVoronoiMesh::checkPolyMeshQuality
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);
}
@ -1118,9 +1118,9 @@ Foam::labelHashSet Foam::conformalVoronoiMesh::checkPolyMeshQuality
// 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)
// {
@ -1132,10 +1132,8 @@ Foam::labelHashSet Foam::conformalVoronoiMesh::checkPolyMeshQuality
// const labelListList& cellPts = pMesh.cellPoints();
// forAllConstIter(labelHashSet, limitCells, iter)
// for (const label celli : limitCells)
// {
// label celli = iter.key();
// const labelList& cP = cellPts[celli];
// ptToBeLimited.setMany(cP);

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015-2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -394,9 +394,9 @@ void extractSurface
// processor patches)
HashTable<label> patchSize(1024);
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());
nFaces += pp.size();
}
@ -427,9 +427,9 @@ void extractSurface
// Collect faces on zones
DynamicList<label> faceLabels(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)
{
faceLabels.append(pp.start()+i);

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -837,9 +837,9 @@ int main(int argc, char *argv[])
fvMeshMapper mapper(mesh, map());
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];

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -699,9 +699,9 @@ int main(int argc, char *argv[])
);
// 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()
<< " to patch " << destPatchi << endl;

View File

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

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -296,9 +296,8 @@ void Foam::regionSide::walkAllPointConnectedFaces
//
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];
regionEdges.insertMany(fEdges);
@ -313,9 +312,9 @@ void Foam::regionSide::walkAllPointConnectedFaces
labelHashSet visitedPoint(4*regionFaces.size());
// 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());
@ -326,10 +325,8 @@ void Foam::regionSide::walkAllPointConnectedFaces
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.
label celli;
@ -436,9 +433,9 @@ Foam::regionSide::regionSide
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.end());

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -66,8 +66,7 @@ const Foam::labelList& Foam::primitiveMesh::cellPoints
{
return cellPoints()[celli];
}
else
{
const faceList& fcs = faces();
const labelList& cFaces = cells()[celli];
@ -90,7 +89,6 @@ const Foam::labelList& Foam::primitiveMesh::cellPoints
}
return storage;
}
}

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -593,8 +593,7 @@ const Foam::labelList& Foam::primitiveMesh::faceEdges
{
return faceEdges()[facei];
}
else
{
const labelListList& pointEs = pointEdges();
const face& f = faces()[facei];
@ -617,7 +616,6 @@ const Foam::labelList& Foam::primitiveMesh::faceEdges
}
return storage;
}
}
@ -638,8 +636,7 @@ const Foam::labelList& Foam::primitiveMesh::cellEdges
{
return cellEdges()[celli];
}
else
{
const labelList& cFaces = cells()[celli];
set.clear();
@ -661,7 +658,6 @@ const Foam::labelList& Foam::primitiveMesh::cellEdges
}
return storage;
}
}

View File

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

View File

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

View File

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

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / 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
This file is part of OpenFOAM.
@ -2102,10 +2102,9 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
faceMap[faceI] += 1;
}
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();
subPatchMap[Pstream::myProcNo()] = identity(patches.size());
@ -2567,9 +2566,8 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
// Added processor
inplaceRenumber(map().addedCellMap(), constructCellMap[sendProc]);
// Add flip
forAllConstIter(labelHashSet, flippedAddedFaces, iter)
for (const label domainFaceI : flippedAddedFaces)
{
label domainFaceI = iter.key();
label& val = constructFaceMap[sendProc][domainFaceI];
val = -val;
}

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
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

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -30,7 +30,6 @@ License
// * * * * * * * * * * * * * * * Static Functions * * * * * * * * * * * * * //
// Update stored refine list using map
void Foam::edgeVertex::updateLabels
(
@ -131,11 +130,11 @@ void Foam::edgeVertex::updateLabels
// Iterate over map to see if anything changed
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;
@ -148,9 +147,9 @@ void Foam::edgeVertex::updateLabels
{
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)
{

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -257,11 +257,11 @@ void Foam::motionSmootherAlgo::subtractField
pointScalarField& fld
) 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
) const
{
isAffectedPoint.setSize(mesh_.nPoints());
isAffectedPoint.resize(mesh_.nPoints());
isAffectedPoint = false;
faceSet nbrFaces(mesh_, "checkFaces", wrongFaces);
@ -320,9 +320,9 @@ void Foam::motionSmootherAlgo::getAffectedFacesAndPoints
{
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)
{
@ -335,9 +335,9 @@ void Foam::motionSmootherAlgo::getAffectedFacesAndPoints
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);
}
}
@ -939,16 +939,16 @@ bool Foam::motionSmootherAlgo::scaleMesh
if (mag(errorReduction) < SMALL)
{
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];
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];
newWrongFaces.insertMany(neiFaces);

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -288,9 +288,8 @@ void Foam::perfectInterface::setRefinement
// 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];
face newFace(f.size());

View File

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

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -309,10 +309,8 @@ Foam::labelListList Foam::combineFaces::getMergeSets
DynamicList<label> storage;
// 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 labelList& cEdges = mesh_.cellEdges(celli, set, storage);

View File

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

View File

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

View File

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

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -138,19 +138,19 @@ void Foam::cellToCellStencil::merge
)
{
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;
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);
forAll(patches, patchi)
for (const polyPatch& pp : patches)
{
const polyPatch& pp = patches[patchi];
if (pp.coupled() || isA<emptyPolyPatch>(pp))
{
label bFacei = pp.start()-mesh().nInternalFaces();
@ -194,10 +192,8 @@ Foam::cellToCellStencil::allCoupledFacesPatch() const
label nCoupled = 0;
forAll(patches, patchi)
for (const polyPatch& pp : patches)
{
const polyPatch& pp = patches[patchi];
if (pp.coupled())
{
nCoupled += pp.size();
@ -206,10 +202,8 @@ Foam::cellToCellStencil::allCoupledFacesPatch() const
labelList coupledFaces(nCoupled);
nCoupled = 0;
forAll(patches, patchi)
for (const polyPatch& pp : patches)
{
const polyPatch& pp = patches[patchi];
if (pp.coupled())
{
label facei = pp.start();

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -159,11 +159,11 @@ void Foam::extendedUpwindCellToFaceStencil::transportStencil
transportedStencil[n++] = globalOwn;
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())
@ -179,11 +179,11 @@ void Foam::extendedUpwindCellToFaceStencil::transportStencil
label n = 0;
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())

View File

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

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -66,10 +66,8 @@ void Foam::cellToFaceStencil::merge
// For all in listA see if they are present
label nInsert = 0;
forAll(listA, i)
for (const label elem : listA)
{
label elem = listA[i];
if (elem != global0 && elem != global1)
{
if (findSortedIndex(listB, elem) == -1)
@ -96,10 +94,8 @@ void Foam::cellToFaceStencil::merge
// Insert listB
forAll(listB, i)
for (const label elem : listB)
{
label elem = listB[i];
if (elem != global0 && elem != global1)
{
result[resultI++] = elem;
@ -108,10 +104,8 @@ void Foam::cellToFaceStencil::merge
// Insert listA
forAll(listA, i)
for (const label elem : listA)
{
label elem = listA[i];
if (elem != global0 && elem != global1)
{
if (findSortedIndex(listB, elem) == -1)
@ -159,9 +153,9 @@ void Foam::cellToFaceStencil::merge
label n = 0;
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;
faceStencil[facei][n++] = globalOwn;
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()
@ -435,11 +429,11 @@ void Foam::cellToFaceStencil::calcFaceStencil
label n = 0;
faceStencil[facei][n++] = globalOwn;
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());
label n = 0;
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
\\ / O peration |
\\ / 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
This file is part of OpenFOAM.
@ -112,9 +112,8 @@ bool Foam::patchDistMethods::advectionDiffusion::correct
const fvPatchList& patches = mesh_.boundary();
volVectorField::Boundary& nybf = ny.boundaryFieldRef();
forAllConstIter(labelHashSet, patchIDs_, iter)
for (const label patchi : patchIDs_)
{
label patchi = iter.key();
nybf[patchi] == -patches[patchi].nf();
}

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -40,9 +40,9 @@ Foam::wordList Foam::patchDistMethod::patchTypes
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;

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / 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
This file is part of OpenFOAM.
@ -58,9 +58,8 @@ void Foam::wallDist::constructn() const
volVectorField::Boundary& nbf = n_.ref().boundaryFieldRef();
forAllConstIter(labelHashSet, patchIDs_, iter)
for (const label patchi : patchIDs_)
{
label patchi = iter.key();
nbf[patchi] == patches[patchi].nf();
}
}

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / 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
This file is part of OpenFOAM.
@ -48,9 +48,8 @@ void Foam::functionObjects::nearWallFields::calcAddressing()
{
// Count number of faces
label nPatchFaces = 0;
forAllConstIter(labelHashSet, patchSet_, iter)
for (const label patchi : patchSet_)
{
label patchi = iter.key();
nPatchFaces += mesh_.boundary()[patchi].size();
}
@ -70,9 +69,8 @@ void Foam::functionObjects::nearWallFields::calcAddressing()
// Add particles to track to sample locations
nPatchFaces = 0;
forAllConstIter(labelHashSet, patchSet_, iter)
for (const label patchi : patchSet_)
{
label patchi = iter.key();
const fvPatch& patch = mesh_.boundary()[patchi];
vectorField nf(patch.nf());

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -75,14 +75,14 @@ void Foam::inverseFaceDistanceDiffusivity::correct()
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);
nPatchFaces += bdry[pID].size();
patchSet.insert(patchi);
nPatchFaces += bdry[patchi].size();
}
}
@ -91,9 +91,9 @@ void Foam::inverseFaceDistanceDiffusivity::correct()
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());

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -69,9 +69,9 @@ void Foam::inversePointDistanceDiffusivity::correct()
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.
@ -88,16 +88,14 @@ void Foam::inversePointDistanceDiffusivity::correct()
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();
forAll(meshPoints, i)
for (const label pointi : meshPoints)
{
label pointi = meshPoints[i];
if (!pointWallDist[pointi].valid(dummyTrackData))
{
// 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];

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / 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
This file is part of OpenFOAM.
@ -234,12 +234,12 @@ void Foam::meshRefinement::calcCellCellRays
forAll(testFaces, i)
{
label facei = testFaces[i];
label own = mesh_.faceOwner()[facei];
const label facei = testFaces[i];
const label own = mesh_.faceOwner()[facei];
if (mesh_.isInternalFace(facei))
{
label nei = mesh_.faceNeighbour()[facei];
const label nei = mesh_.faceNeighbour()[facei];
start[i] = cellCentres[own];
end[i] = cellCentres[nei];
@ -247,7 +247,7 @@ void Foam::meshRefinement::calcCellCellRays
}
else
{
label bFacei = facei - mesh_.nInternalFaces();
const label bFacei = facei - mesh_.nInternalFaces();
start[i] = cellCentres[own];
end[i] = neiCc[bFacei];
@ -2541,13 +2541,13 @@ void Foam::meshRefinement::updateMesh
// Update faceToCoupledPatch_
{
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)
{
newFaceToPatch.insert(newFacei, iter());
newFaceToPatch.insert(newFacei, iter.object());
}
}
faceToCoupledPatch_.transfer(newFaceToPatch);

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -51,11 +51,9 @@ Foam::label Foam::meshRefinement::mergePatchFaces
// Pick up all candidate cells on boundary
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())
{
@ -221,17 +219,17 @@ Foam::label Foam::meshRefinement::mergePatchFaces
//
// 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);
//
// 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);
// }
@ -579,7 +577,7 @@ Foam::label Foam::meshRefinement::mergePatchFacesUndo
// (unless the faces are absolutely planar)
labelHashSet retestFaces(2*restoredFaces.size());
forAllConstIter(Map<label>, restoredFaces, iter)
forAllConstIters(restoredFaces, iter)
{
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
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));
@ -761,13 +758,11 @@ Foam::labelList Foam::meshRefinement::collectFaces
// Has face been selected?
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
@ -797,9 +792,9 @@ namespace Foam
const label own = pMesh.faceOwner()[faceI];
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))
@ -824,9 +819,9 @@ Foam::labelList Foam::meshRefinement::growFaceCellFace
{
boolList selected(mesh_.nFaces(), false);
for (auto faceI : set)
for (const label facei : set)
{
markGrowFaceCellFace(mesh_, faceI, selected);
markGrowFaceCellFace(mesh_, facei, selected);
}
syncTools::syncFaceList
@ -847,10 +842,9 @@ Foam::labelList Foam::meshRefinement::growFaceCellFace
{
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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
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
);
forAllConstIter(labelHashSet, patchIDs, iter)
for (const label patchi : patchIDs)
{
label patchi = iter.key();
const polyPatch& pp = mesh_.boundaryMesh()[patchi];
Info<< " Found matching patch " << pp.name()

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
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
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
<< "Illegal content " << iter.key() << " of set:" << name()
<< "Illegal content " << oldId << " of set:" << name()
<< " of type " << type() << endl
<< "Value should be between 0 and " << map.size()-1
<< "Value should be between [0," << map.size() << ')'
<< abort(FatalError);
}
const label newCelli = map[iter.key()];
const label newId = map[oldId];
if (newCelli != iter.key())
if (newId != oldId)
{
changed = true;
break;
}
}
@ -162,13 +163,13 @@ void Foam::topoSet::updateLabels(const labelList& map)
{
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)
{
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
<< "Illegal content " << iter.key() << " of set:" << name()
<< " of type " << type() << endl
<< "Value should be between 0 and " << maxLabel
<< "Illegal content " << oldId << " of set:" << name()
<< " of type " << type() << nl
<< "Value should be between [0," << maxLabel << ']'
<< abort(FatalError);
}
}
@ -206,14 +209,14 @@ void Foam::topoSet::writeDebug
for (; (iter != end()) && (n < maxElem); ++iter)
{
if ((n != 0) && ((n % 10) == 0))
if (n && ((n % 10) == 0))
{
os << endl;
}
os << iter.key() << ' ';
n++;
elemI++;
++n;
++elemI;
}
}
@ -232,14 +235,14 @@ void Foam::topoSet::writeDebug
for (; (iter != end()) && (n < maxElem); ++iter)
{
if ((n != 0) && ((n % 3) == 0))
if (n && ((n % 3) == 0))
{
os << endl;
}
os << iter.key() << coords[iter.key()] << ' ';
n++;
elemI++;
++n;
++elemI;
}
}
@ -488,12 +491,12 @@ void Foam::topoSet::subset(const topoSet& set)
clear();
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.
insert(iter.key());
insert(currId);
}
}
}
@ -501,18 +504,20 @@ void Foam::topoSet::subset(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)
{
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
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -121,18 +121,16 @@ License
// // Snap outside points to surface
// 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))
// {
// // Calculate new position for this outside point
@ -147,10 +145,8 @@ License
//
// // Calculate new volume for mixed cells
// label nRemoved = 0;
// forAllConstIter(labelHashSet, flatCandidates, iter)
// for (const label celli : flatCandidates)
// {
// label celli = iter.key();
//
// const cell& cll = cells[celli];
//
// scalar newVol = cll.mag(newPoints, faces);
@ -374,20 +370,19 @@ Foam::labelHashSet Foam::surfaceSets::getHangingCells
labelHashSet mixedOnlyCells(internalCells.size());
forAllConstIter(labelHashSet, internalCells, iter)
for (const label celli : internalCells)
{
const label celli = iter.key();
const cell& cFaces = cells[celli];
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;
break;

View File

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

View File

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

View File

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

View File

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

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2017 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -150,9 +150,9 @@ Foam::labelList Foam::structuredRenumber::renumber
const labelHashSet patchIDs(pbm.patchSet(patches_));
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);
List<topoDistanceData> patchData(nFaces);
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();
forAll(fc, i)
{

View File

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

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / 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
This file is part of OpenFOAM.
@ -790,10 +790,10 @@ void Foam::meshToMesh::constructFromCuttingPatches
DynamicList<label> srcIDs(patchMap.size());
DynamicList<label> tgtIDs(patchMap.size());
forAllConstIter(HashTable<word>, patchMap, iter)
forAllConstIters(patchMap, iter)
{
const word& tgtPatchName = iter.key();
const word& srcPatchName = iter();
const word& srcPatchName = iter.object();
const polyPatch& srcPatch = srcBm[srcPatchName];

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2017-2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -60,9 +60,9 @@ void Foam::patchCloudSet::calcSamples
// Construct search tree for all patch faces.
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();
@ -75,9 +75,9 @@ void Foam::patchCloudSet::calcSamples
labelList patchFaces(sz);
sz = 0;
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)
{

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -60,9 +60,9 @@ void Foam::patchSeedSet::calcSamples
// Construct search tree for all patch faces.
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();
@ -74,9 +74,9 @@ void Foam::patchSeedSet::calcSamples
labelList patchFaces(sz);
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)
{
patchFaces[sz++] = pp.start()+i;

View File

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

View File

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