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

@ -42,7 +42,7 @@ activeBaffleVelocityFvPatchVectorField
fixedValueFvPatchVectorField(p, iF, dict, false), fixedValueFvPatchVectorField(p, iF, dict, false),
pName_(dict.lookupOrDefault<word>("p", "p")), pName_(dict.lookupOrDefault<word>("p", "p")),
cyclicPatchName_(dict.lookup("cyclicPatch")), cyclicPatchName_(dict.lookup("cyclicPatch")),
cyclicPatchLabel_(p.patch().boundaryMesh().findPatchID(cyclicPatchName_)), cyclicPatchLabel_(p.patch().boundaryMesh().findIndex(cyclicPatchName_)),
orientation_(dict.lookup<label>("orientation")), orientation_(dict.lookup<label>("orientation")),
initWallSf_(p.Sf()), initWallSf_(p.Sf()),
initCyclicSf_(p.boundaryMesh()[cyclicPatchLabel_].Sf()), initCyclicSf_(p.boundaryMesh()[cyclicPatchLabel_].Sf()),

View File

@ -42,7 +42,7 @@ activePressureForceBaffleVelocityFvPatchVectorField
fixedValueFvPatchVectorField(p, iF, dict, false), fixedValueFvPatchVectorField(p, iF, dict, false),
pName_(dict.lookupOrDefault<word>("p", "p")), pName_(dict.lookupOrDefault<word>("p", "p")),
cyclicPatchName_(dict.lookup("cyclicPatch")), cyclicPatchName_(dict.lookup("cyclicPatch")),
cyclicPatchLabel_(p.patch().boundaryMesh().findPatchID(cyclicPatchName_)), cyclicPatchLabel_(p.patch().boundaryMesh().findIndex(cyclicPatchName_)),
orientation_(dict.lookup<label>("orientation")), orientation_(dict.lookup<label>("orientation")),
initWallSf_(0), initWallSf_(0),
initCyclicSf_(0), initCyclicSf_(0),

View File

