Commit 7d7b0bfe authored by Mark Olesen's avatar Mark Olesen
Browse files

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

parent 5b8b689a
......@@ -98,7 +98,7 @@ int main(int argc, char *argv[])
const wordList& regions = iter();
forAll(regions, i)
{
if (findIndex(regionNames, regions[i]) == -1)
if (!regionNames.found(regions[i]))
{
regionNames.append(regions[i]);
}
......
......@@ -136,7 +136,7 @@ int main(int argc, char *argv[])
const wordList& regions = iter();
forAll(regions, i)
{
if (findIndex(regionNames, regions[i]) == -1)
if (!regionNames.found(regions[i]))
{
regionNames.append(regions[i]);
}
......
......@@ -97,7 +97,7 @@ Foam::label Foam::cellSplitter::newOwner
const cell& cFaces = mesh_.cells()[oldOwn];
return newCells[findIndex(cFaces, facei)];
return newCells[cFaces.find(facei)];
}
}
......@@ -125,7 +125,7 @@ Foam::label Foam::cellSplitter::newNeighbour
const cell& cFaces = mesh_.cells()[oldNbr];
return newCells[findIndex(cFaces, facei)];
return newCells[cFaces.find(facei)];
}
}
......@@ -261,8 +261,8 @@ void Foam::cellSplitter::setRefinement
// (since newly created cells are stored in cFaces order)
const labelList& newCells = cellToCells[celli];
label cell0 = newCells[findIndex(cFaces, face0)];
label cell1 = newCells[findIndex(cFaces, face1)];
label cell0 = newCells[cFaces.find(face0)];
label cell1 = newCells[cFaces.find(face1)];
if (cell0 < cell1)
{
......@@ -271,7 +271,7 @@ void Foam::cellSplitter::setRefinement
const face& f0 = mesh_.faces()[face0];
label index = findIndex(f0, e[0]);
label index = f0.find(e[0]);
bool edgeInFaceOrder = (f0[f0.fcIndex(index)] == e[1]);
......@@ -317,7 +317,7 @@ void Foam::cellSplitter::setRefinement
const face& f1 = mesh_.faces()[face1];
label index = findIndex(f1, e[0]);
label index = f1.find(e[0]);
bool edgeInFaceOrder = (f1[f1.fcIndex(index)] == e[1]);
......
......@@ -225,8 +225,8 @@ bool splitHex
const face& f = faces[facei];
label fp0 = findIndex(f, e[0]);
label fp1 = findIndex(f, e[1]);
label fp0 = f.find(e[0]);
label fp1 = f.find(e[1]);
if (fp0 == -1)
{
......
......@@ -136,7 +136,7 @@ label findFace(const primitivePatch& pp, const labelList& meshF)
forAll(f, fp)
{
if (findIndex(meshF, f[fp]) != -1)
if (meshF.found(f[fp]))
{
nMatched++;
}
......@@ -168,7 +168,7 @@ label findInternalFace(const primitiveMesh& mesh, const labelList& meshF)
forAll(f, fp)
{
if (findIndex(meshF, f[fp]) != -1)
if (meshF.found(f[fp]))
{
nMatched++;
}
......
......@@ -806,7 +806,7 @@ int main(int argc, char *argv[])
)
);
if (findIndex(foamVerts, -1) != -1)
if (foamVerts.found(-1))
{
FatalErrorInFunction
<< "Cell " << celli
......@@ -825,7 +825,7 @@ int main(int argc, char *argv[])
{
labelList foamVerts(renumber(unvToFoam, boundaryFaces[bFacei]));
if (findIndex(foamVerts, -1) != -1)
if (foamVerts.found(-1))
{
FatalErrorInFunction
<< "Boundary face " << bFacei
......
......@@ -29,7 +29,7 @@ License
bool Foam::extrudedMesh::sameOrder(const face& f, const edge& e)
{
label i = findIndex(f, e[0]);
label i = f.find(e[0]);
label nextI = (i == f.size()-1 ? 0 : i+1);
......
......@@ -464,7 +464,7 @@ public:
{
forAll(y, yi)
{
if (findIndex(x, y[yi]) == -1)
if (!x.found(y[yi]))
{
label sz = x.size();
x.setSize(sz+1);
......@@ -2488,14 +2488,14 @@ int main(int argc, char *argv[])
if (isA<mappedWallPolyPatch>(pp))
{
if (findIndex(interRegionTopPatch, patchi) != -1)
if (interRegionTopPatch.found(patchi))
{
label zoneI = findIndex(interRegionTopPatch, patchi);
label zoneI = interRegionTopPatch.find(patchi);
topOffsets[zoneI] = calcOffset(extrudePatch, extruder, pp);
}
else if (findIndex(interRegionBottomPatch, patchi) != -1)
else if (interRegionBottomPatch.found(patchi))
{
label zoneI = findIndex(interRegionBottomPatch, patchi);
label zoneI = interRegionBottomPatch.find(patchi);
bottomOffsets[zoneI] = calcOffset(extrudePatch, extruder, pp);
}
}
......
......@@ -45,7 +45,7 @@ void Foam::patchToPoly2DMesh::flipFaceOrder()
const face& f = localFaces[edgeOwner];
label fp = findIndex(f, e[0]);
label fp = f.find(e[0]);
if (f.nextLabel(fp) != e[1])
{
......@@ -207,7 +207,7 @@ void Foam::patchToPoly2DMesh::addPatchFacesToOwner()
{
const face& f = faces[owner_[bEdgeI]];
label fp = findIndex(f, e[0]);
label fp = f.find(e[0]);
newOwner[bFacei] = owner_[bEdgeI];
......
......@@ -660,7 +660,7 @@ Foam::face Foam::conformalVoronoiMesh::buildDualFace
if (cc1I != cc2I)
{
if (findIndex(verticesOnFace, cc1I) == -1)
if (!verticesOnFace.found(cc1I))
{
nUniqueVertices++;
}
......
......@@ -2119,8 +2119,8 @@ void Foam::conformalVoronoiMesh::createFacesOwnerNeighbourAndPatches
patchIndex = max
(
findIndex(procNeighbours, vA->procIndex()),
findIndex(procNeighbours, vB->procIndex())
procNeighbours.find(vA->procIndex()),
procNeighbours.find(vB->procIndex())
);
// The lower processor index is the owner of the
......
......@@ -465,12 +465,12 @@ inline Foam::List<Foam::label> Foam::conformalVoronoiMesh::processorsAttached
forAll(c1Procs, aPI)
{
if (findIndex(procsAttached, c1Procs[aPI] == -1))
if (!procsAttached.found(c1Procs[aPI]))
{
procsAttached.append(c1Procs[aPI]);
}
if (findIndex(procsAttached, c2Procs[aPI] == -1))
if (!procsAttached.found(c2Procs[aPI]))
{
procsAttached.append(c2Procs[aPI]);
}
......
......@@ -306,7 +306,7 @@ void Foam::conformalVoronoiMesh::writeMesh(const fileName& instance)
// )()
// );
//
// label pointi = findIndex(pointDualAddressing, -1);
// label pointi = pointDualAddressing.find(-1);
// if (pointi != -1)
// {
// WarningInFunction
......
......@@ -471,7 +471,7 @@ void Foam::conformalVoronoiMesh::calcFaceZones
// a faceZone
if (surfHit.size() == 1 && surfHit[0].hit())
{
if (findIndex(unclosedSurfaces, hitSurface[0]) != -1)
if (unclosedSurfaces.found(hitSurface[0]))
{
vectorField norm;
geometryToConformTo().getNormal
......
......@@ -43,7 +43,7 @@ void Foam::shortEdgeFilter2D::addRegion
{
bPointRegions.append(regionI);
}
else if (findIndex(bPointRegions, regionI) == -1)
else if (!bPointRegions.found(regionI))
{
bPointRegions.append(regionI);
}
......
......@@ -130,7 +130,7 @@ int main(int argc, char *argv[])
while (true)
{
// Find first unset face.
label unsetFacei = findIndex(patchIDs, -1);
label unsetFacei = patchIDs.find(-1);
if (unsetFacei == -1)
{
......
......@@ -137,7 +137,7 @@ Foam::label Foam::meshDualiser::findDualCell
}
else
{
label index = findIndex(mesh_.pointCells()[pointi], celli);
label index = mesh_.pointCells()[pointi].find(celli);
return dualCells[index];
}
......@@ -421,7 +421,7 @@ void Foam::meshDualiser::createFacesAroundEdge
}
if (faceToDualPoint_[ie.faceLabel()] != -1)
{
doneEFaces[findIndex(eFaces, ie.faceLabel())] = true;
doneEFaces[eFaces.find(ie.faceLabel())] = true;
verts.append(faceToDualPoint_[ie.faceLabel()]);
}
if (cellToDualPoint_[ie.cellLabel()] != -1)
......@@ -439,7 +439,7 @@ void Foam::meshDualiser::createFacesAroundEdge
label facei = ie.faceLabel();
// Mark face as visited.
doneEFaces[findIndex(eFaces, facei)] = true;
doneEFaces[eFaces.find(facei)] = true;
if (faceToDualPoint_[facei] != -1)
{
......@@ -513,7 +513,7 @@ void Foam::meshDualiser::createFacesAroundEdge
{
label startDual = faceToDualPoint_[startFaceLabel];
if (startDual != -1 && findIndex(verts, startDual) == -1)
if (startDual != -1 && !verts.found(startDual))
{
verts.append(startDual);
}
......@@ -666,7 +666,7 @@ void Foam::meshDualiser::createFacesAroundBoundaryPoint
while (true)
{
label index = findIndex(pFaces, facei-pp.start());
label index = pFaces.find(facei-pp.start());
// Has face been visited already?
if (donePFaces[index])
......@@ -682,7 +682,7 @@ void Foam::meshDualiser::createFacesAroundBoundaryPoint
// Get the edge before the patchPointi
const face& f = mesh_.faces()[facei];
label fp = findIndex(f, pointi);
label fp = f.find(pointi);
label prevFp = f.rcIndex(fp);
label edgeI = mesh_.faceEdges()[facei][prevFp];
......@@ -763,7 +763,7 @@ void Foam::meshDualiser::createFacesAroundBoundaryPoint
// Find edge between pointi and next point on face.
const labelList& fEdges = mesh_.faceEdges()[facei];
label nextEdgeI = fEdges[findIndex(mesh_.faces()[facei], pointi)];
label nextEdgeI = fEdges[mesh_.faces()[facei].find(pointi)];
if (edgeToDualPoint_[nextEdgeI] != -1)
{
verts.append(edgeToDualPoint_[nextEdgeI]);
......@@ -771,7 +771,7 @@ void Foam::meshDualiser::createFacesAroundBoundaryPoint
do
{
label index = findIndex(pFaces, facei-pp.start());
label index = pFaces.find(facei-pp.start());
// Has face been visited already?
if (donePFaces[index])
......@@ -786,7 +786,7 @@ void Foam::meshDualiser::createFacesAroundBoundaryPoint
// Find edge before pointi on facei
const labelList& fEdges = mesh_.faceEdges()[facei];
const face& f = mesh_.faces()[facei];
label prevFp = f.rcIndex(findIndex(f, pointi));
label prevFp = f.rcIndex(f.find(pointi));
label edgeI = fEdges[prevFp];
if (edgeToDualPoint_[edgeI] != -1)
......@@ -912,7 +912,7 @@ void Foam::meshDualiser::setRefinement
{
featureFaceSet[featureFaces[i]] = true;
}
label facei = findIndex(featureFaceSet, false);
label facei = featureFaceSet.find(false);
if (facei != -1)
{
......@@ -929,7 +929,7 @@ void Foam::meshDualiser::setRefinement
{
featureEdgeSet[featureEdges[i]] = true;
}
label edgeI = findIndex(featureEdgeSet, false);
label edgeI = featureEdgeSet.find(false);
if (edgeI != -1)
{
......
......@@ -1574,7 +1574,7 @@ int main(int argc, char *argv[])
<< " This requires all"
<< " cells to be in one and only one cellZone." << nl << endl;
label unzonedCelli = findIndex(zoneID, -1);
label unzonedCelli = zoneID.find(-1);
if (unzonedCelli != -1)
{
FatalErrorInFunction
......@@ -1623,7 +1623,7 @@ int main(int argc, char *argv[])
labelList newNeiZoneID(mesh.nFaces()-mesh.nInternalFaces());
getZoneID(mesh, newCellZones, newZoneID, newNeiZoneID);
label unzonedCelli = findIndex(newZoneID, -1);
label unzonedCelli = newZoneID.find(-1);
if (unzonedCelli != -1)
{
FatalErrorInFunction
......
......@@ -179,7 +179,7 @@ class uniqueEqOp
}
forAll(y, i)
{
if (!y[i].empty() && findIndex(x, y[i]) == -1)
if (!y[i].empty() && !x.found(y[i]))
{
newX[n++] = y[i];
}
......
......@@ -173,7 +173,7 @@ int main(int argc, char *argv[])
collectFieldList(psytf, patchi, fieldToType);
collectFieldList(ptf, patchi, fieldToType);
label groupI = findIndex(fieldToTypes, fieldToType);
label groupI = fieldToTypes.find(fieldToType);
if (groupI == -1)
{
DynamicList<label> group(1);
......
......@@ -306,7 +306,7 @@ int main(int argc, char *argv[])
const wordList& regions = iter();
forAll(regions, i)
{
if (findIndex(regionNames, regions[i]) == -1)
if (!regionNames.found(regions[i]))
{
regionNames.append(regions[i]);
}
......
......@@ -67,11 +67,8 @@ Foam::lagrangianFieldDecomposer::lagrangianFieldDecomposer
const indexedParticle& ppi = *iter();
particleIndices_[pi++] = ppi.index();
label mappedTetFace = findIndex
(
decodedProcFaceAddressing,
ppi.tetFace()
);
const label mappedTetFace =
decodedProcFaceAddressing.find(ppi.tetFace());
if (mappedTetFace == -1)
{
......
......@@ -189,7 +189,7 @@ int main(int argc, char *argv[])
const wordList& regions = iter();
forAll(regions, i)
{
if (findIndex(regionNames, regions[i]) == -1)
if (!regionNames.found(regions[i]))
{
regionNames.append(regions[i]);
}
......
......@@ -105,7 +105,7 @@ void Foam::parLagrangianRedistributor::findClouds
// One of the objects is coordinates/positions so must be valid
// cloud
label cloudI = findIndex(cloudNames, localCloudDirs[i]);
label cloudI = cloudNames.find(localCloudDirs[i]);
objectNames[cloudI].setSize(sprayObjs.size());
label objectI = 0;
......
......@@ -857,7 +857,7 @@ autoPtr<mapDistributePolyMesh> redistributeAndWrite
// processors
autoPtr<fvMeshSubset> subsetterPtr;
const bool allHaveMesh = (findIndex(haveMesh, false) == -1);
const bool allHaveMesh = !haveMesh.found(false);
if (!allHaveMesh)
{
// Find last non-processor patch.
......
......@@ -412,7 +412,7 @@ void Foam::tecplotWriter::writeConnectivity
// The face that uses the vertices of e in increasing order
// is the left face.
const label fp = findIndex(f0, e[0]);
const label fp = f0.find(e[0]);
const bool f0IsLeft = (f0.nextLabel(fp) == e[1]);
if (f0IsLeft)
......
......@@ -206,7 +206,7 @@ labelList findMatches
const wordList& keys = shortcuts[name];
forAll(keys, j)
{
label index = findIndex(thisKeys, keys[j]);
label index = thisKeys.find(keys[j]);
if (index != -1)
{
matches.append(index);
......
......@@ -416,7 +416,7 @@ void visitPointRegion
label index = findIndex(s.pointFaces()[pointI], nextFaceI);
label index = s.pointFaces()[pointI].find(nextFaceI);
if (pFacesZone[index] == -1)
{
......
......@@ -99,7 +99,7 @@ static void splitTri
{
//label oldNTris = tris.size();
label fp = findIndex(f, e[0]);
label fp = f.find(e[0]);
label fp1 = f.fcIndex(fp);
label fp2 = f.fcIndex(fp1);
......@@ -204,7 +204,7 @@ static bool insertSorted
scalarField& sortedWeights
)
{
if (findIndex(sortedVerts, vertI) != -1)
if (sortedVerts.found(vertI))
{
FatalErrorInFunction
<< " which is already in list of sorted vertices "
......@@ -562,7 +562,7 @@ static labelListList getOutsideVerts
{
label v = e[eI];
if (findIndex(regionVerts, v) == -1)
if (!regionVerts.found(v))
{
label sz = regionVerts.size();
regionVerts.setSize(sz+1);
......@@ -682,7 +682,7 @@ static void getSplitVerts
else
{
// Copy upto (but not including) e[1]
label i1 = findIndex(orderedVerts, e[1]);
label i1 = orderedVerts.find(e[1]);
splitVerts = SubList<label>(orderedVerts, i1, 0);
splitWeights = SubList<scalar>(orderedWeights, i1, 0);
}
......@@ -703,7 +703,7 @@ static void getSplitVerts
{
// Copy downto (but not including) e[1]
label i1 = findIndex(orderedVerts, e[1]);
label i1 = orderedVerts.find(e[1]);
splitVerts = SubList<label>(orderedVerts, sz-(i1+1), i1+1);
reverse(splitVerts);
splitWeights = SubList<scalar>(orderedWeights, sz-(i1+1), i1+1);
......@@ -716,7 +716,7 @@ static void getSplitVerts
// Copy upto (but not including) e[0]
label i0 = findIndex(orderedVerts, e[0]);
label i0 = orderedVerts.find(e[0]);
splitVerts = SubList<label>(orderedVerts, i0, 0);
reverse(splitVerts);
splitWeights = SubList<scalar>(orderedWeights, i0, 0);
......@@ -726,14 +726,14 @@ static void getSplitVerts
{
// Copy from (but not including) e[0] to end
label i0 = findIndex(orderedVerts, e[0]);
label i0 = orderedVerts.find(e[0]);
splitVerts = SubList<label>(orderedVerts, sz-(i0+1), i0+1);
splitWeights = SubList<scalar>(orderedWeights, sz-(i0+1), i0+1);
}
else
{
label i0 = findIndex(orderedVerts, e[0]);
label i1 = findIndex(orderedVerts, e[1]);
label i0 = orderedVerts.find(e[0]);
label i1 = orderedVerts.find(e[1]);
if (i0 == -1 || i1 == -1)
{
......