diff --git a/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C b/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C index f79cfd4ce9..bda9af3af9 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C +++ b/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C @@ -684,37 +684,6 @@ Foam::labelList Foam::polyBoundaryMesh::findIndices } -Foam::label Foam::polyBoundaryMesh::findIndex(const wordRe& key) const -{ - if (!key.empty()) - { - if (key.isPattern()) - { - labelList indices = this->findIndices(key); - - // return first element - if (!indices.empty()) - { - return indices[0]; - } - } - else - { - forAll(*this, i) - { - if (key == operator[](i).name()) - { - return i; - } - } - } - } - - // not found - return -1; -} - - Foam::label Foam::polyBoundaryMesh::findPatchID(const word& patchName) const { const polyPatchList& patches = *this; diff --git a/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.H b/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.H index a0d37463fd..ac3530aca1 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.H +++ b/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -170,7 +170,13 @@ public: ) const; //- Return patch index for the first match, return -1 if not found - label findIndex(const wordRe&) const; + label findIndex(const wordRe&) const = delete; + + //- Find patch index given a name + label findIndex(const word& patchName) const + { + return findPatchID(patchName); + } //- Find patch index given a name label findPatchID(const word& patchName) const; diff --git a/src/OpenFOAM/meshes/polyMesh/zones/MeshZones/MeshZones.C b/src/OpenFOAM/meshes/polyMesh/zones/MeshZones/MeshZones.C index b3402278c5..afd7f38422 100644 --- a/src/OpenFOAM/meshes/polyMesh/zones/MeshZones/MeshZones.C +++ b/src/OpenFOAM/meshes/polyMesh/zones/MeshZones/MeshZones.C @@ -291,74 +291,6 @@ bool Foam::MeshZones::found } -template -Foam::label Foam::MeshZones::findIndex -( - const wordRe& key -) const -{ - if (!key.empty()) - { - if (key.isPattern()) - { - labelList indices = this->findIndices(key); - - // return first element - if (!indices.empty()) - { - return indices[0]; - } - } - else - { - forAll(*this, i) - { - if (key == operator[](i).name()) - { - return i; - } - } - } - } - - // not found - return -1; -} - - -template -Foam::labelList Foam::MeshZones::findIndices -( - const wordRe& key -) const -{ - labelList indices; - - if (!key.empty()) - { - if (key.isPattern()) - { - indices = findStrings(key, this->names()); - } - else - { - indices.setSize(this->size()); - label nFound = 0; - forAll(*this, i) - { - if (key == operator[](i).name()) - { - indices[nFound++] = i; - } - } - indices.setSize(nFound); - } - } - - return indices; -} - - template Foam::label Foam::MeshZones::findZoneID ( diff --git a/src/OpenFOAM/meshes/polyMesh/zones/MeshZones/MeshZones.H b/src/OpenFOAM/meshes/polyMesh/zones/MeshZones/MeshZones.H index ef386a77f4..42f722eab6 100644 --- a/src/OpenFOAM/meshes/polyMesh/zones/MeshZones/MeshZones.H +++ b/src/OpenFOAM/meshes/polyMesh/zones/MeshZones/MeshZones.H @@ -147,12 +147,16 @@ public: bool found(const word& zoneName) const; //- Return zone index for the first match, return -1 if not found - label findIndex(const wordRe&) const; + //- Find the zone index given the zone name + label findIndex(const wordRe&) const = delete; - //- Return zone indices for all matches - labelList findIndices(const wordRe&) const; + //- Find the zone index given the zone name + label findIndex(const word& zoneName) const + { + return findZoneID(zoneName); + } - //- Find zone index given a name + //- Find the zone index given the zone name label findZoneID(const word& zoneName) const; //- Mark cells that match the zone specification