@ -60,7 +60,7 @@ Foam::fv::VoFFilmTransfer::VoFFilmTransfer
fvModel(sourceName, modelType, mesh, dict), fvModel(sourceName, modelType, mesh, dict),
VoF_(mesh.lookupObject<solvers::compressibleVoF>(solver::typeName)), VoF_(mesh.lookupObject<solvers::compressibleVoF>(solver::typeName)),
filmPatchName_(dict.lookup("filmPatch")), filmPatchName_(dict.lookup("filmPatch")),
filmPatchi_(mesh.boundaryMesh().findPatchID(filmPatchName_)), filmPatchi_(mesh.boundaryMesh().findIndex(filmPatchName_)),
phaseName_(dict.lookup("phase")), phaseName_(dict.lookup("phase")),
thermo_ thermo_
( (

View File

@ -208,7 +208,7 @@ int main(int argc, char *argv[])
#include "createMesh.H" #include "createMesh.H"
const word patchName = args[1]; const word patchName = args[1];
label patchi = mesh.boundaryMesh().findPatchID(patchName); label patchi = mesh.boundaryMesh().findIndex(patchName);
const polyPatch& pp = mesh.boundaryMesh()[patchi]; const polyPatch& pp = mesh.boundaryMesh()[patchi];
const indirectPrimitivePatch& cpp = mesh.globalData().coupledPatch(); const indirectPrimitivePatch& cpp = mesh.globalData().coupledPatch();

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2013-2022 OpenFOAM Foundation \\ / A nd | Copyright (C) 2013-2023 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -59,7 +59,7 @@ int main(int argc, char *argv[])
const polyBoundaryMesh& pbm = mesh.boundaryMesh(); const polyBoundaryMesh& pbm = mesh.boundaryMesh();
label patchi = pbm.findPatchID(patchName); label patchi = pbm.findIndex(patchName);
const polyPatch& patch = pbm[patchi]; const polyPatch& patch = pbm[patchi];
Info<< "Patch:" << patch.name() << endl; Info<< "Patch:" << patch.name() << endl;

View File

@ -513,7 +513,7 @@ void createBaffles
// Wrapper around find patch. Also makes sure same patch in parallel. // Wrapper around find patch. Also makes sure same patch in parallel.
label findPatch(const polyBoundaryMesh& patches, const word& patchName) label findPatch(const polyBoundaryMesh& patches, const word& patchName)
{ {
label patchi = patches.findPatchID(patchName); label patchi = patches.findIndex(patchName);
if (patchi == -1) 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. // Adds empty patch if not yet there. Returns patchID.
label addPatch(polyMesh& mesh, const word& patchName) label addPatch(polyMesh& mesh, const word& patchName)
{ {
label patchi = mesh.boundaryMesh().findPatchID(patchName); label patchi = mesh.boundaryMesh().findIndex(patchName);
if (patchi == -1) if (patchi == -1)
{ {

View File

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

View File

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

View File

@ -80,9 +80,9 @@ namespace Foam
static const NamedEnum<ExtrudeMode, 3> ExtrudeModeNames; 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) if (patchID == -1)
{ {
@ -102,7 +102,7 @@ labelList patchFaces(const polyBoundaryMesh& patches, const wordList& names)
forAll(names, i) forAll(names, i)
{ {
const polyPatch& pp = patches[findPatchID(patches, names[i])]; const polyPatch& pp = patches[findIndex(patches, names[i])];
n += pp.size(); n += pp.size();
} }
@ -110,7 +110,7 @@ labelList patchFaces(const polyBoundaryMesh& patches, const wordList& names)
n = 0; n = 0;
forAll(names, i) forAll(names, i)
{ {
const polyPatch& pp = patches[findPatchID(patches, names[i])]; const polyPatch& pp = patches[findIndex(patches, names[i])];
forAll(pp, j) forAll(pp, j)
{ {
@ -172,8 +172,8 @@ void changeFrontBackPatches
{ {
const polyBoundaryMesh& patches = mesh.boundaryMesh(); const polyBoundaryMesh& patches = mesh.boundaryMesh();
label frontPatchi = findPatchID(patches, frontPatchName); label frontPatchi = findIndex(patches, frontPatchName);
label backPatchi = findPatchID(patches, backPatchName); label backPatchi = findIndex(patches, backPatchName);
DynamicList<polyPatch*> newPatches(patches.size()); DynamicList<polyPatch*> newPatches(patches.size());
@ -498,7 +498,7 @@ int main(int argc, char *argv[])
exposedPatchID.setSize exposedPatchID.setSize
( (
extrudePatch.size(), 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) forAll(newPatches, i)
{ {
@ -155,7 +155,7 @@ label addPatch
DynamicList<polyPatch*>& newPatches DynamicList<polyPatch*>& newPatches
) )
{ {
label patchi = findPatchID(newPatches, patchName); label patchi = findIndex(newPatches, patchName);
if (patchi != -1) if (patchi != -1)
{ {
@ -221,7 +221,7 @@ void deleteEmptyPatches(fvMesh& mesh)
// Add all the non-empty, non-processor patches // Add all the non-empty, non-processor patches
forAll(masterNames, masterI) forAll(masterNames, masterI)
{ {
label patchi = patches.findPatchID(masterNames[masterI]); label patchi = patches.findIndex(masterNames[masterI]);
if (patchi != -1) if (patchi != -1)
{ {
@ -976,7 +976,7 @@ labelList addExtrudeEdgeSidePatches
{ {
const polyBoundaryMesh& patches = mesh.boundaryMesh(); const polyBoundaryMesh& patches = mesh.boundaryMesh();
const label newPatchi = findPatchID const label newPatchi = findIndex
( (
newPatches, newPatches,
patches[patches.whichPatch(facei)].name() patches[patches.whichPatch(facei)].name()
@ -997,7 +997,7 @@ labelList addExtrudeEdgeSidePatches
const word name = const word name =
processorPolyPatch::newName(Pstream::myProcNo(), nbrProci); processorPolyPatch::newName(Pstream::myProcNo(), nbrProci);
extrudeEdgeSidePatches[edgeI] = findPatchID(newPatches, name); extrudeEdgeSidePatches[edgeI] = findIndex(newPatches, name);
if (extrudeEdgeSidePatches[edgeI] == -1) if (extrudeEdgeSidePatches[edgeI] == -1)
{ {
@ -1661,7 +1661,7 @@ int main(int argc, char *argv[])
if (facei != -1) if (facei != -1)
{ {
const label newPatchi = const label newPatchi =
findPatchID findIndex
( (
regionPatches, regionPatches,
mesh.boundaryMesh() mesh.boundaryMesh()

View File

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

View File

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

View File

@ -528,7 +528,7 @@ int main(int argc, char *argv[])
const word patchName(patchDict.lookup<word>("name")); 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; 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")); const word patchName(patchDict.lookup<word>("name"));
newPatchIDs[i] = bMesh.findPatchID(patchName); newPatchIDs[i] = bMesh.findIndex(patchName);
} }
const label nModified = const label nModified =
@ -698,7 +698,7 @@ int main(int argc, char *argv[])
fvMeshTools::setPatchFields fvMeshTools::setPatchFields
( (
mesh, mesh,
bMesh.findPatchID(patchName), bMesh.findIndex(patchName),
patchFieldsDict patchFieldsDict
); );
} }

View File

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

View File

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

View File

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

View File

@ -113,7 +113,7 @@ void Foam::vtkPVFoam::convertPointFields
{ {
const word patchName = getPartName(partId); const word patchName = getPartName(partId);
const label datasetNo = partDataset_[partId]; const label datasetNo = partDataset_[partId];
const label patchId = patches.findPatchID(patchName); const label patchId = patches.findIndex(patchName);
if (!partStatus_[partId] || datasetNo < 0 || patchId < 0) if (!partStatus_[partId] || datasetNo < 0 || patchId < 0)
{ {

View File

@ -221,7 +221,7 @@ void Foam::vtkPVFoam::convertSurfaceFields
{ {
const word patchName = getPartName(partId); const word patchName = getPartName(partId);
const label datasetNo = partDataset_[partId]; const label datasetNo = partDataset_[partId];
const label patchId = mesh.boundaryMesh().findPatchID(patchName); const label patchId = mesh.boundaryMesh().findIndex(patchName);
if (!partStatus_[partId] || datasetNo < 0 || patchId < 0) if (!partStatus_[partId] || datasetNo < 0 || patchId < 0)
{ {

View File

@ -129,7 +129,7 @@ void Foam::vtkPVFoam::convertVolFields
{ {
const word patchName = getPartName(partId); const word patchName = getPartName(partId);
const label datasetNo = partDataset_[partId]; const label datasetNo = partDataset_[partId];
const label patchId = patches.findPatchID(patchName); const label patchId = patches.findIndex(patchName);
if (!partStatus_[partId] || datasetNo < 0 || patchId < 0) if (!partStatus_[partId] || datasetNo < 0 || patchId < 0)
{ {

View File

@ -230,7 +230,7 @@ int main(int argc, char *argv[])
labelList faceZoneToCompactZone(bMesh.size(), -1); labelList faceZoneToCompactZone(bMesh.size(), -1);
forAllConstIter(HashTable<label>, compactZoneID, iter) forAllConstIter(HashTable<label>, compactZoneID, iter)
{ {
label patchi = bMesh.findPatchID(iter.key()); label patchi = bMesh.findIndex(iter.key());
if (patchi != -1) if (patchi != -1)
{ {
patchToCompactZone[patchi] = iter(); patchToCompactZone[patchi] = iter();

View File

@ -46,7 +46,7 @@ using namespace Foam;
// Adds empty patch if not yet there. Returns patchID. // Adds empty patch if not yet there. Returns patchID.
label addPatch(polyMesh& mesh, const word& patchName) label addPatch(polyMesh& mesh, const word& patchName)
{ {
label patchi = mesh.boundaryMesh().findPatchID(patchName); label patchi = mesh.boundaryMesh().findIndex(patchName);
if (patchi == -1) if (patchi == -1)
{ {

View File

@ -90,7 +90,7 @@ void Foam::LESModels::vanDriestDelta::calcDelta()
fvPatchDistWave::calculateAndCorrect<WallLocationYPlus> fvPatchDistWave::calculateAndCorrect<WallLocationYPlus>
( (
mesh, mesh,
mesh.boundaryMesh().findPatchIDs<wallPolyPatch>(), mesh.boundaryMesh().findIndices<wallPolyPatch>(),
minWallFaceFraction_, minWallFaceFraction_,
2, // <-- roughly equivalent to old point-cell corrections 2, // <-- roughly equivalent to old point-cell corrections
y, y,

View File

@ -58,7 +58,7 @@ void Foam::GeometricBoundaryField<Type, PatchField, GeoMesh>::readField
{ {
if (iter().isDict() && !iter().keyword().isPattern()) if (iter().isDict() && !iter().keyword().isPattern())
{ {
label patchi = bmesh_.findPatchID(iter().keyword()); label patchi = bmesh_.findIndex(iter().keyword());
if (patchi != -1) if (patchi != -1)
{ {

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -60,9 +60,9 @@ Foam::pointBoundaryMesh::pointBoundaryMesh
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::label Foam::pointBoundaryMesh::findPatchID(const word& patchName) const Foam::label Foam::pointBoundaryMesh::findIndex(const word& patchName) const
{ {
return mesh()().boundaryMesh().findPatchID(patchName); return mesh()().boundaryMesh().findIndex(patchName);
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -94,7 +94,7 @@ public:
} }
//- Find patch index given a name //- Find patch index given a name
label findPatchID(const word& patchName) const; label findIndex(const word& patchName) const;
//- Find patch indices given a name //- Find patch indices given a name
labelList findIndices(const wordRe&, const bool useGroups) const; labelList findIndices(const wordRe&, const bool useGroups) const;

View File

@ -684,7 +684,7 @@ Foam::labelList Foam::polyBoundaryMesh::findIndices
} }
Foam::label Foam::polyBoundaryMesh::findPatchID(const word& patchName) const Foam::label Foam::polyBoundaryMesh::findIndex(const word& patchName) const
{ {
const polyPatchList& patches = *this; const polyPatchList& patches = *this;
@ -699,7 +699,7 @@ Foam::label Foam::polyBoundaryMesh::findPatchID(const word& patchName) const
// Patch not found // Patch not found
if (debug) if (debug)
{ {
Pout<< "label polyBoundaryMesh::findPatchID(const word&) const" Pout<< "label polyBoundaryMesh::findIndex(const word&) const"
<< "Patch named " << patchName << " not found. " << "Patch named " << patchName << " not found. "
<< "List of available patch names: " << names() << endl; << "List of available patch names: " << names() << endl;
} }
@ -1196,7 +1196,7 @@ const Foam::polyPatch& Foam::polyBoundaryMesh::operator[]
const word& patchName const word& patchName
) const ) const
{ {
const label patchi = findPatchID(patchName); const label patchi = findIndex(patchName);
if (patchi < 0) if (patchi < 0)
{ {
@ -1215,7 +1215,7 @@ Foam::polyPatch& Foam::polyBoundaryMesh::operator[]
const word& patchName const word& patchName
) )
{ {
const label patchi = findPatchID(patchName); const label patchi = findIndex(patchName);
if (patchi < 0) if (patchi < 0)
{ {

View File

@ -169,21 +169,12 @@ public:
const bool usePatchGroups = true const bool usePatchGroups = true
) const; ) const;
//- Return patch index for the first match, return -1 if not found
label findIndex(const wordRe&) const = delete;
//- Find patch index given a name //- Find patch index given a name
label findIndex(const word& patchName) const label findIndex(const word& patchName) const;
{
return findPatchID(patchName);
}
//- Find patch index given a name
label findPatchID(const word& patchName) const;
//- Find patch indices for a given polyPatch type //- Find patch indices for a given polyPatch type
template<class Type> template<class Type>
labelHashSet findPatchIDs() const; labelHashSet findIndices() const;
//- Return patch index for a given face label //- Return patch index for a given face label
label whichPatch(const label faceIndex) const; label whichPatch(const label faceIndex) const;

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2013-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2013-2023 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -26,7 +26,7 @@ License
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type> template<class Type>
Foam::labelHashSet Foam::polyBoundaryMesh::findPatchIDs() const Foam::labelHashSet Foam::polyBoundaryMesh::findIndices() const
{ {
const polyBoundaryMesh& bm = *this; const polyBoundaryMesh& bm = *this;

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -309,7 +309,7 @@ Foam::label Foam::cyclicPolyPatch::nbrPatchID() const
{ {
if (nbrPatchID_ == -1) if (nbrPatchID_ == -1)
{ {
nbrPatchID_ = this->boundaryMesh().findPatchID(nbrPatchName()); nbrPatchID_ = this->boundaryMesh().findIndex(nbrPatchName());
if (nbrPatchID_ == -1) if (nbrPatchID_ == -1)
{ {

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -234,7 +234,7 @@ public:
{ {
if (referPatchID_ == -1) if (referPatchID_ == -1)
{ {
referPatchID_ = this->boundaryMesh().findPatchID referPatchID_ = this->boundaryMesh().findIndex
( (
referPatchName_ referPatchName_
); );

View File

@ -38,7 +38,7 @@ void Foam::flowRateInletVelocityFvPatchVectorField::setWallDist()
{ {
const labelHashSet otherPatchIDs const labelHashSet otherPatchIDs
( (
patch().patch().boundaryMesh().findPatchIDs<wallPolyPatch>() patch().patch().boundaryMesh().findIndices<wallPolyPatch>()
); );
const patchPatchDist pwd(patch().patch(), otherPatchIDs); const patchPatchDist pwd(patch().patch(), otherPatchIDs);

View File

@ -170,7 +170,7 @@ void Foam::matchedFlowRateOutletVelocityFvPatchVectorField::updateCoeffs()
// Find corresponding inlet patch // Find corresponding inlet patch
const label inletPatchID = const label inletPatchID =
patch().patch().boundaryMesh().findPatchID(inletPatchName_); patch().patch().boundaryMesh().findIndex(inletPatchName_);
if (inletPatchID < 0) if (inletPatchID < 0)
{ {

View File

@ -94,7 +94,7 @@ void Foam::outletMappedUniformInletFvPatchField<Type>::updateCoeffs()
const fvPatch& p = this->patch(); const fvPatch& p = this->patch();
label outletPatchID = label outletPatchID =
p.patch().boundaryMesh().findPatchID(outletPatchName_); p.patch().boundaryMesh().findIndex(outletPatchName_);
if (outletPatchID < 0) if (outletPatchID < 0)
{ {

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -70,7 +70,7 @@ Foam::fvBoundaryMesh::fvBoundaryMesh
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::label Foam::fvBoundaryMesh::findPatchID(const word& patchName) const Foam::label Foam::fvBoundaryMesh::findIndex(const word& patchName) const
{ {
const fvPatchList& patches = *this; const fvPatchList& patches = *this;
@ -158,7 +158,7 @@ const Foam::fvPatch& Foam::fvBoundaryMesh::operator[]
const word& patchName const word& patchName
) const ) const
{ {
const label patchi = findPatchID(patchName); const label patchi = findIndex(patchName);
if (patchi < 0) if (patchi < 0)
{ {
@ -176,7 +176,7 @@ Foam::fvPatch& Foam::fvBoundaryMesh::operator[]
const word& patchName const word& patchName
) )
{ {
const label patchi = findPatchID(patchName); const label patchi = findIndex(patchName);
if (patchi < 0) if (patchi < 0)
{ {

View File

@ -107,7 +107,7 @@ public:
lduInterfacePtrsList interfaces() const; lduInterfacePtrsList interfaces() const;
//- Find patch index given a name //- Find patch index given a name
label findPatchID(const word& patchName) const; label findIndex(const word& patchName) const;
//- Find patch indices given a name //- Find patch indices given a name
labelList findIndices(const wordRe&, const bool useGroups) const; labelList findIndices(const wordRe&, const bool useGroups) const;

View File

@ -57,7 +57,7 @@ Foam::nearWallDist::nearWallDist(const Foam::fvMesh& mesh)
fvPatchDistWave::correct fvPatchDistWave::correct
( (
mesh, mesh,
mesh.boundaryMesh().findPatchIDs<wallPolyPatch>(), mesh.boundaryMesh().findIndices<wallPolyPatch>(),
-vGreat, -vGreat,
2, 2,
yVf yVf

View File

@ -68,7 +68,7 @@ void Foam::wallDist::constructn() const
Foam::wallDist::wallDist(const fvMesh& mesh, const word& patchTypeName) Foam::wallDist::wallDist(const fvMesh& mesh, const word& patchTypeName)
: :
DemandDrivenMeshObject<fvMesh, DeletableMeshObject, wallDist>(mesh), DemandDrivenMeshObject<fvMesh, DeletableMeshObject, wallDist>(mesh),
patchIDs_(mesh.boundaryMesh().findPatchIDs<wallPolyPatch>()), patchIDs_(mesh.boundaryMesh().findIndices<wallPolyPatch>()),
patchTypeName_(patchTypeName), patchTypeName_(patchTypeName),
pdm_ pdm_
( (

View File

@ -174,7 +174,7 @@ void Foam::functionObjects::fieldValues::surfaceFieldValue::setFaceZoneFaces()
void Foam::functionObjects::fieldValues::surfaceFieldValue::setPatchFaces() void Foam::functionObjects::fieldValues::surfaceFieldValue::setPatchFaces()
{ {
const label patchId = mesh_.boundaryMesh().findPatchID(selectionName_); const label patchId = mesh_.boundaryMesh().findIndex(selectionName_);
if (patchId < 0) if (patchId < 0)
{ {

View File

@ -52,7 +52,7 @@ void Foam::fv::patchMeanVelocityForce::readCoeffs()
{ {
patch_ = coeffs().lookup<word>("patch"); patch_ = coeffs().lookup<word>("patch");
if (mesh().boundaryMesh().findPatchID(patch_) < 0) if (mesh().boundaryMesh().findIndex(patch_) < 0)
{ {
FatalErrorInFunction FatalErrorInFunction
<< "Cannot find patch " << patch_ << "Cannot find patch " << patch_
@ -85,7 +85,7 @@ Foam::scalar Foam::fv::patchMeanVelocityForce::magUbarAve
const volVectorField& U const volVectorField& U
) const ) const
{ {
const label patchi = mesh().boundaryMesh().findPatchID(patch_); const label patchi = mesh().boundaryMesh().findIndex(patch_);
scalar sumA = sum(mesh().boundary()[patchi].magSf()); scalar sumA = sum(mesh().boundary()[patchi].magSf());
scalar sumAmagU = scalar sumAmagU =

View File

@ -41,7 +41,7 @@ Foam::patchInjectionBase::patchInjectionBase
) )
: :
patchName_(patchName), patchName_(patchName),
patchId_(mesh.boundaryMesh().findPatchID(patchName_)), patchId_(mesh.boundaryMesh().findIndex(patchName_)),
sumProcArea_(), sumProcArea_(),
sumFaceArea_(), sumFaceArea_(),
sumFaceTriArea_() sumFaceTriArea_()

View File

@ -568,7 +568,7 @@ Foam::polyMesh* Foam::blockMesh::createTopology
if if
( (
!defaultPatchTypeSet !defaultPatchTypeSet
&& blockMeshPtr->boundaryMesh().findPatchID(defaultPatchName) != -1 && blockMeshPtr->boundaryMesh().findIndex(defaultPatchName) != -1
) )
{ {
defaultPatchError(defaultPatchName, meshDescription); defaultPatchError(defaultPatchName, meshDescription);
@ -616,7 +616,7 @@ Foam::polyMesh* Foam::blockMesh::createTopology
if if
( (
!defaultPatchTypeSet !defaultPatchTypeSet
&& blockMeshPtr->boundaryMesh().findPatchID(defaultPatchName) != -1 && blockMeshPtr->boundaryMesh().findIndex(defaultPatchName) != -1
) )
{ {
defaultPatchError(defaultPatchName, meshDescription); defaultPatchError(defaultPatchName, meshDescription);

View File

@ -1993,13 +1993,13 @@ Foam::label Foam::meshRefinement::addMeshedPatch
if (meshedI != -1) if (meshedI != -1)
{ {
// Already there. Get corresponding polypatch // Already there. Get corresponding polypatch
return pbm.findPatchID(name); return pbm.findIndex(name);
} }
else else
{ {
// Add patch // Add patch
label patchi = pbm.findPatchID(name); label patchi = pbm.findIndex(name);
if (patchi == -1) if (patchi == -1)
{ {
patchi = pbm.size(); patchi = pbm.size();
@ -2052,7 +2052,7 @@ Foam::labelList Foam::meshRefinement::meshedPatches() const
DynamicList<label> patchIDs(meshedPatches_.size()); DynamicList<label> patchIDs(meshedPatches_.size());
forAll(meshedPatches_, i) forAll(meshedPatches_, i)
{ {
label patchi = patches.findPatchID(meshedPatches_[i]); label patchi = patches.findIndex(meshedPatches_[i]);
if (patchi == -1) if (patchi == -1)
{ {

View File

@ -478,7 +478,7 @@ const Foam::polyPatch& Foam::mappedPatchBase::nbrPolyPatch() const
{ {
const polyMesh& nbrMesh = this->nbrMesh(); const polyMesh& nbrMesh = this->nbrMesh();
const label patchi = nbrMesh.boundaryMesh().findPatchID(nbrPatchName()); const label patchi = nbrMesh.boundaryMesh().findIndex(nbrPatchName());
if (patchi == -1) if (patchi == -1)
{ {

View File

@ -81,7 +81,7 @@ Foam::meshToMesh::meshToMesh
) )
{ {
const label tgtPatchi = const label tgtPatchi =
tgtMesh_.boundaryMesh().findPatchID(srcPp.name()); tgtMesh_.boundaryMesh().findIndex(srcPp.name());
if (tgtPatchi == -1) if (tgtPatchi == -1)
{ {
@ -111,9 +111,9 @@ Foam::meshToMesh::meshToMesh
const word& srcPatchName = iter(); const word& srcPatchName = iter();
const label srcPatchi = const label srcPatchi =
srcMesh_.boundaryMesh().findPatchID(srcPatchName); srcMesh_.boundaryMesh().findIndex(srcPatchName);
const label tgtPatchi = const label tgtPatchi =
tgtMesh_.boundaryMesh().findPatchID(tgtPatchName); tgtMesh_.boundaryMesh().findIndex(tgtPatchName);
if (srcPatchi == -1) if (srcPatchi == -1)
{ {

View File

@ -153,7 +153,7 @@ Foam::label Foam::nonConformalPolyPatch::origPatchID() const
{ {
if (origPatchID_ == -1) if (origPatchID_ == -1)
{ {
origPatchID_ = patch_.boundaryMesh().findPatchID(origPatchName()); origPatchID_ = patch_.boundaryMesh().findIndex(origPatchName());
if (origPatchID_ == -1) if (origPatchID_ == -1)
{ {

View File

@ -258,7 +258,7 @@ Foam::displacementLayeredMotionMotionSolver::faceZoneEvaluate
// Reads name of name of patch. Then get average point displacement on // Reads name of name of patch. Then get average point displacement on
// patch. That becomes the value of fld. // patch. That becomes the value of fld.
const word patchName(dict.lookup("patch")); const word patchName(dict.lookup("patch"));
label patchID = mesh().boundaryMesh().findPatchID(patchName); label patchID = mesh().boundaryMesh().findIndex(patchName);
pointField pdf pointField pdf
( (
pointDisplacement_.boundaryField()[patchID].patchInternalField() pointDisplacement_.boundaryField()[patchID].patchInternalField()

View File

@ -77,9 +77,9 @@ Foam::domainDecomposition::determineCoupledFaces
); );
const label masterToAddID = const label masterToAddID =
masterPatches.findPatchID(masterToAddName); masterPatches.findIndex(masterToAddName);
const label addToMasterID = const label addToMasterID =
addPatches.findPatchID(addToMasterName); addPatches.findIndex(addToMasterName);
if (masterToAddID != -1 && addToMasterID != -1) if (masterToAddID != -1 && addToMasterID != -1)
{ {
@ -297,7 +297,7 @@ void Foam::domainDecomposition::reconstruct()
const polyBoundaryMesh& patches = masterMeshes[0].boundaryMesh(); const polyBoundaryMesh& patches = masterMeshes[0].boundaryMesh();
// Move all faces of processor cyclic patches into the associated cyclics // Move all faces of processor cyclic patches into the associated cyclics
if (!patches.findPatchIDs<processorCyclicPolyPatch>().empty()) if (!patches.findIndices<processorCyclicPolyPatch>().empty())
{ {
// Determine what patches are to be combined into each patch // Determine what patches are to be combined into each patch
List<DynamicList<label>> patchPatches List<DynamicList<label>> patchPatches

View File

@ -510,7 +510,7 @@ void Foam::fvMeshSubset::setCellSubset
{ {
// No explicit patch specified. Put in oldInternalFaces patch. // No explicit patch specified. Put in oldInternalFaces patch.
// Check if patch with this name already exists. // Check if patch with this name already exists.
wantedPatchID = oldPatches.findPatchID("oldInternalFaces"); wantedPatchID = oldPatches.findIndex("oldInternalFaces");
} }
else if (wantedPatchID < 0 || wantedPatchID >= oldPatches.size()) else if (wantedPatchID < 0 || wantedPatchID >= oldPatches.size())
{ {
@ -925,7 +925,7 @@ void Foam::fvMeshSubset::setLargeCellSubset
{ {
// No explicit patch specified. Put in oldInternalFaces patch. // No explicit patch specified. Put in oldInternalFaces patch.
// Check if patch with this name already exists. // Check if patch with this name already exists.
wantedPatchID = oldPatches.findPatchID("oldInternalFaces"); wantedPatchID = oldPatches.findIndex("oldInternalFaces");
} }
else if (wantedPatchID < 0 || wantedPatchID >= oldPatches.size()) else if (wantedPatchID < 0 || wantedPatchID >= oldPatches.size())
{ {

View File

@ -42,7 +42,7 @@ Foam::label Foam::fvMeshTools::addPatch
polyBoundaryMesh& polyPatches = polyBoundaryMesh& polyPatches =
const_cast<polyBoundaryMesh&>(mesh.boundaryMesh()); const_cast<polyBoundaryMesh&>(mesh.boundaryMesh());
label patchi = polyPatches.findPatchID(patch.name()); label patchi = polyPatches.findIndex(patch.name());
if (patchi != -1) if (patchi != -1)
{ {
// Already there // Already there

View File

@ -352,7 +352,7 @@ Foam::directions::directions
const word patchName(patchDict.lookup("patch")); const word patchName(patchDict.lookup("patch"));
const label patchi = mesh.boundaryMesh().findPatchID(patchName); const label patchi = mesh.boundaryMesh().findIndex(patchName);
if (patchi == -1) if (patchi == -1)
{ {

View File

@ -1124,7 +1124,7 @@ Foam::label Foam::repatchMesh::whichPatch(const label facei) const
} }
Foam::label Foam::repatchMesh::findPatchID(const word& patchName) const Foam::label Foam::repatchMesh::findIndex(const word& patchName) const
{ {
forAll(patches_, patchi) forAll(patches_, patchi)
{ {
@ -1177,7 +1177,7 @@ void Foam::repatchMesh::addPatch(const word& patchName)
void Foam::repatchMesh::deletePatch(const word& patchName) void Foam::repatchMesh::deletePatch(const word& patchName)
{ {
const label delPatchi = findPatchID(patchName); const label delPatchi = findIndex(patchName);
if (delPatchi == -1) if (delPatchi == -1)
{ {
@ -1236,7 +1236,7 @@ void Foam::repatchMesh::changePatchType
const word& patchType const word& patchType
) )
{ {
const label changeI = findPatchID(patchName); const label changeI = findIndex(patchName);
if (changeI == -1) if (changeI == -1)
{ {

View File

@ -256,7 +256,7 @@ public:
label whichPatch(const label facei) const; label whichPatch(const label facei) const;
//- Get index of patch by name //- Get index of patch by name
label findPatchID(const word& patchName) const; label findIndex(const word& patchName) const;
//- Add to back of patch list. //- Add to back of patch list.
void addPatch(const word& patchName); void addPatch(const word& patchName);

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -54,7 +54,7 @@ void Foam::patchProbes::findElements(const fvMesh& mesh)
const polyBoundaryMesh& bm = mesh.boundaryMesh(); const polyBoundaryMesh& bm = mesh.boundaryMesh();
label patchi = bm.findPatchID(patchName_); label patchi = bm.findIndex(patchName_);
if (patchi == -1) if (patchi == -1)
{ {

View File

@ -171,7 +171,7 @@ int main(int argc, char *argv[])
// Remove the added patch // Remove the added patch
if (newPatchName.size()) if (newPatchName.size())
{ {
label removei = pbm.findPatchID(newPatchName); label removei = pbm.findIndex(newPatchName);
if (removei == -1) if (removei == -1)
{ {
FatalErrorInFunction << "Problem" << exit(FatalError); FatalErrorInFunction << "Problem" << exit(FatalError);

View File

@ -66,7 +66,7 @@ int main(int argc, char *argv[])
const scalar h = mesh.bounds().span().y(); const scalar h = mesh.bounds().span().y();
Info<< "Height from centreline to wall = " << h << endl; Info<< "Height from centreline to wall = " << h << endl;
const label centrelineID = mesh.boundary().findPatchID("centreline"); const label centrelineID = mesh.boundary().findIndex("centreline");
const vector patchToCell = const vector patchToCell =
mesh.boundary()[centrelineID].Cf()[0] mesh.boundary()[centrelineID].Cf()[0]
- mesh.C()[mesh.findNearestCell(location)]; - mesh.C()[mesh.findNearestCell(location)];

View File

@ -67,7 +67,7 @@ functions
Info<< "Reading inlet velocity uInfX\n" << endl; Info<< "Reading inlet velocity uInfX\n" << endl;
scalar ULeft = 0.0; scalar ULeft = 0.0;
label leftI = mesh().boundaryMesh().findPatchID("left"); label leftI = mesh().boundaryMesh().findIndex("left");
const fvPatchVectorField& fvp = U.boundaryField()[leftI]; const fvPatchVectorField& fvp = U.boundaryField()[leftI];
if (fvp.size()) if (fvp.size())
{ {
@ -86,7 +86,7 @@ functions
scalar magCylinder = 0.0; scalar magCylinder = 0.0;
label cylI = mesh().boundaryMesh().findPatchID("cylinder"); label cylI = mesh().boundaryMesh().findIndex("cylinder");
const fvPatchVectorField& cylFvp = mesh().C().boundaryField()[cylI]; const fvPatchVectorField& cylFvp = mesh().C().boundaryField()[cylI];
if (cylFvp.size()) if (cylFvp.size())
{ {