Commit b74f1096 authored by mattijs's avatar mattijs
Browse files

wildcards in selection

parent 59261a95
......@@ -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;
}
}
......
......@@ -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
......
......@@ -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;
}
}
......
......@@ -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
......
......@@ -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;
}
}
......
......@@ -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
......
......@@ -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;
}
}
......
......@@ -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
......
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