Commit 9cb1bd68 authored by Philippose Rajan's avatar Philippose Rajan
Browse files

Added function to get patch ID from name, and patch Name from ID


Signed-off-by: default avatarPhilippose Rajan <sarith@rocketmail.com>
parent da7c7c2e
......@@ -214,7 +214,7 @@ wordList polyMeshGenFaces::patchNames() const
return t;
}
label polyMeshGenFaces::findPatchID(const word& patchName) const
label polyMeshGenFaces::getPatchID(const word& patchName) const
{
forAll(boundaries_, patchI)
{
......@@ -232,6 +232,20 @@ label polyMeshGenFaces::findPatchID(const word& patchName) const
return -1;
}
word polyMeshGenFaces::getPatchName(const label patchID) const
{
if((patchID < 0) || (patchID >= boundaries_.size()))
{
FatalErrorIn
(
"polyMeshGenFaces::getPatchName(const label patchID) const"
) << "invalid patch ID supplied"
<< abort(FatalError);
}
return boundaries_[patchID].patchName();
}
labelList polyMeshGenFaces::findPatches(const word& patchName) const
{
wordList allPatches = patchNames();
......
......@@ -147,7 +147,10 @@ public:
wordList patchNames() const;
//- return the index of a patch given its name
label findPatchID(const word& patchName) const;
label getPatchID(const word& patchName) const;
//- return the name of a patch given its ID
word getPatchName(const label patchID) const;
//- return a list of patch indices corresponding to the given
// name, expanding regular expressions
......
Supports Markdown
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