mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: support multiple zones for topo set sources (#1060)
- uses the keywords 'zones' and 'zone' to avoid potential conflicts with a named topoSet action, but accepts 'name' for compatibility.
This commit is contained in:
@ -63,7 +63,9 @@ FoamFile
|
|||||||
// source faceZoneToCell;
|
// source faceZoneToCell;
|
||||||
// sourceInfo
|
// sourceInfo
|
||||||
// {
|
// {
|
||||||
// name ".*Zone"; // Name of faceZone, regular expressions allowed
|
// zones (".*Zone"); // Name of faceZone, regular expressions allowed
|
||||||
|
// // OR zone ".*Zone"; // Name of faceZone, regular expressions allowed
|
||||||
|
// // OR name ".*Zone"; // Name of faceZone, regular expressions allowed
|
||||||
// option master; // master/slave
|
// option master; // master/slave
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
|
|||||||
@ -65,7 +65,7 @@ void Foam::faceZoneToCell::combine(topoSet& set, const bool add) const
|
|||||||
|
|
||||||
for (const faceZone& zone : mesh_.faceZones())
|
for (const faceZone& zone : mesh_.faceZones())
|
||||||
{
|
{
|
||||||
if (zoneName_.match(zone.name()))
|
if (selectedZones_.match(zone.name()))
|
||||||
{
|
{
|
||||||
hasMatched = true;
|
hasMatched = true;
|
||||||
|
|
||||||
@ -77,8 +77,8 @@ void Foam::faceZoneToCell::combine(topoSet& set, const bool add) const
|
|||||||
);
|
);
|
||||||
|
|
||||||
Info<< " Found matching zone " << zone.name()
|
Info<< " Found matching zone " << zone.name()
|
||||||
<< " with " << cellLabels.size() << " cells on selected side."
|
<< " with " << cellLabels.size() << " cells on "
|
||||||
<< endl;
|
<< faceActionNames_[option_] << " side" << endl;
|
||||||
|
|
||||||
for (const label celli : cellLabels)
|
for (const label celli : cellLabels)
|
||||||
{
|
{
|
||||||
@ -94,7 +94,8 @@ void Foam::faceZoneToCell::combine(topoSet& set, const bool add) const
|
|||||||
if (!hasMatched)
|
if (!hasMatched)
|
||||||
{
|
{
|
||||||
WarningInFunction
|
WarningInFunction
|
||||||
<< "Cannot find any faceZone named " << zoneName_ << nl
|
<< "Cannot find any faceZone matching "
|
||||||
|
<< flatOutput(selectedZones_) << nl
|
||||||
<< "Valid names: " << flatOutput(mesh_.faceZones().names())
|
<< "Valid names: " << flatOutput(mesh_.faceZones().names())
|
||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
@ -106,12 +107,12 @@ void Foam::faceZoneToCell::combine(topoSet& set, const bool add) const
|
|||||||
Foam::faceZoneToCell::faceZoneToCell
|
Foam::faceZoneToCell::faceZoneToCell
|
||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
const word& zoneName,
|
const wordRe& zoneName,
|
||||||
const faceAction option
|
const faceAction option
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
topoSetSource(mesh),
|
topoSetSource(mesh),
|
||||||
zoneName_(zoneName),
|
selectedZones_(one(), zoneName),
|
||||||
option_(option)
|
option_(option)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@ -123,9 +124,17 @@ Foam::faceZoneToCell::faceZoneToCell
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
topoSetSource(mesh),
|
topoSetSource(mesh),
|
||||||
zoneName_(dict.get<wordRe>("name")),
|
selectedZones_(),
|
||||||
option_(faceActionNames_.get("option", dict))
|
option_(faceActionNames_.get("option", dict))
|
||||||
{}
|
{
|
||||||
|
// Look for 'zones' and 'zone', but accept 'name' as well
|
||||||
|
if (!dict.readIfPresent("zones", selectedZones_))
|
||||||
|
{
|
||||||
|
selectedZones_.resize(1);
|
||||||
|
selectedZones_.first() =
|
||||||
|
dict.getCompat<wordRe>("zone", {{"name", 1806}});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::faceZoneToCell::faceZoneToCell
|
Foam::faceZoneToCell::faceZoneToCell
|
||||||
@ -135,7 +144,7 @@ Foam::faceZoneToCell::faceZoneToCell
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
topoSetSource(mesh),
|
topoSetSource(mesh),
|
||||||
zoneName_(checkIs(is)),
|
selectedZones_(one(), wordRe(checkIs(is))),
|
||||||
option_(faceActionNames_.read(checkIs(is)))
|
option_(faceActionNames_.read(checkIs(is)))
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@ -151,14 +160,16 @@ void Foam::faceZoneToCell::applyToSet
|
|||||||
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
|
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
|
||||||
{
|
{
|
||||||
Info<< " Adding all " << faceActionNames_[option_]
|
Info<< " Adding all " << faceActionNames_[option_]
|
||||||
<< " cells of faceZone " << zoneName_ << " ..." << endl;
|
<< " cells of face zones "
|
||||||
|
<< flatOutput(selectedZones_) << " ..." << endl;
|
||||||
|
|
||||||
combine(set, true);
|
combine(set, true);
|
||||||
}
|
}
|
||||||
else if (action == topoSetSource::DELETE)
|
else if (action == topoSetSource::DELETE)
|
||||||
{
|
{
|
||||||
Info<< " Removing all " << faceActionNames_[option_]
|
Info<< " Removing all " << faceActionNames_[option_]
|
||||||
<< " cells of faceZone " << zoneName_ << " ..." << endl;
|
<< " cells of face zones "
|
||||||
|
<< flatOutput(selectedZones_) << " ..." << endl;
|
||||||
|
|
||||||
combine(set, false);
|
combine(set, false);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -30,10 +30,15 @@ Description
|
|||||||
\heading Dictionary parameters
|
\heading Dictionary parameters
|
||||||
\table
|
\table
|
||||||
Property | Description | Required | Default
|
Property | Description | Required | Default
|
||||||
name | The face zone name or regex | yes |
|
|
||||||
option | Selection type (master / slave) | yes |
|
option | Selection type (master / slave) | yes |
|
||||||
|
zone | The face zone name or regex | possibly |
|
||||||
|
zones | The face zone names or regexs | possibly |
|
||||||
|
name | Older specification for 'zone' | no |
|
||||||
\endtable
|
\endtable
|
||||||
|
|
||||||
|
Note
|
||||||
|
Selection of multiple zones has precedence.
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
faceZoneToCell.C
|
faceZoneToCell.C
|
||||||
|
|
||||||
@ -43,7 +48,7 @@ SourceFiles
|
|||||||
#define faceZoneToCell_H
|
#define faceZoneToCell_H
|
||||||
|
|
||||||
#include "topoSetSource.H"
|
#include "topoSetSource.H"
|
||||||
#include "wordRe.H"
|
#include "wordRes.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -75,8 +80,8 @@ private:
|
|||||||
//- Add usage string
|
//- Add usage string
|
||||||
static addToUsageTable usage_;
|
static addToUsageTable usage_;
|
||||||
|
|
||||||
//- Name/regular expression of faceZone
|
//- Matcher for face zones
|
||||||
wordRe zoneName_;
|
wordRes selectedZones_;
|
||||||
|
|
||||||
//- Option
|
//- Option
|
||||||
faceAction option_;
|
faceAction option_;
|
||||||
@ -98,7 +103,7 @@ public:
|
|||||||
faceZoneToCell
|
faceZoneToCell
|
||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
const word& zoneName,
|
const wordRe& zoneName,
|
||||||
const faceAction option
|
const faceAction option
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -115,7 +120,7 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
virtual sourceType setType() const
|
virtual topoSetSource::sourceType setType() const
|
||||||
{
|
{
|
||||||
return CELLSETSOURCE;
|
return CELLSETSOURCE;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -54,7 +54,7 @@ void Foam::zoneToCell::combine(topoSet& set, const bool add) const
|
|||||||
|
|
||||||
for (const cellZone& zone : mesh_.cellZones())
|
for (const cellZone& zone : mesh_.cellZones())
|
||||||
{
|
{
|
||||||
if (zoneName_.match(zone.name()))
|
if (selectedZones_.match(zone.name()))
|
||||||
{
|
{
|
||||||
hasMatched = true;
|
hasMatched = true;
|
||||||
|
|
||||||
@ -77,7 +77,8 @@ void Foam::zoneToCell::combine(topoSet& set, const bool add) const
|
|||||||
if (!hasMatched)
|
if (!hasMatched)
|
||||||
{
|
{
|
||||||
WarningInFunction
|
WarningInFunction
|
||||||
<< "Cannot find any cellZone named " << zoneName_ << nl
|
<< "Cannot find any cellZone matching "
|
||||||
|
<< flatOutput(selectedZones_) << nl
|
||||||
<< "Valid names: " << flatOutput(mesh_.cellZones().names())
|
<< "Valid names: " << flatOutput(mesh_.cellZones().names())
|
||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
@ -89,11 +90,11 @@ void Foam::zoneToCell::combine(topoSet& set, const bool add) const
|
|||||||
Foam::zoneToCell::zoneToCell
|
Foam::zoneToCell::zoneToCell
|
||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
const word& zoneName
|
const wordRe& zoneName
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
topoSetSource(mesh),
|
topoSetSource(mesh),
|
||||||
zoneName_(zoneName)
|
selectedZones_(one(), zoneName)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -104,8 +105,16 @@ Foam::zoneToCell::zoneToCell
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
topoSetSource(mesh),
|
topoSetSource(mesh),
|
||||||
zoneName_(dict.get<wordRe>("name"))
|
selectedZones_()
|
||||||
{}
|
{
|
||||||
|
// Look for 'zones' and 'zone', but accept 'name' as well
|
||||||
|
if (!dict.readIfPresent("zones", selectedZones_))
|
||||||
|
{
|
||||||
|
selectedZones_.resize(1);
|
||||||
|
selectedZones_.first() =
|
||||||
|
dict.getCompat<wordRe>("zone", {{"name", 1806}});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::zoneToCell::zoneToCell
|
Foam::zoneToCell::zoneToCell
|
||||||
@ -115,7 +124,7 @@ Foam::zoneToCell::zoneToCell
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
topoSetSource(mesh),
|
topoSetSource(mesh),
|
||||||
zoneName_(checkIs(is))
|
selectedZones_(one(), wordRe(checkIs(is)))
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -129,15 +138,15 @@ void Foam::zoneToCell::applyToSet
|
|||||||
{
|
{
|
||||||
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
|
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
|
||||||
{
|
{
|
||||||
Info<< " Adding all cells of cellZone " << zoneName_ << " ..."
|
Info<< " Adding all cells of cell zones "
|
||||||
<< endl;
|
<< flatOutput(selectedZones_) << " ..." << endl;
|
||||||
|
|
||||||
combine(set, true);
|
combine(set, true);
|
||||||
}
|
}
|
||||||
else if (action == topoSetSource::DELETE)
|
else if (action == topoSetSource::DELETE)
|
||||||
{
|
{
|
||||||
Info<< " Removing all cells of cellZone " << zoneName_ << " ..."
|
Info<< " Removing all cells of cell zones "
|
||||||
<< endl;
|
<< flatOutput(selectedZones_) << " ..." << endl;
|
||||||
|
|
||||||
combine(set, false);
|
combine(set, false);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,14 +25,19 @@ Class
|
|||||||
Foam::zoneToCell
|
Foam::zoneToCell
|
||||||
|
|
||||||
Description
|
Description
|
||||||
A topoSetSource to select cells based on cellZone.
|
A topoSetSource to select cells based on one or more cellZones.
|
||||||
|
|
||||||
\heading Dictionary parameters
|
\heading Dictionary parameters
|
||||||
\table
|
\table
|
||||||
Property | Description | Required | Default
|
Property | Description | Required | Default
|
||||||
name | The cell zone name or regex | yes |
|
zone | The cell zone name or regex | possibly |
|
||||||
|
zones | The cell zone names or regexs | possibly |
|
||||||
|
name | Older specification for 'zone' | no |
|
||||||
\endtable
|
\endtable
|
||||||
|
|
||||||
|
Note
|
||||||
|
Selection of multiple zones has precedence.
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
zoneToCell.C
|
zoneToCell.C
|
||||||
|
|
||||||
@ -42,7 +47,7 @@ SourceFiles
|
|||||||
#define zoneToCell_H
|
#define zoneToCell_H
|
||||||
|
|
||||||
#include "topoSetSource.H"
|
#include "topoSetSource.H"
|
||||||
#include "wordRe.H"
|
#include "wordRes.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -63,8 +68,8 @@ class zoneToCell
|
|||||||
//- Add usage string
|
//- Add usage string
|
||||||
static addToUsageTable usage_;
|
static addToUsageTable usage_;
|
||||||
|
|
||||||
//- Name/regular expression of cellZone
|
//- Matcher for zones
|
||||||
wordRe zoneName_;
|
wordRes selectedZones_;
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
@ -80,11 +85,7 @@ public:
|
|||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from components
|
//- Construct from components
|
||||||
zoneToCell
|
zoneToCell(const polyMesh& mesh, const wordRe& zoneName);
|
||||||
(
|
|
||||||
const polyMesh& mesh,
|
|
||||||
const word& zoneName
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Construct from dictionary
|
//- Construct from dictionary
|
||||||
zoneToCell(const polyMesh& mesh, const dictionary& dict);
|
zoneToCell(const polyMesh& mesh, const dictionary& dict);
|
||||||
@ -99,7 +100,7 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
virtual sourceType setType() const
|
virtual topoSetSource::sourceType setType() const
|
||||||
{
|
{
|
||||||
return CELLSETSOURCE;
|
return CELLSETSOURCE;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -54,7 +54,7 @@ void Foam::zoneToFace::combine(topoSet& set, const bool add) const
|
|||||||
|
|
||||||
for (const faceZone& zone : mesh_.faceZones())
|
for (const faceZone& zone : mesh_.faceZones())
|
||||||
{
|
{
|
||||||
if (zoneName_.match(zone.name()))
|
if (selectedZones_.match(zone.name()))
|
||||||
{
|
{
|
||||||
hasMatched = true;
|
hasMatched = true;
|
||||||
|
|
||||||
@ -77,8 +77,10 @@ void Foam::zoneToFace::combine(topoSet& set, const bool add) const
|
|||||||
if (!hasMatched)
|
if (!hasMatched)
|
||||||
{
|
{
|
||||||
WarningInFunction
|
WarningInFunction
|
||||||
<< "Cannot find any faceZone named " << zoneName_ << endl
|
<< "Cannot find any faceZone matching "
|
||||||
<< "Valid names are " << mesh_.faceZones().names() << endl;
|
<< flatOutput(selectedZones_) << nl
|
||||||
|
<< "Valid names are " << flatOutput(mesh_.faceZones().names())
|
||||||
|
<< endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,11 +90,11 @@ void Foam::zoneToFace::combine(topoSet& set, const bool add) const
|
|||||||
Foam::zoneToFace::zoneToFace
|
Foam::zoneToFace::zoneToFace
|
||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
const word& zoneName
|
const wordRe& zoneName
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
topoSetSource(mesh),
|
topoSetSource(mesh),
|
||||||
zoneName_(zoneName)
|
selectedZones_(one(), zoneName)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -103,8 +105,16 @@ Foam::zoneToFace::zoneToFace
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
topoSetSource(mesh),
|
topoSetSource(mesh),
|
||||||
zoneName_(dict.get<wordRe>("name"))
|
selectedZones_()
|
||||||
{}
|
{
|
||||||
|
// Look for 'zones' and 'zone', but accept 'name' as well
|
||||||
|
if (!dict.readIfPresent("zones", selectedZones_))
|
||||||
|
{
|
||||||
|
selectedZones_.resize(1);
|
||||||
|
selectedZones_.first() =
|
||||||
|
dict.getCompat<wordRe>("zone", {{"name", 1806}});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::zoneToFace::zoneToFace
|
Foam::zoneToFace::zoneToFace
|
||||||
@ -114,7 +124,7 @@ Foam::zoneToFace::zoneToFace
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
topoSetSource(mesh),
|
topoSetSource(mesh),
|
||||||
zoneName_(checkIs(is))
|
selectedZones_(one(), wordRe(checkIs(is)))
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -128,15 +138,15 @@ void Foam::zoneToFace::applyToSet
|
|||||||
{
|
{
|
||||||
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
|
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
|
||||||
{
|
{
|
||||||
Info<< " Adding all faces of faceZone " << zoneName_ << " ..."
|
Info<< " Adding all faces of face zones "
|
||||||
<< endl;
|
<< flatOutput(selectedZones_) << " ..." << endl;
|
||||||
|
|
||||||
combine(set, true);
|
combine(set, true);
|
||||||
}
|
}
|
||||||
else if (action == topoSetSource::DELETE)
|
else if (action == topoSetSource::DELETE)
|
||||||
{
|
{
|
||||||
Info<< " Removing all faces of faceZone " << zoneName_ << " ..."
|
Info<< " Removing all faces of face zones "
|
||||||
<< endl;
|
<< flatOutput(selectedZones_) << " ..." << endl;
|
||||||
|
|
||||||
combine(set, false);
|
combine(set, false);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,14 +25,19 @@ Class
|
|||||||
Foam::zoneToFace
|
Foam::zoneToFace
|
||||||
|
|
||||||
Description
|
Description
|
||||||
A topoSetSource to select faces based on faceZone.
|
A topoSetSource to select faces based on one of more faceZones.
|
||||||
|
|
||||||
\heading Dictionary parameters
|
\heading Dictionary parameters
|
||||||
\table
|
\table
|
||||||
Property | Description | Required | Default
|
Property | Description | Required | Default
|
||||||
name | The face zone name or regex | yes |
|
zone | The face zone name or regex | possibly |
|
||||||
|
zones | The face zone names or regexs | possibly |
|
||||||
|
name | Older specification for 'zone' | no |
|
||||||
\endtable
|
\endtable
|
||||||
|
|
||||||
|
Note
|
||||||
|
Selection of multiple zones has precedence.
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
zoneToFace.C
|
zoneToFace.C
|
||||||
|
|
||||||
@ -42,7 +47,7 @@ SourceFiles
|
|||||||
#define zoneToFace_H
|
#define zoneToFace_H
|
||||||
|
|
||||||
#include "topoSetSource.H"
|
#include "topoSetSource.H"
|
||||||
#include "wordRe.H"
|
#include "wordRes.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -63,8 +68,8 @@ class zoneToFace
|
|||||||
//- Add usage string
|
//- Add usage string
|
||||||
static addToUsageTable usage_;
|
static addToUsageTable usage_;
|
||||||
|
|
||||||
//- Name/regular expression of the faceZone
|
//- Matcher for zones
|
||||||
wordRe zoneName_;
|
wordRes selectedZones_;
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
@ -80,11 +85,7 @@ public:
|
|||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from components
|
//- Construct from components
|
||||||
zoneToFace
|
zoneToFace(const polyMesh& mesh, const wordRe& zoneName);
|
||||||
(
|
|
||||||
const polyMesh& mesh,
|
|
||||||
const word& zoneName
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Construct from dictionary
|
//- Construct from dictionary
|
||||||
zoneToFace(const polyMesh& mesh, const dictionary& dict);
|
zoneToFace(const polyMesh& mesh, const dictionary& dict);
|
||||||
@ -99,7 +100,7 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
virtual sourceType setType() const
|
virtual topoSetSource::sourceType setType() const
|
||||||
{
|
{
|
||||||
return FACESETSOURCE;
|
return FACESETSOURCE;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -54,7 +54,7 @@ void Foam::zoneToPoint::combine(topoSet& set, const bool add) const
|
|||||||
|
|
||||||
for (const pointZone& zone : mesh_.pointZones())
|
for (const pointZone& zone : mesh_.pointZones())
|
||||||
{
|
{
|
||||||
if (zoneName_.match(zone.name()))
|
if (selectedZones_.match(zone.name()))
|
||||||
{
|
{
|
||||||
hasMatched = true;
|
hasMatched = true;
|
||||||
|
|
||||||
@ -77,7 +77,8 @@ void Foam::zoneToPoint::combine(topoSet& set, const bool add) const
|
|||||||
if (!hasMatched)
|
if (!hasMatched)
|
||||||
{
|
{
|
||||||
WarningInFunction
|
WarningInFunction
|
||||||
<< "Cannot find any pointZone named " << zoneName_ << nl
|
<< "Cannot find any pointZone matching "
|
||||||
|
<< flatOutput(selectedZones_) << nl
|
||||||
<< "Valid names: " << flatOutput(mesh_.pointZones().names())
|
<< "Valid names: " << flatOutput(mesh_.pointZones().names())
|
||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
@ -89,11 +90,11 @@ void Foam::zoneToPoint::combine(topoSet& set, const bool add) const
|
|||||||
Foam::zoneToPoint::zoneToPoint
|
Foam::zoneToPoint::zoneToPoint
|
||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
const word& zoneName
|
const wordRe& zoneName
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
topoSetSource(mesh),
|
topoSetSource(mesh),
|
||||||
zoneName_(zoneName)
|
selectedZones_(one(), zoneName)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -104,8 +105,16 @@ Foam::zoneToPoint::zoneToPoint
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
topoSetSource(mesh),
|
topoSetSource(mesh),
|
||||||
zoneName_(dict.get<wordRe>("name"))
|
selectedZones_()
|
||||||
{}
|
{
|
||||||
|
// Look for 'zones' and 'zone', but accept 'name' as well
|
||||||
|
if (!dict.readIfPresent("zones", selectedZones_))
|
||||||
|
{
|
||||||
|
selectedZones_.resize(1);
|
||||||
|
selectedZones_.first() =
|
||||||
|
dict.getCompat<wordRe>("zone", {{"name", 1806}});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::zoneToPoint::zoneToPoint
|
Foam::zoneToPoint::zoneToPoint
|
||||||
@ -115,7 +124,7 @@ Foam::zoneToPoint::zoneToPoint
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
topoSetSource(mesh),
|
topoSetSource(mesh),
|
||||||
zoneName_(checkIs(is))
|
selectedZones_(one(), wordRe(checkIs(is)))
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -129,15 +138,15 @@ void Foam::zoneToPoint::applyToSet
|
|||||||
{
|
{
|
||||||
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
|
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
|
||||||
{
|
{
|
||||||
Info<< " Adding all points of pointZone " << zoneName_ << " ..."
|
Info<< " Adding all points of point zones "
|
||||||
<< endl;
|
<< flatOutput(selectedZones_) << " ..." << endl;
|
||||||
|
|
||||||
combine(set, true);
|
combine(set, true);
|
||||||
}
|
}
|
||||||
else if (action == topoSetSource::DELETE)
|
else if (action == topoSetSource::DELETE)
|
||||||
{
|
{
|
||||||
Info<< " Removing all points of pointZone " << zoneName_ << " ..."
|
Info<< " Removing all points of point zones "
|
||||||
<< endl;
|
<< flatOutput(selectedZones_) << " ..." << endl;
|
||||||
|
|
||||||
combine(set, false);
|
combine(set, false);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,14 +25,19 @@ Class
|
|||||||
Foam::zoneToPoint
|
Foam::zoneToPoint
|
||||||
|
|
||||||
Description
|
Description
|
||||||
A topoSetSource to select points based on pointZone.
|
A topoSetSource to select points based on one or more pointZones.
|
||||||
|
|
||||||
\heading Dictionary parameters
|
\heading Dictionary parameters
|
||||||
\table
|
\table
|
||||||
Property | Description | Required | Default
|
Property | Description | Required | Default
|
||||||
name | The point zone name or regex | yes |
|
zone | The point zone name or regex | possibly |
|
||||||
|
zones | The point zone names or regexs | possibly |
|
||||||
|
name | Older specification for 'zone' | no |
|
||||||
\endtable
|
\endtable
|
||||||
|
|
||||||
|
Note
|
||||||
|
Selection of multiple zones has precedence.
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
zoneToPoint.C
|
zoneToPoint.C
|
||||||
|
|
||||||
@ -42,7 +47,7 @@ SourceFiles
|
|||||||
#define zoneToPoint_H
|
#define zoneToPoint_H
|
||||||
|
|
||||||
#include "topoSetSource.H"
|
#include "topoSetSource.H"
|
||||||
#include "wordRe.H"
|
#include "wordRes.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -63,8 +68,8 @@ class zoneToPoint
|
|||||||
//- Add usage string
|
//- Add usage string
|
||||||
static addToUsageTable usage_;
|
static addToUsageTable usage_;
|
||||||
|
|
||||||
//- Name/regular expression of zone
|
//- Matcher for zones
|
||||||
wordRe zoneName_;
|
wordRes selectedZones_;
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
@ -80,11 +85,7 @@ public:
|
|||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from components
|
//- Construct from components
|
||||||
zoneToPoint
|
zoneToPoint(const polyMesh& mesh, const wordRe& zoneName);
|
||||||
(
|
|
||||||
const polyMesh& mesh,
|
|
||||||
const word& zoneName
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Construct from dictionary
|
//- Construct from dictionary
|
||||||
zoneToPoint(const polyMesh& mesh, const dictionary& dict);
|
zoneToPoint(const polyMesh& mesh, const dictionary& dict);
|
||||||
@ -99,7 +100,7 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
virtual sourceType setType() const
|
virtual topoSetSource::sourceType setType() const
|
||||||
{
|
{
|
||||||
return POINTSETSOURCE;
|
return POINTSETSOURCE;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -148,11 +148,7 @@ Foam::autoPtr<Foam::topoSetSource> Foam::topoSetSource::New
|
|||||||
|
|
||||||
Foam::Istream& Foam::topoSetSource::checkIs(Istream& is)
|
Foam::Istream& Foam::topoSetSource::checkIs(Istream& is)
|
||||||
{
|
{
|
||||||
if (is.good() && !is.eof())
|
if (!is.good() || is.eof())
|
||||||
{
|
|
||||||
return is;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
|
|||||||
@ -25,7 +25,7 @@ actions
|
|||||||
source zoneToCell;
|
source zoneToCell;
|
||||||
sourceInfo
|
sourceInfo
|
||||||
{
|
{
|
||||||
name cylinder;
|
zone cylinder;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
|||||||
@ -25,17 +25,7 @@ actions
|
|||||||
source zoneToCell;
|
source zoneToCell;
|
||||||
sourceInfo
|
sourceInfo
|
||||||
{
|
{
|
||||||
name cylinder;
|
zones (cylinder innerCylinder);
|
||||||
}
|
|
||||||
}
|
|
||||||
{
|
|
||||||
name rotorCells;
|
|
||||||
type cellSet;
|
|
||||||
action add;
|
|
||||||
source zoneToCell;
|
|
||||||
sourceInfo
|
|
||||||
{
|
|
||||||
name innerCylinder;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
|||||||
@ -46,13 +46,15 @@ FoamFile
|
|||||||
// // Cells in cell zone
|
// // Cells in cell zone
|
||||||
// source zoneToCell;
|
// source zoneToCell;
|
||||||
// {
|
// {
|
||||||
// name ".*Zone"; // Name of cellZone, regular expressions allowed
|
// zones (".*Zone"); // Name of cellZones, regular expressions allowed
|
||||||
|
// zone ".*Zone"; // Name of cellZone, regular expressions allowed
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// // Cells on master or slave side of faceZone
|
// // Cells on master or slave side of faceZone
|
||||||
// source faceZoneToCell;
|
// source faceZoneToCell;
|
||||||
// {
|
// {
|
||||||
// name ".*Zone"; // Name of faceZone, regular expressions allowed
|
// zones (".*Zone"); // Name of faceZones, regular expressions allowed
|
||||||
|
// zone ".*Zone"; // Name of faceZone, regular expressions allowed
|
||||||
// option master; // master/slave
|
// option master; // master/slave
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
@ -190,7 +192,7 @@ FoamFile
|
|||||||
// // All faces of faceZone
|
// // All faces of faceZone
|
||||||
// source zoneToFace;
|
// source zoneToFace;
|
||||||
// {
|
// {
|
||||||
// name ".*Zone1"; // Name of faceZone, regular expressions allowed
|
// zone ".*Zone1"; // Name of faceZone, regular expressions allowed
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// // Faces with face centre within box
|
// // Faces with face centre within box
|
||||||
@ -240,7 +242,7 @@ FoamFile
|
|||||||
// // All points in pointzone
|
// // All points in pointzone
|
||||||
// source zoneToPoint;
|
// source zoneToPoint;
|
||||||
// {
|
// {
|
||||||
// name ".*Zone"; // name of pointZone, regular expressions allowed
|
// zone ".*Zone"; // name of pointZone, regular expressions allowed
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// // Points nearest to coordinates
|
// // Points nearest to coordinates
|
||||||
|
|||||||
@ -27,7 +27,7 @@ actions
|
|||||||
source zoneToCell;
|
source zoneToCell;
|
||||||
sourceInfo
|
sourceInfo
|
||||||
{
|
{
|
||||||
name topBlock;
|
zone topBlock;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -39,7 +39,7 @@ actions
|
|||||||
source zoneToCell;
|
source zoneToCell;
|
||||||
sourceInfo
|
sourceInfo
|
||||||
{
|
{
|
||||||
name centralBlock;
|
zone centralBlock;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,7 +51,7 @@ actions
|
|||||||
source zoneToCell;
|
source zoneToCell;
|
||||||
sourceInfo
|
sourceInfo
|
||||||
{
|
{
|
||||||
name bottomBlock;
|
zone bottomBlock;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -24,7 +24,7 @@ actions
|
|||||||
source zoneToCell;
|
source zoneToCell;
|
||||||
sourceInfo
|
sourceInfo
|
||||||
{
|
{
|
||||||
name rotor;
|
zone rotor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
@ -24,7 +24,7 @@ actions
|
|||||||
source zoneToCell;
|
source zoneToCell;
|
||||||
sourceInfo
|
sourceInfo
|
||||||
{
|
{
|
||||||
name rotor;
|
zone rotor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
@ -24,7 +24,7 @@ actions
|
|||||||
source zoneToCell;
|
source zoneToCell;
|
||||||
sourceInfo
|
sourceInfo
|
||||||
{
|
{
|
||||||
name rotor;
|
zone rotor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
@ -24,7 +24,7 @@ actions
|
|||||||
source zoneToCell;
|
source zoneToCell;
|
||||||
sourceInfo
|
sourceInfo
|
||||||
{
|
{
|
||||||
name rotor;
|
zone rotor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
@ -23,7 +23,7 @@ actions
|
|||||||
source zoneToCell;
|
source zoneToCell;
|
||||||
sourceInfo
|
sourceInfo
|
||||||
{
|
{
|
||||||
name background;
|
zone background;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
@ -33,7 +33,7 @@ actions
|
|||||||
source zoneToCell;
|
source zoneToCell;
|
||||||
sourceInfo
|
sourceInfo
|
||||||
{
|
{
|
||||||
name hullBox;
|
zone hullBox;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
@ -43,7 +43,7 @@ actions
|
|||||||
source zoneToCell;
|
source zoneToCell;
|
||||||
sourceInfo
|
sourceInfo
|
||||||
{
|
{
|
||||||
name propeller;
|
zone propeller;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
@ -53,7 +53,7 @@ actions
|
|||||||
source zoneToCell;
|
source zoneToCell;
|
||||||
sourceInfo
|
sourceInfo
|
||||||
{
|
{
|
||||||
name rudder;
|
zone rudder;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -23,7 +23,7 @@ actions
|
|||||||
source zoneToCell;
|
source zoneToCell;
|
||||||
sourceInfo
|
sourceInfo
|
||||||
{
|
{
|
||||||
name background;
|
zone background;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
@ -33,7 +33,7 @@ actions
|
|||||||
source zoneToCell;
|
source zoneToCell;
|
||||||
sourceInfo
|
sourceInfo
|
||||||
{
|
{
|
||||||
name hullBox;
|
zone hullBox;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
@ -43,7 +43,7 @@ actions
|
|||||||
source zoneToCell;
|
source zoneToCell;
|
||||||
sourceInfo
|
sourceInfo
|
||||||
{
|
{
|
||||||
name propeller;
|
zone propeller;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
@ -53,7 +53,7 @@ actions
|
|||||||
source zoneToCell;
|
source zoneToCell;
|
||||||
sourceInfo
|
sourceInfo
|
||||||
{
|
{
|
||||||
name rudder;
|
zone rudder;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -23,7 +23,7 @@ actions
|
|||||||
source zoneToCell;
|
source zoneToCell;
|
||||||
sourceInfo
|
sourceInfo
|
||||||
{
|
{
|
||||||
name background;
|
zone background;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
@ -33,7 +33,7 @@ actions
|
|||||||
source zoneToCell;
|
source zoneToCell;
|
||||||
sourceInfo
|
sourceInfo
|
||||||
{
|
{
|
||||||
name hullBox;
|
zone hullBox;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
@ -43,7 +43,7 @@ actions
|
|||||||
source zoneToCell;
|
source zoneToCell;
|
||||||
sourceInfo
|
sourceInfo
|
||||||
{
|
{
|
||||||
name propeller;
|
zone propeller;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
@ -53,7 +53,7 @@ actions
|
|||||||
source zoneToCell;
|
source zoneToCell;
|
||||||
sourceInfo
|
sourceInfo
|
||||||
{
|
{
|
||||||
name rudder;
|
zone rudder;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -24,7 +24,7 @@ actions
|
|||||||
source zoneToCell;
|
source zoneToCell;
|
||||||
sourceInfo
|
sourceInfo
|
||||||
{
|
{
|
||||||
name rotor;
|
zone rotor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
@ -24,7 +24,7 @@ actions
|
|||||||
source zoneToCell;
|
source zoneToCell;
|
||||||
sourceInfo
|
sourceInfo
|
||||||
{
|
{
|
||||||
name rotor;
|
zone rotor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
@ -24,7 +24,7 @@ actions
|
|||||||
source zoneToCell;
|
source zoneToCell;
|
||||||
sourceInfo
|
sourceInfo
|
||||||
{
|
{
|
||||||
name rotor;
|
zone rotor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user