ENH: boundaryMesh - allow not found state in findPatchID
This commit is contained in:
parent
85877cb0f4
commit
99b67ba8db
@ -656,7 +656,11 @@ Foam::label Foam::polyBoundaryMesh::findIndex(const keyType& key) const
|
||||
}
|
||||
|
||||
|
||||
Foam::label Foam::polyBoundaryMesh::findPatchID(const word& patchName) const
|
||||
Foam::label Foam::polyBoundaryMesh::findPatchID
|
||||
(
|
||||
const word& patchName,
|
||||
bool allowNotFound
|
||||
) const
|
||||
{
|
||||
const polyPatchList& patches = *this;
|
||||
|
||||
@ -668,6 +672,20 @@ Foam::label Foam::polyBoundaryMesh::findPatchID(const word& patchName) const
|
||||
}
|
||||
}
|
||||
|
||||
if (!allowNotFound)
|
||||
{
|
||||
string regionStr("");
|
||||
if (mesh_.name() != polyMesh::defaultRegion)
|
||||
{
|
||||
regionStr = "in region '" + mesh_.name() + "' ";
|
||||
}
|
||||
|
||||
FatalErrorInFunction
|
||||
<< "Patch '" << patchName << "' not found. "
|
||||
<< "Available patch names " << regionStr << "include: " << names()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
// Patch not found
|
||||
if (debug)
|
||||
{
|
||||
|
@ -171,7 +171,11 @@ public:
|
||||
label findIndex(const keyType&) const;
|
||||
|
||||
//- Find patch index given a name
|
||||
label findPatchID(const word& patchName) const;
|
||||
label findPatchID
|
||||
(
|
||||
const word& patchName,
|
||||
const bool allowNotFound = true
|
||||
) const;
|
||||
|
||||
//- Find patch indices for a given polyPatch type
|
||||
template<class Type>
|
||||
|
Loading…
Reference in New Issue
Block a user