mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
STYLE: use list methods find/found instead of findIndex function
This commit is contained in:
@ -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
|
||||
|
||||
Reference in New Issue
Block a user