Commit 821ff7a5 authored by Andrew Heather's avatar Andrew Heather
Browse files

ENH: boundaryMesh - allow not found state in findPatchID

parent 40fc8462
...@@ -656,7 +656,11 @@ Foam::label Foam::polyBoundaryMesh::findIndex(const keyType& key) const ...@@ -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; const polyPatchList& patches = *this;
...@@ -668,6 +672,20 @@ Foam::label Foam::polyBoundaryMesh::findPatchID(const word& patchName) const ...@@ -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 // Patch not found
if (debug) if (debug)
{ {
......
...@@ -171,7 +171,11 @@ public: ...@@ -171,7 +171,11 @@ public:
label findIndex(const keyType&) const; label findIndex(const keyType&) const;
//- Find patch index given a name //- 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 //- Find patch indices for a given polyPatch type
template<class Type> template<class Type>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment