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:
@ -473,7 +473,7 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::agglomerate
|
||||
label elemi = elems[i];
|
||||
label coarseElemi = tgtCompactMap[elemi];
|
||||
|
||||
label index = findIndex(newElems, coarseElemi);
|
||||
label index = newElems.find(coarseElemi);
|
||||
if (index == -1)
|
||||
{
|
||||
newElems.append(coarseElemi);
|
||||
@ -519,7 +519,7 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::agglomerate
|
||||
label elemi = elems[i];
|
||||
label coarseElemi = targetRestrictAddressing[elemi];
|
||||
|
||||
label index = findIndex(newElems, coarseElemi);
|
||||
label index = newElems.find(coarseElemi);
|
||||
if (index == -1)
|
||||
{
|
||||
newElems.append(coarseElemi);
|
||||
|
||||
@ -67,7 +67,7 @@ Foam::label Foam::AMIInterpolation<SourcePatch, TargetPatch>::calcDistribution
|
||||
}
|
||||
else if (nHaveFaces == 1)
|
||||
{
|
||||
proci = findIndex(facesPresentOnProc, 1);
|
||||
proci = facesPresentOnProc.find(1);
|
||||
if (debug)
|
||||
{
|
||||
InfoInFunction
|
||||
|
||||
@ -137,7 +137,7 @@ Foam::label Foam::mapNearestAMI<SourcePatch, TargetPatch>::findMappedSrcFace
|
||||
// search target tgtFacei neighbours for match with source face
|
||||
label tgtI = testFaces.remove();
|
||||
|
||||
if (findIndex(visitedFaces, tgtI) == -1)
|
||||
if (!visitedFaces.found(tgtI))
|
||||
{
|
||||
visitedFaces.append(tgtI);
|
||||
|
||||
@ -151,7 +151,7 @@ Foam::label Foam::mapNearestAMI<SourcePatch, TargetPatch>::findMappedSrcFace
|
||||
|
||||
forAll(nbrFaces, i)
|
||||
{
|
||||
if (findIndex(visitedFaces, nbrFaces[i]) == -1)
|
||||
if (!visitedFaces.found(nbrFaces[i]))
|
||||
{
|
||||
testFaces.append(nbrFaces[i]);
|
||||
}
|
||||
|
||||
@ -63,7 +63,7 @@ inline const Foam::labelList& Foam::patchEdgeFaceRegions::regions() const
|
||||
template<class TrackingData>
|
||||
inline bool Foam::patchEdgeFaceRegions::valid(TrackingData& td) const
|
||||
{
|
||||
return regions_.size() && (findIndex(regions_, labelMax) == -1);
|
||||
return regions_.size() && !regions_.found(labelMax);
|
||||
}
|
||||
|
||||
|
||||
@ -94,7 +94,7 @@ inline bool Foam::patchEdgeFaceRegions::updateEdge
|
||||
const face& f = patch.localFaces()[facei];
|
||||
const edge& e = patch.edges()[edgeI];
|
||||
|
||||
label index = findIndex(patch.faceEdges()[facei], edgeI);
|
||||
label index = patch.faceEdges()[facei].find(edgeI);
|
||||
bool sameOrientation = (f[index] == e.start());
|
||||
|
||||
// Get information in edge-order
|
||||
@ -114,7 +114,7 @@ inline bool Foam::patchEdgeFaceRegions::updateEdge
|
||||
<< "problem." << abort(FatalError);
|
||||
}
|
||||
|
||||
if ((findIndex(orientedInfo, -1) != -1) || (findIndex(regions_, -1) != -1))
|
||||
if (orientedInfo.found(-1) || regions_.found(-1))
|
||||
{
|
||||
// Blocked edge/face
|
||||
return false;
|
||||
@ -161,7 +161,7 @@ inline bool Foam::patchEdgeFaceRegions::updateEdge
|
||||
<< "problem." << abort(FatalError);
|
||||
}
|
||||
|
||||
if ((findIndex(orientedInfo, -1) != -1) || (findIndex(regions_, -1) != -1))
|
||||
if (orientedInfo.found(-1) || regions_.found(-1))
|
||||
{
|
||||
// Blocked edge/face
|
||||
return false;
|
||||
@ -199,7 +199,7 @@ inline bool Foam::patchEdgeFaceRegions::updateFace
|
||||
const edge& e = patch.edges()[edgeI];
|
||||
|
||||
// Find starting point of edge on face.
|
||||
label index0 = findIndex(patch.faceEdges()[facei], edgeI);
|
||||
label index0 = patch.faceEdges()[facei].find(edgeI);
|
||||
label index1 = f.fcIndex(index0);
|
||||
bool sameOrientation = (f[index0] == e.start());
|
||||
|
||||
@ -221,7 +221,7 @@ inline bool Foam::patchEdgeFaceRegions::updateFace
|
||||
<< "problem." << abort(FatalError);
|
||||
}
|
||||
|
||||
if ((findIndex(orientedInfo, -1) != -1) || (findIndex(regions_, -1) != -1))
|
||||
if (orientedInfo.found(-1) || regions_.found(-1))
|
||||
{
|
||||
// Blocked edge/face
|
||||
return false;
|
||||
|
||||
@ -137,12 +137,12 @@ bool Foam::cellFeatures::isCellFeatureEdge
|
||||
|
||||
const face& f0 = mesh_.faces()[face0];
|
||||
|
||||
label face0Start = findIndex(f0, e.start());
|
||||
label face0Start = f0.find(e.start());
|
||||
label face0End = f0.fcIndex(face0Start);
|
||||
|
||||
const face& f1 = mesh_.faces()[face1];
|
||||
|
||||
label face1Start = findIndex(f1, e.start());
|
||||
label face1Start = f1.find(e.start());
|
||||
label face1End = f1.fcIndex(face1Start);
|
||||
|
||||
if
|
||||
|
||||
@ -143,7 +143,7 @@ Foam::label Foam::edgeFaceCirculator::getMinIndex
|
||||
const label v1
|
||||
)
|
||||
{
|
||||
label fp = findIndex(f, v0);
|
||||
label fp = f.find(v0);
|
||||
|
||||
if (fp != -1)
|
||||
{
|
||||
|
||||
@ -379,7 +379,7 @@ void Foam::extendedEdgeMesh::sortPointsAndEdges
|
||||
|
||||
forAll(ptEdNorms, k)
|
||||
{
|
||||
if (findIndex(tmpFtPtNorms, ptEdNorms[k]) == -1)
|
||||
if (!tmpFtPtNorms.found(ptEdNorms[k]))
|
||||
{
|
||||
bool addNormal = true;
|
||||
|
||||
|
||||
@ -379,7 +379,7 @@ void Foam::extendedFeatureEdgeMesh::sortPointsAndEdges
|
||||
|
||||
forAll(ptEdNorms, k)
|
||||
{
|
||||
if (findIndex(tmpFtPtNorms, ptEdNorms[k]) == -1)
|
||||
if (!tmpFtPtNorms.found(ptEdNorms[k]))
|
||||
{
|
||||
bool addNormal = true;
|
||||
|
||||
|
||||
@ -532,7 +532,7 @@ bool Foam::treeDataPrimitivePatch<PatchType>::findAllIntersectOp::operator()
|
||||
point& intersectionPoint
|
||||
) const
|
||||
{
|
||||
if (findIndex(shapeMask_, index) != -1)
|
||||
if (shapeMask_.found(index))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -564,7 +564,7 @@ bool Foam::treeDataPrimitivePatch<PatchType>::findSelfIntersectOp::operator()
|
||||
const typename PatchType::FaceType& f = patch.localFaces()[index];
|
||||
const edge& e = patch.edges()[edgeID_];
|
||||
|
||||
if (findIndex(f, e[0]) == -1 && findIndex(f, e[1]) == -1)
|
||||
if (!f.found(e[0]) && !f.found(e[1]))
|
||||
{
|
||||
return findIntersection(tree_, index, start, end, intersectionPoint);
|
||||
}
|
||||
|
||||
@ -53,7 +53,7 @@ Foam::mappedPolyPatch::mappedPolyPatch
|
||||
mappedPatchBase(static_cast<const polyPatch&>(*this))
|
||||
{
|
||||
// mapped is not constraint type so add mapped group explicitly
|
||||
if (findIndex(inGroups(), typeName) == -1)
|
||||
if (!inGroups().found(typeName))
|
||||
{
|
||||
inGroups().append(typeName);
|
||||
}
|
||||
@ -123,7 +123,7 @@ Foam::mappedPolyPatch::mappedPolyPatch
|
||||
mappedPatchBase(*this, dict)
|
||||
{
|
||||
// mapped is not constraint type so add mapped group explicitly
|
||||
if (findIndex(inGroups(), typeName) == -1)
|
||||
if (!inGroups().found(typeName))
|
||||
{
|
||||
inGroups().append(typeName);
|
||||
}
|
||||
|
||||
@ -59,7 +59,7 @@ Foam::mappedWallPolyPatch::mappedWallPolyPatch
|
||||
mappedPatchBase(static_cast<const polyPatch&>(*this))
|
||||
{
|
||||
// mapped is not constraint type so add mapped group explicitly
|
||||
if (findIndex(inGroups(), mappedPolyPatch::typeName) == -1)
|
||||
if (!inGroups().found(mappedPolyPatch::typeName))
|
||||
{
|
||||
inGroups().append(mappedPolyPatch::typeName);
|
||||
}
|
||||
@ -129,7 +129,7 @@ Foam::mappedWallPolyPatch::mappedWallPolyPatch
|
||||
mappedPatchBase(*this, dict)
|
||||
{
|
||||
// mapped is not constraint type so add mapped group explicitly
|
||||
if (findIndex(inGroups(), mappedPolyPatch::typeName) == -1)
|
||||
if (!inGroups().found(mappedPolyPatch::typeName))
|
||||
{
|
||||
inGroups().append(mappedPolyPatch::typeName);
|
||||
}
|
||||
|
||||
@ -319,7 +319,7 @@ bool Foam::meshTools::edgeOnCell
|
||||
const label edgeI
|
||||
)
|
||||
{
|
||||
return findIndex(mesh.edgeCells(edgeI), celli) != -1;
|
||||
return mesh.edgeCells(edgeI).found(celli);
|
||||
}
|
||||
|
||||
|
||||
@ -330,7 +330,7 @@ bool Foam::meshTools::edgeOnFace
|
||||
const label edgeI
|
||||
)
|
||||
{
|
||||
return findIndex(mesh.faceEdges(facei), edgeI) != -1;
|
||||
return mesh.faceEdges(facei).found(edgeI);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -75,7 +75,7 @@ bool Foam::localPointRegion::isDuplicate
|
||||
return false;
|
||||
}
|
||||
|
||||
label fp1 = findIndex(f1, f0[0]);
|
||||
label fp1 = f1.find(f0[0]);
|
||||
|
||||
if (fp1 == -1)
|
||||
{
|
||||
@ -160,7 +160,7 @@ void Foam::localPointRegion::countPointRegions
|
||||
if (iter != meshPointMap_.end())
|
||||
{
|
||||
labelList& regions = pointRegions[iter()];
|
||||
if (findIndex(regions, region) == -1)
|
||||
if (!regions.found(region))
|
||||
{
|
||||
label sz = regions.size();
|
||||
regions.setSize(sz+1);
|
||||
|
||||
@ -129,7 +129,7 @@ Foam::searchableSurfaces::searchableSurfaces(const label size)
|
||||
// // Get the dictionary for region iter.key()
|
||||
// const dictionary& regionDict = regionsDict.subDict(key);
|
||||
//
|
||||
// label index = findIndex(localNames, key);
|
||||
// label index = localNames.find(key);
|
||||
//
|
||||
// if (index == -1)
|
||||
// {
|
||||
@ -251,7 +251,7 @@ Foam::searchableSurfaces::searchableSurfaces
|
||||
// Get the dictionary for region iter.keyword()
|
||||
const dictionary& regionDict = regionsDict.subDict(key);
|
||||
|
||||
label index = findIndex(localNames, key);
|
||||
label index = localNames.find(key);
|
||||
|
||||
if (index == -1)
|
||||
{
|
||||
@ -285,7 +285,7 @@ Foam::label Foam::searchableSurfaces::findSurfaceID
|
||||
const word& wantedName
|
||||
) const
|
||||
{
|
||||
return findIndex(names_, wantedName);
|
||||
return names_.find(wantedName);
|
||||
}
|
||||
|
||||
|
||||
@ -295,9 +295,9 @@ Foam::label Foam::searchableSurfaces::findSurfaceRegionID
|
||||
const word& regionName
|
||||
) const
|
||||
{
|
||||
label surfaceIndex = findSurfaceID(surfaceName);
|
||||
const label surfaceIndex = findSurfaceID(surfaceName);
|
||||
|
||||
return findIndex(this->operator[](surfaceIndex).regions(), regionName);
|
||||
return this->operator[](surfaceIndex).regions().find(regionName);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -175,7 +175,7 @@ bool Foam::triSurfaceMesh::isSurfaceClosed() const
|
||||
forAll(pFaces, i)
|
||||
{
|
||||
const triSurface::FaceType& f = triSurface::operator[](pFaces[i]);
|
||||
label fp = findIndex(f, pointi);
|
||||
label fp = f.find(pointi);
|
||||
|
||||
// Something weird: if I expand the code of addFaceToEdge in both
|
||||
// below instances it gives a segmentation violation on some
|
||||
|
||||
@ -212,7 +212,7 @@ bool Foam::intersectedSurface::sameEdgeOrder
|
||||
{
|
||||
forAll(fA, fpA)
|
||||
{
|
||||
label fpB = findIndex(fB, fA[fpA]);
|
||||
label fpB = fB.find(fA[fpA]);
|
||||
|
||||
if (fpB != -1)
|
||||
{
|
||||
|
||||
@ -392,7 +392,7 @@ Foam::surfaceFeatures::labelScalar Foam::surfaceFeatures::walkSegment
|
||||
|
||||
label nVisited = 0;
|
||||
|
||||
if (findIndex(featurePoints_, startPointi) >= 0)
|
||||
if (featurePoints_.found(startPointi))
|
||||
{
|
||||
// Do not walk across feature points
|
||||
|
||||
@ -623,7 +623,7 @@ Foam::surfaceFeatures::surfaceFeatures::checkFlatRegionEdge
|
||||
|
||||
regionAndNormal1[i] = myRegionAndNormal;
|
||||
|
||||
label index = findIndex(regionAndNormal, -myRegionAndNormal);
|
||||
label index = regionAndNormal.find(-myRegionAndNormal);
|
||||
if (index == -1)
|
||||
{
|
||||
// Not found.
|
||||
|
||||
@ -205,7 +205,7 @@ void Foam::triSurfaceRegionSearch::findNearest
|
||||
|
||||
forAll(octrees, treeI)
|
||||
{
|
||||
if (findIndex(regionIndices, treeI) == -1)
|
||||
if (!regionIndices.found(treeI))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -45,7 +45,7 @@ Foam::scalar Foam::triSurfaceTools::vertexNormalWeight
|
||||
const UList<point>& points
|
||||
)
|
||||
{
|
||||
label index = findIndex(f, pI);
|
||||
label index = f.find(pI);
|
||||
|
||||
if (index == -1)
|
||||
{
|
||||
|
||||
@ -101,7 +101,7 @@ void Foam::triSurfaceTools::greenRefine
|
||||
|
||||
// Find index of edge in face.
|
||||
|
||||
label fp0 = findIndex(f, e[0]);
|
||||
label fp0 = f.find(e[0]);
|
||||
label fp1 = f.fcIndex(fp0);
|
||||
label fp2 = f.fcIndex(fp1);
|
||||
|
||||
@ -881,7 +881,7 @@ Foam::surfaceLocation Foam::triSurfaceTools::cutEdge
|
||||
{
|
||||
// Excluded point. Test only opposite edge.
|
||||
|
||||
label fp0 = findIndex(s.localFaces()[triI], excludePointi);
|
||||
label fp0 = s.localFaces()[triI].find(excludePointi);
|
||||
|
||||
if (fp0 == -1)
|
||||
{
|
||||
@ -1062,7 +1062,7 @@ void Foam::triSurfaceTools::snapToEnd
|
||||
// endpoint on edge; current on triangle
|
||||
const labelList& fEdges = s.faceEdges()[current.index()];
|
||||
|
||||
if (findIndex(fEdges, end.index()) != -1)
|
||||
if (fEdges.found(end.index()))
|
||||
{
|
||||
//if (debug)
|
||||
//{
|
||||
@ -1111,7 +1111,7 @@ void Foam::triSurfaceTools::snapToEnd
|
||||
// endpoint on point; current on triangle
|
||||
const triSurface::FaceType& f = s.localFaces()[current.index()];
|
||||
|
||||
if (findIndex(f, end.index()) != -1)
|
||||
if (f.found(end.index()))
|
||||
{
|
||||
//if (debug)
|
||||
//{
|
||||
@ -1415,7 +1415,7 @@ void Foam::triSurfaceTools::otherEdges
|
||||
{
|
||||
const labelList& eFaces = surf.faceEdges()[facei];
|
||||
|
||||
label i0 = findIndex(eFaces, edgeI);
|
||||
label i0 = eFaces.find(edgeI);
|
||||
|
||||
if (i0 == -1)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user