STYLE: use list methods find/found instead of findIndex function

This commit is contained in:
Mark Olesen
2017-10-24 19:07:34 +02:00
parent 5b8b689a37
commit 7d7b0bfe84
136 changed files with 369 additions and 441 deletions

View File

@ -297,7 +297,7 @@ Foam::label Foam::mapNearestMethod::findMappedSrcCell
// search target tgtCelli neighbours for match with source cell
label tgtI = testCells.remove();
if (findIndex(visitedCells, tgtI) == -1)
if (!visitedCells.found(tgtI))
{
visitedCells.append(tgtI);
@ -311,7 +311,7 @@ Foam::label Foam::mapNearestMethod::findMappedSrcCell
forAll(nbrCells, i)
{
if (findIndex(visitedCells, nbrCells[i]) == -1)
if (!visitedCells.found(nbrCells[i]))
{
testCells.append(nbrCells[i]);
}

View File

@ -168,14 +168,12 @@ void Foam::meshToMeshMethod::appendNbrCells
const labelList& nbrCells = mesh.cellCells()[celli];
// filter out cells already visited from cell neighbours
forAll(nbrCells, i)
for (const label nbrCelli : nbrCells)
{
label nbrCelli = nbrCells[i];
if
(
(findIndex(visitedCells, nbrCelli) == -1)
&& (findIndex(nbrCellIDs, nbrCelli) == -1)
!visitedCells.found(nbrCelli)
&& !nbrCellIDs.found(nbrCelli)
)
{
nbrCellIDs.append(nbrCelli);

View File

@ -70,7 +70,7 @@ Foam::label Foam::meshToMesh::calcDistribution
}
else if (nHaveCells == 1)
{
proci = findIndex(cellsPresentOnProc, 1);
proci = cellsPresentOnProc.find(1);
if (debug)
{
InfoInFunction

View File

@ -55,7 +55,7 @@ Foam::sampledPlane::sampledPlane
triangulate_(triangulate),
needsUpdate_(true)
{
if (debug && zoneKey_.size() && mesh.cellZones().findIndex(zoneKey_) < 0)
if (debug && zoneKey_.size() && mesh.cellZones().findIndex(zoneKey_) == -1)
{
Info<< "cellZone " << zoneKey_
<< " not found - using entire mesh" << endl;
@ -91,7 +91,7 @@ Foam::sampledPlane::sampledPlane
dict.readIfPresent("zone", zoneKey_);
if (debug && zoneKey_.size() && mesh.cellZones().findIndex(zoneKey_) < 0)
if (debug && zoneKey_.size() && mesh.cellZones().findIndex(zoneKey_) == -1)
{
Info<< "cellZone " << zoneKey_
<< " not found - using entire mesh" << endl;

View File

@ -73,7 +73,7 @@ Foam::surfMeshPlaneSampler::surfMeshPlaneSampler
triangulate_(triangulate),
needsUpdate_(true)
{
if (debug && zoneKey_.size() && mesh.cellZones().findIndex(zoneKey_) < 0)
if (debug && zoneKey_.size() && mesh.cellZones().findIndex(zoneKey_) == -1)
{
Info<< "cellZone " << zoneKey_
<< " not found - using entire mesh" << endl;
@ -109,7 +109,7 @@ Foam::surfMeshPlaneSampler::surfMeshPlaneSampler
dict.readIfPresent("zone", zoneKey_);
if (debug && zoneKey_.size() && mesh.cellZones().findIndex(zoneKey_) < 0)
if (debug && zoneKey_.size() && mesh.cellZones().findIndex(zoneKey_) == -1)
{
Info<< "cellZone " << zoneKey_
<< " not found - using entire mesh" << endl;

View File

@ -748,7 +748,7 @@ void Foam::isoSurface::calcSnappedPoint
FixedList<scalar, 4> s;
FixedList<point, 4> pt;
label fp = findIndex(f, pointi);
label fp = f.find(pointi);
s[0] = isoFraction(pVals[pointi], cVals[own]);
pt[0] = (1.0-s[0])*pts[pointi] + s[0]*cc[own];

View File

@ -226,12 +226,12 @@ Foam::labelPair Foam::isoSurfaceCell::findCommonPoints
labelPair common(-1, -1);
label fp0 = 0;
label fp1 = findIndex(tri1, tri0[fp0]);
label fp1 = tri1.find(tri0[fp0]);
if (fp1 == -1)
{
fp0 = 1;
fp1 = findIndex(tri1, tri0[fp0]);
fp1 = tri1.find(tri0[fp0]);
}
if (fp1 != -1)
@ -553,7 +553,7 @@ void Foam::isoSurfaceCell::genPointTris
label nextFp = f.fcIndex(fp);
triFace tri(f[fp0], f[fp], f[nextFp]);
label index = findIndex(tri, pointi);
label index = tri.find(pointi);
if (index == -1)
{
@ -631,7 +631,7 @@ void Foam::isoSurfaceCell::genPointTris
{
label p1 = f1[fp];
if (findIndex(f, p1) == -1)
if (!f.found(p1))
{
ccPointi = p1;
break;
@ -645,7 +645,7 @@ void Foam::isoSurfaceCell::genPointTris
// Tet between index..index-1, index..index+1, index..cc
label index = findIndex(f, pointi);
label index = f.find(pointi);
label b = f[f.fcIndex(index)];
label c = f[f.rcIndex(index)];

View File

@ -360,7 +360,7 @@ void Foam::isoSurfaceCell::generateTriPoints
{
oppositeI = f1[fp];
if (findIndex(f0, oppositeI) == -1)
if (!f0.found(oppositeI))
{
break;
}