Commit da7c7c2e authored by Philippose Rajan's avatar Philippose Rajan
Browse files

Added patch access and regex search capabilities to the polyMeshGenFaces class


Signed-off-by: default avatarPhilippose Rajan <sarith@rocketmail.com>
parent 1323bcfe
......@@ -31,6 +31,7 @@ Description
#include "IOobjectList.H"
#include "faceSet.H"
#include "demandDrivenData.H"
#include "stringListOps.H"
namespace Foam
{
......@@ -201,6 +202,51 @@ label polyMeshGenFaces::faceIsInPatch(const label faceLabel) const
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 id = faceSubsetIndex(setName);
......
......@@ -142,7 +142,17 @@ public:
//- return patch label for the given face label
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
label addFaceSubset(const word&);
......
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