polyBoundaryMesh::findPatchID,findPatchIDs: renamed findIndex,findIndices

Index is a better name to describe a label index than ID which may be an
integer, word or other means of identification.
This commit is contained in:
Henry Weller
2023-12-16 13:27:12 +00:00
parent cad6a99777
commit 621740e90b
57 changed files with 100 additions and 109 deletions

View File

@ -513,7 +513,7 @@ void createBaffles
// Wrapper around find patch. Also makes sure same patch in parallel.
label findPatch(const polyBoundaryMesh& patches, const word& patchName)
{
label patchi = patches.findPatchID(patchName);
label patchi = patches.findIndex(patchName);
if (patchi == -1)
{

View File

@ -193,7 +193,7 @@ scalar getEdgeStats(const primitiveMesh& mesh, const direction excludeCmpt)
// Adds empty patch if not yet there. Returns patchID.
label addPatch(polyMesh& mesh, const word& patchName)
{
label patchi = mesh.boundaryMesh().findPatchID(patchName);
label patchi = mesh.boundaryMesh().findIndex(patchName);
if (patchi == -1)
{

View File

@ -1099,7 +1099,7 @@ int main(int argc, char *argv[])
}
// Remove empty defaultFaces
label defaultPatchID = mesh.boundaryMesh().findPatchID(defaultFacesName);
label defaultPatchID = mesh.boundaryMesh().findIndex(defaultFacesName);
if (mesh.boundaryMesh()[defaultPatchID].size() == 0)
{
List<polyPatch*> newPatchPtrList((mesh.boundaryMesh().size() - 1));

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -111,8 +111,8 @@ void Foam::extrude2DMesh::addFrontBackPatches()
{
const polyBoundaryMesh& patches = mesh_.boundaryMesh();
frontPatchi_ = patches.findPatchID("front");
backPatchi_ = patches.findPatchID("back");
frontPatchi_ = patches.findIndex("front");
backPatchi_ = patches.findIndex("back");
// Add patch.
List<polyPatch*> newPatches(patches.size() + 2);

View File

@ -80,9 +80,9 @@ namespace Foam
static const NamedEnum<ExtrudeMode, 3> ExtrudeModeNames;
label findPatchID(const polyBoundaryMesh& patches, const word& name)
label findIndex(const polyBoundaryMesh& patches, const word& name)
{
const label patchID = patches.findPatchID(name);
const label patchID = patches.findIndex(name);
if (patchID == -1)
{
@ -102,7 +102,7 @@ labelList patchFaces(const polyBoundaryMesh& patches, const wordList& names)
forAll(names, i)
{
const polyPatch& pp = patches[findPatchID(patches, names[i])];
const polyPatch& pp = patches[findIndex(patches, names[i])];
n += pp.size();
}
@ -110,7 +110,7 @@ labelList patchFaces(const polyBoundaryMesh& patches, const wordList& names)
n = 0;
forAll(names, i)
{
const polyPatch& pp = patches[findPatchID(patches, names[i])];
const polyPatch& pp = patches[findIndex(patches, names[i])];
forAll(pp, j)
{
@ -172,8 +172,8 @@ void changeFrontBackPatches
{
const polyBoundaryMesh& patches = mesh.boundaryMesh();
label frontPatchi = findPatchID(patches, frontPatchName);
label backPatchi = findPatchID(patches, backPatchName);
label frontPatchi = findIndex(patches, frontPatchName);
label backPatchi = findIndex(patches, backPatchName);
DynamicList<polyPatch*> newPatches(patches.size());
@ -498,7 +498,7 @@ int main(int argc, char *argv[])
exposedPatchID.setSize
(
extrudePatch.size(),
findPatchID(patches, backPatchName)
findIndex(patches, backPatchName)
);
}

View File

@ -133,7 +133,7 @@ using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
label findPatchID(const List<polyPatch*>& newPatches, const word& name)
label findIndex(const List<polyPatch*>& newPatches, const word& name)
{
forAll(newPatches, i)
{
@ -155,7 +155,7 @@ label addPatch
DynamicList<polyPatch*>& newPatches
)
{
label patchi = findPatchID(newPatches, patchName);
label patchi = findIndex(newPatches, patchName);
if (patchi != -1)
{
@ -221,7 +221,7 @@ void deleteEmptyPatches(fvMesh& mesh)
// Add all the non-empty, non-processor patches
forAll(masterNames, masterI)
{
label patchi = patches.findPatchID(masterNames[masterI]);
label patchi = patches.findIndex(masterNames[masterI]);
if (patchi != -1)
{
@ -976,7 +976,7 @@ labelList addExtrudeEdgeSidePatches
{
const polyBoundaryMesh& patches = mesh.boundaryMesh();
const label newPatchi = findPatchID
const label newPatchi = findIndex
(
newPatches,
patches[patches.whichPatch(facei)].name()
@ -997,7 +997,7 @@ labelList addExtrudeEdgeSidePatches
const word name =
processorPolyPatch::newName(Pstream::myProcNo(), nbrProci);
extrudeEdgeSidePatches[edgeI] = findPatchID(newPatches, name);
extrudeEdgeSidePatches[edgeI] = findIndex(newPatches, name);
if (extrudeEdgeSidePatches[edgeI] == -1)
{
@ -1661,7 +1661,7 @@ int main(int argc, char *argv[])
if (facei != -1)
{
const label newPatchi =
findPatchID
findIndex
(
regionPatches,
mesh.boundaryMesh()

View File

@ -409,7 +409,7 @@ void extractSurface
labelList patchToCompactZone(bMesh.size(), -1);
forAllConstIter(HashTable<label>, compactZoneID, iter)
{
label patchi = bMesh.findPatchID(iter.key());
label patchi = bMesh.findIndex(iter.key());
if (patchi != -1)
{
patchToCompactZone[patchi] = iter();

View File

@ -140,7 +140,7 @@ int main(int argc, char *argv[])
{
patchName = "auto" + name(suffix++);
}
while (rMesh.findPatchID(patchName) != -1);
while (rMesh.findIndex(patchName) != -1);
rMesh.addPatch(patchName);

View File

@ -528,7 +528,7 @@ int main(int argc, char *argv[])
const word patchName(patchDict.lookup<word>("name"));
if (bMesh.findPatchID(patchName) == -1)
if (bMesh.findIndex(patchName) == -1)
{
Info<< "Adding patch '" << patchName << "' to the mesh" << endl;
@ -626,7 +626,7 @@ int main(int argc, char *argv[])
const word patchName(patchDict.lookup<word>("name"));
newPatchIDs[i] = bMesh.findPatchID(patchName);
newPatchIDs[i] = bMesh.findIndex(patchName);
}
const label nModified =
@ -698,7 +698,7 @@ int main(int argc, char *argv[])
fvMeshTools::setPatchFields
(
mesh,
bMesh.findPatchID(patchName),
bMesh.findIndex(patchName),
patchFieldsDict
);
}

View File

@ -545,7 +545,7 @@ int main(int argc, char *argv[])
word patchName(dict.lookup("name"));
label destPatchi = patches.findPatchID(patchName);
label destPatchi = patches.findIndex(patchName);
if (destPatchi == -1)
{
@ -620,7 +620,7 @@ int main(int argc, char *argv[])
const dictionary& dict = patchSources[addedI];
const word patchName(dict.lookup("name"));
label destPatchi = patches.findPatchID(patchName);
label destPatchi = patches.findIndex(patchName);
if (destPatchi == -1)
{

View File

@ -175,7 +175,7 @@ label addCellZone(const polyMesh& mesh, const word& name)
// Checks whether patch present
void checkPatch(const polyBoundaryMesh& bMesh, const word& name)
{
const label patchi = bMesh.findPatchID(name);
const label patchi = bMesh.findIndex(name);
if (patchi == -1)
{

View File

@ -253,7 +253,7 @@ int main(int argc, char *argv[])
{
const word patchName = args["patch"];
patchi = mesh.boundaryMesh().findPatchID(patchName);
patchi = mesh.boundaryMesh().findIndex(patchName);
if (patchi == -1)
{