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

- reduced clutter when iterating over containers
This commit is contained in:
Mark Olesen
2019-01-07 09:20:51 +01:00
committed by Andrew Heather
parent 24861f5158
commit 2833521576
16 changed files with 313 additions and 512 deletions

View File

@ -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-2016 OpenFOAM Foundation
@ -41,9 +41,8 @@ namespace Foam
// Write points in obj format
static void writeObjPoints(const UList<point>& pts, Ostream& os)
{
forAll(pts, i)
for (const point& pt : pts)
{
const point& pt = pts[i];
os << "v " << pt.x() << ' ' << pt.y() << ' ' << pt.z() << nl;
}
}
@ -177,14 +176,9 @@ Foam::edgeList Foam::surfaceIntersection::filterEdges
{
const edge& e = edges[edgeI];
if
(
(e.start() != e.end())
&& (uniqueEdges.find(e) == uniqueEdges.end())
)
if ((e.start() != e.end()) && uniqueEdges.insert(e))
{
// Edge is -non degenerate and -not yet seen.
uniqueEdges.insert(e);
// Edge is non-degenerate and not yet seen.
map[edgeI] = newEdgeI;
@ -218,10 +212,9 @@ Foam::labelList Foam::surfaceIntersection::filterLabels
{
label elem = elems[elemI];
if (uniqueElems.find(elem) == uniqueElems.end())
if (uniqueElems.insert(elem))
{
// First time elem is seen
uniqueElems.insert(elem);
map[elemI] = newElemI;
@ -291,10 +284,8 @@ Foam::label Foam::surfaceIntersection::classify
{
return 1;
}
else
{
return -1;
}
return -1;
}