mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: for-range, forAllIters() ... in sampling/, surfMesh/
- reduced clutter when iterating over containers
This commit is contained in:
committed by
Andrew Heather
parent
fd8379fdbe
commit
a766d38643
@ -447,11 +447,11 @@ void Foam::localPointRegion::calcPointRegions
|
|||||||
|
|
||||||
|
|
||||||
//// Print points with multiple regions. These points need to be duplicated.
|
//// Print points with multiple regions. These points need to be duplicated.
|
||||||
//forAllConstIter(Map<label>, meshPointMap_, iter)
|
//forAllConstIters(meshPointMap_, iter)
|
||||||
//{
|
//{
|
||||||
// Pout<< "point:" << iter.key()
|
// Pout<< "point:" << iter.key()
|
||||||
// << " coord:" << mesh.points()[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());
|
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)
|
if (newFacei >= 0)
|
||||||
{
|
{
|
||||||
newMap.insert(newFacei, iter());
|
newMap.insert(newFacei, iter.val());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
meshFaceMap_.transfer(newMap);
|
meshFaceMap_.transfer(newMap);
|
||||||
@ -699,13 +699,13 @@ void Foam::localPointRegion::updateMesh(const mapPolyMesh& map)
|
|||||||
{
|
{
|
||||||
Map<label> newMap(meshPointMap_.size());
|
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)
|
if (newPointi >= 0)
|
||||||
{
|
{
|
||||||
newMap.insert(newPointi, iter());
|
newMap.insert(newPointi, iter.val());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd |
|
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
| Copyright (C) 2011-2019 OpenFOAM Foundation
|
| Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||||
@ -298,7 +298,7 @@ void Foam::isoSurfaceTopo::fixTetBasePtIs()
|
|||||||
|
|
||||||
// Check for any points with count 2
|
// Check for any points with count 2
|
||||||
bool haveDangling = false;
|
bool haveDangling = false;
|
||||||
forAllConstIter(Map<label>, pointCount, iter)
|
forAllConstIters(pointCount, iter)
|
||||||
{
|
{
|
||||||
if (iter() == 1)
|
if (iter() == 1)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2016-2018 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2016-2019 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
| Copyright (C) 2011-2016 OpenFOAM Foundation
|
| Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
@ -374,7 +374,7 @@ bool Foam::discreteSurface::update(const meshSearch& meshSearcher)
|
|||||||
surfZoneList zoneLst(zoneSizes.size());
|
surfZoneList zoneLst(zoneSizes.size());
|
||||||
label start = 0;
|
label start = 0;
|
||||||
label zoneI = 0;
|
label zoneI = 0;
|
||||||
forAllIter(Map<label>, zoneSizes, iter)
|
forAllIters(zoneSizes, iter)
|
||||||
{
|
{
|
||||||
// No negative regionids, so Map<label> sorts properly
|
// No negative regionids, so Map<label> sorts properly
|
||||||
const label regionid = iter.key();
|
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
|
// Adjust start for the next zone and save (zoneId => zoneI) mapping
|
||||||
start += iter();
|
start += iter.val();
|
||||||
iter() = zoneI++;
|
iter() = zoneI++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user