diff --git a/src/meshTools/sets/cellSources/zoneToCell/zoneToCell.C b/src/meshTools/sets/cellSources/zoneToCell/zoneToCell.C index 6f4b7f2409..0dcd1e0ffb 100644 --- a/src/meshTools/sets/cellSources/zoneToCell/zoneToCell.C +++ b/src/meshTools/sets/cellSources/zoneToCell/zoneToCell.C @@ -55,26 +55,37 @@ Foam::topoSetSource::addToUsageTable Foam::zoneToCell::usage_ void Foam::zoneToCell::combine(topoSet& set, const bool add) const { - label zoneI = mesh_.cellZones().findZoneID(zoneName_); + bool hasMatched = false; - if (zoneI != -1) + forAll(mesh_.cellZones(), i) { - const labelList& cellLabels = mesh_.cellZones()[zoneI]; + const cellZone& zone = mesh_.cellZones()[i]; - forAll(cellLabels, i) + if (zoneName_.match(zone.name())) { - // Only do active cells - if (cellLabels[i] < mesh_.nCells()) + const labelList& cellLabels = mesh_.cellZones()[i]; + + Info<< " Found matching zone " << zone.name() + << " with " << cellLabels.size() << " cells." << endl; + + hasMatched = true; + + forAll(cellLabels, i) { - addOrDelete(set, cellLabels[i], add); + // Only do active cells + if (cellLabels[i] < mesh_.nCells()) + { + addOrDelete(set, cellLabels[i], add); + } } } } - else + + if (!hasMatched) { WarningIn("zoneToCell::combine(topoSet&, const bool)") - << "Cannot find zone named " << zoneName_ << endl - << "Valid zones are " << mesh_.cellZones().names() << endl; + << "Cannot find any cellZone named " << zoneName_ << endl + << "Valid names are " << mesh_.cellZones().names() << endl; } } diff --git a/src/meshTools/sets/cellSources/zoneToCell/zoneToCell.H b/src/meshTools/sets/cellSources/zoneToCell/zoneToCell.H index 544fe7b474..a871a190c4 100644 --- a/src/meshTools/sets/cellSources/zoneToCell/zoneToCell.H +++ b/src/meshTools/sets/cellSources/zoneToCell/zoneToCell.H @@ -37,6 +37,7 @@ SourceFiles #define zoneToCell_H #include "topoSetSource.H" +#include "wordRe.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -57,8 +58,8 @@ class zoneToCell //- Add usage string static addToUsageTable usage_; - //- Name of cellZone - word zoneName_; + //- Name/regular expression of cellZone + wordRe zoneName_; // Private Member Functions diff --git a/src/meshTools/sets/faceSources/patchToFace/patchToFace.C b/src/meshTools/sets/faceSources/patchToFace/patchToFace.C index 622c009fe2..9bcf49690f 100644 --- a/src/meshTools/sets/faceSources/patchToFace/patchToFace.C +++ b/src/meshTools/sets/faceSources/patchToFace/patchToFace.C @@ -57,21 +57,36 @@ Foam::topoSetSource::addToUsageTable Foam::patchToFace::usage_ void Foam::patchToFace::combine(topoSet& set, const bool add) const { - label patchI = mesh_.boundaryMesh().findPatchID(patchName_); + bool hasMatched = false; - if (patchI != -1) + forAll(mesh_.boundaryMesh(), patchI) { const polyPatch& pp = mesh_.boundaryMesh()[patchI]; - for (label faceI = pp.start(); faceI < pp.start() + pp.size(); faceI++) + if (patchName_.match(pp.name())) { - addOrDelete(set, faceI, add); + Info<< " Found matching patch " << pp.name() + << " with " << pp.size() << " faces." << endl; + + hasMatched = true; + + + for + ( + label faceI = pp.start(); + faceI < pp.start() + pp.size(); + faceI++ + ) + { + addOrDelete(set, faceI, add); + } } } - else + + if (!hasMatched) { WarningIn("patchToFace::combine(topoSet&, const bool)") - << "Cannot find patch named " << patchName_ << endl + << "Cannot find any patch named " << patchName_ << endl << "Valid names are " << mesh_.boundaryMesh().names() << endl; } } diff --git a/src/meshTools/sets/faceSources/patchToFace/patchToFace.H b/src/meshTools/sets/faceSources/patchToFace/patchToFace.H index 25726dc849..97ccf92cdd 100644 --- a/src/meshTools/sets/faceSources/patchToFace/patchToFace.H +++ b/src/meshTools/sets/faceSources/patchToFace/patchToFace.H @@ -37,6 +37,7 @@ SourceFiles #define patchToFace_H #include "topoSetSource.H" +#include "wordRe.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -57,8 +58,8 @@ class patchToFace //- Add usage string static addToUsageTable usage_; - //- Name of patch - word patchName_; + //- Name/regular expression of patch + wordRe patchName_; // Private Member Functions diff --git a/src/meshTools/sets/faceSources/zoneToFace/zoneToFace.C b/src/meshTools/sets/faceSources/zoneToFace/zoneToFace.C index 1b7692922e..12cbab560d 100644 --- a/src/meshTools/sets/faceSources/zoneToFace/zoneToFace.C +++ b/src/meshTools/sets/faceSources/zoneToFace/zoneToFace.C @@ -22,8 +22,6 @@ License along with OpenFOAM; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -Description - \*---------------------------------------------------------------------------*/ #include "zoneToFace.H" @@ -57,26 +55,37 @@ Foam::topoSetSource::addToUsageTable Foam::zoneToFace::usage_ void Foam::zoneToFace::combine(topoSet& set, const bool add) const { - label zoneI = mesh_.faceZones().findZoneID(zoneName_); + bool hasMatched = false; - if (zoneI != -1) + forAll(mesh_.faceZones(), i) { - const labelList& faceLabels = mesh_.faceZones()[zoneI]; + const faceZone& zone = mesh_.faceZones()[i]; - forAll(faceLabels, i) + if (zoneName_.match(zone.name())) { - // Only do active faces - if (faceLabels[i] < mesh_.nFaces()) + const labelList& faceLabels = mesh_.faceZones()[i]; + + Info<< " Found matching zone " << zone.name() + << " with " << faceLabels.size() << " faces." << endl; + + hasMatched = true; + + forAll(faceLabels, i) { - addOrDelete(set, faceLabels[i], add); + // Only do active faces + if (faceLabels[i] < mesh_.nFaces()) + { + addOrDelete(set, faceLabels[i], add); + } } } } - else + + if (!hasMatched) { WarningIn("zoneToFace::combine(topoSet&, const bool)") - << "Cannot find zone named " << zoneName_ << endl - << "Valid zones are " << mesh_.faceZones().names() << endl; + << "Cannot find any faceZone named " << zoneName_ << endl + << "Valid names are " << mesh_.faceZones().names() << endl; } } diff --git a/src/meshTools/sets/faceSources/zoneToFace/zoneToFace.H b/src/meshTools/sets/faceSources/zoneToFace/zoneToFace.H index c0f4a33c1d..d41991f880 100644 --- a/src/meshTools/sets/faceSources/zoneToFace/zoneToFace.H +++ b/src/meshTools/sets/faceSources/zoneToFace/zoneToFace.H @@ -37,6 +37,7 @@ SourceFiles #define zoneToFace_H #include "topoSetSource.H" +#include "wordRe.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -57,8 +58,8 @@ class zoneToFace //- Add usage string static addToUsageTable usage_; - //- Name of faceZone - word zoneName_; + //- Name/regular expression of cellZone + wordRe zoneName_; // Private Member Functions diff --git a/src/meshTools/sets/pointSources/zoneToPoint/zoneToPoint.C b/src/meshTools/sets/pointSources/zoneToPoint/zoneToPoint.C index 9db68482db..4b5148c558 100644 --- a/src/meshTools/sets/pointSources/zoneToPoint/zoneToPoint.C +++ b/src/meshTools/sets/pointSources/zoneToPoint/zoneToPoint.C @@ -55,26 +55,37 @@ Foam::topoSetSource::addToUsageTable Foam::zoneToPoint::usage_ void Foam::zoneToPoint::combine(topoSet& set, const bool add) const { - label zoneI = mesh_.pointZones().findZoneID(zoneName_); + bool hasMatched = false; - if (zoneI != -1) + forAll(mesh_.pointZones(), i) { - const labelList& pointLabels = mesh_.pointZones()[zoneI]; + const pointZone& zone = mesh_.pointZones()[i]; - forAll(pointLabels, i) + if (zoneName_.match(zone.name())) { - // Only do active cells - if (pointLabels[i] < mesh_.nPoints()) + const labelList& pointLabels = mesh_.pointZones()[i]; + + Info<< " Found matching zone " << zone.name() + << " with " << pointLabels.size() << " points." << endl; + + hasMatched = true; + + forAll(pointLabels, i) { - addOrDelete(set, pointLabels[i], add); + // Only do active points + if (pointLabels[i] < mesh_.nPoints()) + { + addOrDelete(set, pointLabels[i], add); + } } } } - else + + if (!hasMatched) { WarningIn("zoneToPoint::combine(topoSet&, const bool)") - << "Cannot find zone named " << zoneName_ << endl - << "Valid zones are " << mesh_.pointZones().names() << endl; + << "Cannot find any pointZone named " << zoneName_ << endl + << "Valid names are " << mesh_.pointZones().names() << endl; } } diff --git a/src/meshTools/sets/pointSources/zoneToPoint/zoneToPoint.H b/src/meshTools/sets/pointSources/zoneToPoint/zoneToPoint.H index 9245370fb0..d76227b3f3 100644 --- a/src/meshTools/sets/pointSources/zoneToPoint/zoneToPoint.H +++ b/src/meshTools/sets/pointSources/zoneToPoint/zoneToPoint.H @@ -37,6 +37,7 @@ SourceFiles #define zoneToPoint_H #include "topoSetSource.H" +#include "wordRe.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -57,8 +58,8 @@ class zoneToPoint //- Add usage string static addToUsageTable usage_; - //- Name of cellZone - word zoneName_; + //- Name/regular expression of zone + wordRe zoneName_; // Private Member Functions