Commit a766d386 authored by Mark Olesen's avatar Mark Olesen Committed by Andrew Heather
Browse files

ENH: for-range, forAllIters() ... in sampling/, surfMesh/

- reduced clutter when iterating over containers
parent fd8379fd
......@@ -447,11 +447,11 @@ void Foam::localPointRegion::calcPointRegions
//// Print points with multiple regions. These points need to be duplicated.
//forAllConstIter(Map<label>, meshPointMap_, iter)
//forAllConstIters(meshPointMap_, iter)
//{
// Pout<< "point:" << iter.key()
// << " coord:" << mesh.points()[iter.key()]
// << " regions:" << pointRegions_[iter()] << endl;
// << " regions:" << pointRegions_[iter.val()] << endl;
//}
}
......@@ -685,13 +685,13 @@ void Foam::localPointRegion::updateMesh(const mapPolyMesh& map)
{
Map<label> newMap(meshFaceMap_.size());
forAllConstIter(Map<label>, meshFaceMap_, iter)
forAllConstIters(meshFaceMap_, iter)
{
label newFacei = map.reverseFaceMap()[iter.key()];
const label newFacei = map.reverseFaceMap()[iter.key()];
if (newFacei >= 0)
{
newMap.insert(newFacei, iter());
newMap.insert(newFacei, iter.val());
}
}
meshFaceMap_.transfer(newMap);
......@@ -699,13 +699,13 @@ void Foam::localPointRegion::updateMesh(const mapPolyMesh& map)
{
Map<label> newMap(meshPointMap_.size());
forAllConstIter(Map<label>, meshPointMap_, iter)
forAllConstIters(meshPointMap_, iter)
{
label newPointi = map.reversePointMap()[iter.key()];
const label newPointi = map.reversePointMap()[iter.key()];
if (newPointi >= 0)
{
newMap.insert(newPointi, iter());
newMap.insert(newPointi, iter.val());
}
}
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd |
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2011-2019 OpenFOAM Foundation
......@@ -298,7 +298,7 @@ void Foam::isoSurfaceTopo::fixTetBasePtIs()
// Check for any points with count 2
bool haveDangling = false;
forAllConstIter(Map<label>, pointCount, iter)
forAllConstIters(pointCount, iter)
{
if (iter() == 1)
{
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016-2018 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2016-2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2011-2016 OpenFOAM Foundation
......@@ -374,7 +374,7 @@ bool Foam::discreteSurface::update(const meshSearch& meshSearcher)
surfZoneList zoneLst(zoneSizes.size());
label start = 0;
label zoneI = 0;
forAllIter(Map<label>, zoneSizes, iter)
forAllIters(zoneSizes, iter)
{
// No negative regionids, so Map<label> sorts properly
const label regionid = iter.key();
......@@ -399,7 +399,7 @@ bool Foam::discreteSurface::update(const meshSearch& meshSearcher)
);
// Adjust start for the next zone and save (zoneId => zoneI) mapping
start += iter();
start += iter.val();
iter() = zoneI++;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment