diff --git a/applications/test/callback/Test-callback.C b/applications/test/callback/Test-callback.C index 2599ada23e..3f1b794fe8 100644 --- a/applications/test/callback/Test-callback.C +++ b/applications/test/callback/Test-callback.C @@ -72,7 +72,7 @@ public: void testCallbackFunction() const { - forAllConstIter(callbackRegistry, *this, iter) + forAllConstIters(*this, iter) { iter().testCallbackFunction(); } diff --git a/applications/test/cyclic/Test-cyclic.C b/applications/test/cyclic/Test-cyclic.C index 5e1a7a833e..4da99a1115 100644 --- a/applications/test/cyclic/Test-cyclic.C +++ b/applications/test/cyclic/Test-cyclic.C @@ -55,7 +55,7 @@ int main(int argc, char *argv[]) Info<< fvc::div(U); - Info<< "end" << endl; + Info<< "End" << endl; } diff --git a/applications/test/delete/Test-delete.C b/applications/test/delete/Test-delete.C index 1db0a002d1..60a34e6ef1 100644 --- a/applications/test/delete/Test-delete.C +++ b/applications/test/delete/Test-delete.C @@ -54,7 +54,7 @@ int main() a = h + i + j; Info<< a << endl; - Info<< "end" << endl; + Info<< "End" << endl; return 0; } diff --git a/applications/test/fvc/Test-fvc.C b/applications/test/fvc/Test-fvc.C index 32c926eb01..d27b4f50c2 100644 --- a/applications/test/fvc/Test-fvc.C +++ b/applications/test/fvc/Test-fvc.C @@ -57,7 +57,7 @@ int main(int argc, char *argv[]) Info<< (gradx4a - gradx4[i])/gradx4a << endl; } - Info<< "end" << endl; + Info<< "End" << endl; } diff --git a/applications/test/fvc2D/Test-fvc2D.C b/applications/test/fvc2D/Test-fvc2D.C index 527cfbd3cc..dfe063e585 100644 --- a/applications/test/fvc2D/Test-fvc2D.C +++ b/applications/test/fvc2D/Test-fvc2D.C @@ -65,7 +65,7 @@ int main(int argc, char *argv[]) mesh ); - Info<< "end" << endl; + Info<< "End" << endl; } diff --git a/applications/test/graph/Test-graph.C b/applications/test/graph/Test-graph.C index 5cfea035a4..68e4c0386d 100644 --- a/applications/test/graph/Test-graph.C +++ b/applications/test/graph/Test-graph.C @@ -65,7 +65,7 @@ int main() ); phi.write("phi", "xmgr"); - Info<< "end" << endl; + Info<< "End" << endl; } diff --git a/applications/test/graph/graphTest2.C b/applications/test/graph/graphTest2.C index f01b5ccca4..4c01f605a0 100644 --- a/applications/test/graph/graphTest2.C +++ b/applications/test/graph/graphTest2.C @@ -57,7 +57,7 @@ int main() "xmgr" ); - Info<< "end" << endl; + Info<< "End" << endl; } diff --git a/applications/test/graphXi/Test-graphXi.C b/applications/test/graphXi/Test-graphXi.C index 38ec520cb9..107ffa58a3 100644 --- a/applications/test/graphXi/Test-graphXi.C +++ b/applications/test/graphXi/Test-graphXi.C @@ -57,7 +57,7 @@ int main() graph("r", "x", "r", x, r).write("r", "xmgr"); - Info<< "end" << endl; + Info<< "End" << endl; return 0; } diff --git a/applications/test/passiveParticle/Test-passiveParticle.C b/applications/test/passiveParticle/Test-passiveParticle.C index 5506683b34..2853d4cb26 100644 --- a/applications/test/passiveParticle/Test-passiveParticle.C +++ b/applications/test/passiveParticle/Test-passiveParticle.C @@ -59,11 +59,11 @@ int main(int argc, char *argv[]) Pout<< "Adding a particle." << endl; particles.addParticle(new passiveParticle(mesh, Zero, -1)); - forAllConstIter(passiveParticleCloud, particles, iter) + for (const passiveParticle& p : particles) { - Pout<< " " << iter().position() << " cell:" << iter().cell() - << " origProc:" << iter().origProc() - << " origId:" << iter().origId() + Pout<< " " << p.position() << " cell:" << p.cell() + << " origProc:" << p.origProc() + << " origId:" << p.origId() << endl; } @@ -80,11 +80,11 @@ int main(int argc, char *argv[]) passiveParticleCloud particles(mesh, cloudName); Pout<< "Reread particles:" << particles.size() << endl; - forAllConstIter(passiveParticleCloud, particles, iter) + for (const passiveParticle& p : particles) { - Pout<< " " << iter().position() << " cell:" << iter().cell() - << " origProc:" << iter().origProc() - << " origId:" << iter().origId() + Pout<< " " << p.position() << " cell:" << p.cell() + << " origProc:" << p.origProc() + << " origId:" << p.origId() << endl; } } diff --git a/applications/test/syncTools/Test-syncTools.C b/applications/test/syncTools/Test-syncTools.C index cfdaaed586..19004f2caf 100644 --- a/applications/test/syncTools/Test-syncTools.C +++ b/applications/test/syncTools/Test-syncTools.C @@ -261,10 +261,10 @@ void testSparseData(const polyMesh& mesh, Random& rndGen) } // 2. Does sparseData contain more? - forAllConstIter(Map, sparseData, iter) + forAllConstIters(sparseData, iter) { - const point& sparsePt = iter(); - label meshPointi = iter.key(); + const label meshPointi = iter.key(); + const point& sparsePt = iter.val(); const point& fullPt = fullData[meshPointi]; if (fullPt != sparsePt) @@ -350,9 +350,9 @@ void testSparseData(const polyMesh& mesh, Random& rndGen) { const edge& e = mesh.edges()[meshEdgeI]; - EdgeMap::const_iterator iter = sparseData.find(e); + const auto iter = sparseData.cfind(e); - if (iter != sparseData.end()) + if (iter.found()) { const point& sparsePt = iter(); const point& fullPt = fullData[meshEdgeI]; diff --git a/applications/utilities/mesh/advanced/PDRMesh/PDRMesh.C b/applications/utilities/mesh/advanced/PDRMesh/PDRMesh.C index 3aa52a84c1..972cfbe8b5 100644 --- a/applications/utilities/mesh/advanced/PDRMesh/PDRMesh.C +++ b/applications/utilities/mesh/advanced/PDRMesh/PDRMesh.C @@ -711,18 +711,18 @@ int main(int argc, char *argv[]) setsAndPatches[setI][1] ); - forAllConstIter(faceSet, fSet, iter) + for (const label facei : fSet) { - if (wantedPatch[iter.key()] != -1) + if (wantedPatch[facei] != -1) { FatalErrorInFunction - << "Face " << iter.key() + << "Face " << facei << " is in faceSet " << setsAndPatches[setI][0] << " destined for patch " << setsAndPatches[setI][1] - << " but also in patch " << wantedPatch[iter.key()] + << " but also in patch " << wantedPatch[facei] << exit(FatalError); } - wantedPatch[iter.key()] = patchi; + wantedPatch[facei] = patchi; } } @@ -749,20 +749,21 @@ int main(int argc, char *argv[]) faceSet fSet(mesh, coupledAndPatches[setI][0]); label patchi = findPatch(patches, coupledAndPatches[setI][1]); - forAllConstIter(faceSet, fSet, iter) + for (const label facei : fSet) { - if (coupledWantedPatch[iter.key()] != -1) + if (coupledWantedPatch[facei] != -1) { FatalErrorInFunction - << "Face " << iter.key() + << "Face " << facei << " is in faceSet " << coupledAndPatches[setI][0] << " destined for patch " << coupledAndPatches[setI][1] - << " but also in patch " << coupledWantedPatch[iter.key()] + << " but also in patch " << coupledWantedPatch[facei] << exit(FatalError); } - coupledWantedPatch[iter.key()] = patchi; - cyclicWantedPatch_half0[iter.key()] = cyclicId; - cyclicWantedPatch_half1[iter.key()] = cyclicSlaveId; + + coupledWantedPatch[facei] = patchi; + cyclicWantedPatch_half0[facei] = cyclicId; + cyclicWantedPatch_half1[facei] = cyclicSlaveId; } } diff --git a/applications/utilities/mesh/advanced/modifyMesh/cellSplitter.C b/applications/utilities/mesh/advanced/modifyMesh/cellSplitter.C index a39690325b..799ce1ea97 100644 --- a/applications/utilities/mesh/advanced/modifyMesh/cellSplitter.C +++ b/applications/utilities/mesh/advanced/modifyMesh/cellSplitter.C @@ -80,25 +80,24 @@ Foam::label Foam::cellSplitter::newOwner const Map& cellToCells ) const { - label oldOwn = mesh_.faceOwner()[facei]; + const label old = mesh_.faceOwner()[facei]; - Map::const_iterator fnd = cellToCells.find(oldOwn); + const auto iter = cellToCells.cfind(old); - if (fnd == cellToCells.end()) + if (!iter.found()) { // Unsplit cell - return oldOwn; + return old; } - else - { - // Look up index of face in the cells' faces. - const labelList& newCells = fnd(); - const cell& cFaces = mesh_.cells()[oldOwn]; + // Look up index of face in the cells' faces. - return newCells[cFaces.find(facei)]; - } + const labelList& newCells = *iter; + + const cell& cFaces = mesh_.cells()[old]; + + return newCells[cFaces.find(facei)]; } @@ -108,31 +107,29 @@ Foam::label Foam::cellSplitter::newNeighbour const Map& cellToCells ) const { - label oldNbr = mesh_.faceNeighbour()[facei]; + const label old = mesh_.faceNeighbour()[facei]; - Map::const_iterator fnd = cellToCells.find(oldNbr); + const auto iter = cellToCells.cfind(old); - if (fnd == cellToCells.end()) + if (!iter.found()) { // Unsplit cell - return oldNbr; + return old; } - else - { - // Look up index of face in the cells' faces. - const labelList& newCells = fnd(); - const cell& cFaces = mesh_.cells()[oldNbr]; + // Look up index of face in the cells' faces. - return newCells[cFaces.find(facei)]; - } + const labelList& newCells = *iter; + + const cell& cFaces = mesh_.cells()[old]; + + return newCells[cFaces.find(facei)]; } // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -// Construct from components Foam::cellSplitter::cellSplitter(const polyMesh& mesh) : mesh_(mesh), @@ -140,12 +137,6 @@ Foam::cellSplitter::cellSplitter(const polyMesh& mesh) {} -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::cellSplitter::~cellSplitter() -{} - - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // void Foam::cellSplitter::setRefinement @@ -162,9 +153,9 @@ void Foam::cellSplitter::setRefinement // Introduce cellToMidPoints. // - forAllConstIter(Map, cellToMidPoint, iter) + forAllConstIters(cellToMidPoint, iter) { - label celli = iter.key(); + const label celli = iter.key(); label anchorPoint = mesh_.cellPoints()[celli][0]; @@ -173,7 +164,7 @@ void Foam::cellSplitter::setRefinement ( polyAddPoint ( - iter(), // point + iter.val(), // point anchorPoint, // master point -1, // zone for point true // supports a cell @@ -193,9 +184,9 @@ void Foam::cellSplitter::setRefinement Map cellToCells(cellToMidPoint.size()); - forAllConstIter(Map, cellToMidPoint, iter) + forAllConstIters(cellToMidPoint, iter) { - label celli = iter.key(); + const label celli = iter.key(); const cell& cFaces = mesh_.cells()[celli]; @@ -238,9 +229,9 @@ void Foam::cellSplitter::setRefinement // point. // - forAllConstIter(Map, cellToMidPoint, iter) + forAllConstIters(cellToMidPoint, iter) { - label celli = iter.key(); + const label celli = iter.key(); label midPointi = addedPoints_[celli]; @@ -368,9 +359,9 @@ void Foam::cellSplitter::setRefinement // Mark off affected face. bitSet faceUpToDate(mesh_.nFaces(), true); - forAllConstIter(Map, cellToMidPoint, iter) + forAllConstIters(cellToMidPoint, iter) { - label celli = iter.key(); + const label celli = iter.key(); const cell& cFaces = mesh_.cells()[celli]; @@ -462,15 +453,13 @@ void Foam::cellSplitter::updateMesh(const mapPolyMesh& morphMap) // point get mapped do they get inserted. Map