Skip to content
Snippets Groups Projects
Commit da7c7c2e authored by Philippose Rajan's avatar Philippose Rajan
Browse files

Added patch access and regex search capabilities to the polyMeshGenFaces class

parent 1323bcfe
No related branches found
No related tags found
No related merge requests found
...@@ -31,6 +31,7 @@ Description ...@@ -31,6 +31,7 @@ Description
#include "IOobjectList.H" #include "IOobjectList.H"
#include "faceSet.H" #include "faceSet.H"
#include "demandDrivenData.H" #include "demandDrivenData.H"
#include "stringListOps.H"
namespace Foam namespace Foam
{ {
...@@ -201,6 +202,51 @@ label polyMeshGenFaces::faceIsInPatch(const label faceLabel) const ...@@ -201,6 +202,51 @@ label polyMeshGenFaces::faceIsInPatch(const label faceLabel) const
return -1; return -1;
} }
wordList polyMeshGenFaces::patchNames() const
{
wordList t(boundaries_.size());
forAll(boundaries_, patchI)
{
t[patchI] = boundaries_[patchI].patchName();
}
return t;
}
label polyMeshGenFaces::findPatchID(const word& patchName) const
{
forAll(boundaries_, patchI)
{
if(boundaries_.set(patchI))
{
if(boundaries_[patchI].patchName() == patchName)
{
return patchI;
}
}
}
// If the code gets here, it implies that the patch was not found.
// return a -1 in this case
return -1;
}
labelList polyMeshGenFaces::findPatches(const word& patchName) const
{
wordList allPatches = patchNames();
labelList patchIDs = findStrings(patchName, allPatches);
if(patchIDs.empty())
{
WarningIn("polyMeshGenFaces::findPatches(const word&)")
<< "Cannot find any patch names matching " << patchName << endl;
}
return patchIDs;
}
label polyMeshGenFaces::addFaceSubset(const word& setName) label polyMeshGenFaces::addFaceSubset(const word& setName)
{ {
label id = faceSubsetIndex(setName); label id = faceSubsetIndex(setName);
......
...@@ -142,7 +142,17 @@ public: ...@@ -142,7 +142,17 @@ public:
//- return patch label for the given face label //- return patch label for the given face label
label faceIsInPatch(const label faceLabel) const; label faceIsInPatch(const label faceLabel) const;
//- return list of patches in the boundary
wordList patchNames() const;
//- return the index of a patch given its name
label findPatchID(const word& patchName) const;
//- return a list of patch indices corresponding to the given
// name, expanding regular expressions
labelList findPatches(const word& patchName) const;
// Subsets // Subsets
label addFaceSubset(const word&); label addFaceSubset(const word&);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment