Skip to content
Snippets Groups Projects
Commit 2d7b3363 authored by mattijs's avatar mattijs
Browse files

ENH: patchToFace: allow patch groups in patchToFace

parent 4fe5330d
Branches
Tags
No related merge requests found
......@@ -211,7 +211,8 @@ FoamFile
// source patchToFace;
// sourceInfo
// {
// name ".*Wall"; // Name of patch, regular expressions allowed
// name ".*Wall"; // Name of patch or patch group,
// // (regular expressions allowed)
// }
//
// // All faces of faceZone
......
......@@ -54,33 +54,34 @@ Foam::topoSetSource::addToUsageTable Foam::patchToFace::usage_
void Foam::patchToFace::combine(topoSet& set, const bool add) const
{
bool hasMatched = false;
forAll(mesh_.boundaryMesh(), patchI)
labelHashSet patchIDs = mesh_.boundaryMesh().patchSet
(
List<wordRe>(1, patchName_),
true, // warn if not found
true // use patch groups if available
);
forAllConstIter(labelHashSet, patchIDs, iter)
{
const polyPatch& pp = mesh_.boundaryMesh()[patchI];
if (patchName_.match(pp.name()))
{
Info<< " Found matching patch " << pp.name()
<< " with " << pp.size() << " faces." << endl;
label patchI = iter.key();
hasMatched = true;
const polyPatch& pp = mesh_.boundaryMesh()[patchI];
Info<< " Found matching patch " << pp.name()
<< " with " << pp.size() << " faces." << endl;
for
(
label faceI = pp.start();
faceI < pp.start() + pp.size();
faceI++
)
{
addOrDelete(set, faceI, add);
}
for
(
label faceI = pp.start();
faceI < pp.start() + pp.size();
faceI++
)
{
addOrDelete(set, faceI, add);
}
}
if (!hasMatched)
if (patchIDs.empty())
{
WarningIn("patchToFace::combine(topoSet&, const bool)")
<< "Cannot find any patch named " << patchName_ << endl
......
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