mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
wildcards in selection
This commit is contained in:
@ -55,26 +55,37 @@ Foam::topoSetSource::addToUsageTable Foam::zoneToCell::usage_
|
|||||||
|
|
||||||
void Foam::zoneToCell::combine(topoSet& set, const bool add) const
|
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
|
const labelList& cellLabels = mesh_.cellZones()[i];
|
||||||
if (cellLabels[i] < mesh_.nCells())
|
|
||||||
|
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)")
|
WarningIn("zoneToCell::combine(topoSet&, const bool)")
|
||||||
<< "Cannot find zone named " << zoneName_ << endl
|
<< "Cannot find any cellZone named " << zoneName_ << endl
|
||||||
<< "Valid zones are " << mesh_.cellZones().names() << endl;
|
<< "Valid names are " << mesh_.cellZones().names() << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -37,6 +37,7 @@ SourceFiles
|
|||||||
#define zoneToCell_H
|
#define zoneToCell_H
|
||||||
|
|
||||||
#include "topoSetSource.H"
|
#include "topoSetSource.H"
|
||||||
|
#include "wordRe.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -57,8 +58,8 @@ class zoneToCell
|
|||||||
//- Add usage string
|
//- Add usage string
|
||||||
static addToUsageTable usage_;
|
static addToUsageTable usage_;
|
||||||
|
|
||||||
//- Name of cellZone
|
//- Name/regular expression of cellZone
|
||||||
word zoneName_;
|
wordRe zoneName_;
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|||||||
@ -57,21 +57,36 @@ Foam::topoSetSource::addToUsageTable Foam::patchToFace::usage_
|
|||||||
|
|
||||||
void Foam::patchToFace::combine(topoSet& set, const bool add) const
|
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];
|
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)")
|
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;
|
<< "Valid names are " << mesh_.boundaryMesh().names() << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -37,6 +37,7 @@ SourceFiles
|
|||||||
#define patchToFace_H
|
#define patchToFace_H
|
||||||
|
|
||||||
#include "topoSetSource.H"
|
#include "topoSetSource.H"
|
||||||
|
#include "wordRe.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -57,8 +58,8 @@ class patchToFace
|
|||||||
//- Add usage string
|
//- Add usage string
|
||||||
static addToUsageTable usage_;
|
static addToUsageTable usage_;
|
||||||
|
|
||||||
//- Name of patch
|
//- Name/regular expression of patch
|
||||||
word patchName_;
|
wordRe patchName_;
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|||||||
@ -22,8 +22,6 @@ License
|
|||||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
Description
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "zoneToFace.H"
|
#include "zoneToFace.H"
|
||||||
@ -57,26 +55,37 @@ Foam::topoSetSource::addToUsageTable Foam::zoneToFace::usage_
|
|||||||
|
|
||||||
void Foam::zoneToFace::combine(topoSet& set, const bool add) const
|
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
|
const labelList& faceLabels = mesh_.faceZones()[i];
|
||||||
if (faceLabels[i] < mesh_.nFaces())
|
|
||||||
|
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)")
|
WarningIn("zoneToFace::combine(topoSet&, const bool)")
|
||||||
<< "Cannot find zone named " << zoneName_ << endl
|
<< "Cannot find any faceZone named " << zoneName_ << endl
|
||||||
<< "Valid zones are " << mesh_.faceZones().names() << endl;
|
<< "Valid names are " << mesh_.faceZones().names() << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -37,6 +37,7 @@ SourceFiles
|
|||||||
#define zoneToFace_H
|
#define zoneToFace_H
|
||||||
|
|
||||||
#include "topoSetSource.H"
|
#include "topoSetSource.H"
|
||||||
|
#include "wordRe.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -57,8 +58,8 @@ class zoneToFace
|
|||||||
//- Add usage string
|
//- Add usage string
|
||||||
static addToUsageTable usage_;
|
static addToUsageTable usage_;
|
||||||
|
|
||||||
//- Name of faceZone
|
//- Name/regular expression of cellZone
|
||||||
word zoneName_;
|
wordRe zoneName_;
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|||||||
@ -55,26 +55,37 @@ Foam::topoSetSource::addToUsageTable Foam::zoneToPoint::usage_
|
|||||||
|
|
||||||
void Foam::zoneToPoint::combine(topoSet& set, const bool add) const
|
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
|
const labelList& pointLabels = mesh_.pointZones()[i];
|
||||||
if (pointLabels[i] < mesh_.nPoints())
|
|
||||||
|
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)")
|
WarningIn("zoneToPoint::combine(topoSet&, const bool)")
|
||||||
<< "Cannot find zone named " << zoneName_ << endl
|
<< "Cannot find any pointZone named " << zoneName_ << endl
|
||||||
<< "Valid zones are " << mesh_.pointZones().names() << endl;
|
<< "Valid names are " << mesh_.pointZones().names() << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -37,6 +37,7 @@ SourceFiles
|
|||||||
#define zoneToPoint_H
|
#define zoneToPoint_H
|
||||||
|
|
||||||
#include "topoSetSource.H"
|
#include "topoSetSource.H"
|
||||||
|
#include "wordRe.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -57,8 +58,8 @@ class zoneToPoint
|
|||||||
//- Add usage string
|
//- Add usage string
|
||||||
static addToUsageTable usage_;
|
static addToUsageTable usage_;
|
||||||
|
|
||||||
//- Name of cellZone
|
//- Name/regular expression of zone
|
||||||
word zoneName_;
|
wordRe zoneName_;
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|||||||
Reference in New Issue
Block a user