COMP: silence warnings, fix transcription error for planeToFaceZone

ENH: add construct from components

STYLE: adjust action variable name for consistency
This commit is contained in:
Mark Olesen
2020-11-16 10:32:36 +01:00
parent 8969110f2a
commit 24c9761429
2 changed files with 42 additions and 18 deletions

View File

@ -73,12 +73,12 @@ Foam::topoSetSource::addToUsageTable Foam::planeToFaceZone::usage_
const Foam::Enum
<
Foam::planeToFaceZone::faceZoneAction
Foam::planeToFaceZone::faceAction
>
Foam::planeToFaceZone::faceZoneActionNames_
Foam::planeToFaceZone::faceActionNames_
({
{ faceZoneAction::ALL, "all" },
{ faceZoneAction::CLOSEST, "closest" },
{ faceAction::ALL, "all" },
{ faceAction::CLOSEST, "closest" },
});
@ -112,14 +112,14 @@ void Foam::planeToFaceZone::combine(faceZoneSet& fzSet, const bool add) const
patch.coupled() && cellIsAbovePlane[mesh_.faceOwner()[facei]];
}
}
syncTools::syncFaceList(mesh_, faceIsOnPlane, notEqualOp<bool>());
syncTools::syncFaceList(mesh_, faceIsOnPlane, xorEqOp<bool>());
// Convert marked faces to a list of indices
labelList newSetFaces(findIndices(faceIsOnPlane, true));
// If constructing a single contiguous set, remove all faces except those
// connected to the contiguous region closest to the specified point
if (option_ == faceZoneAction::CLOSEST)
if (option_ == faceAction::CLOSEST)
{
// Step 1: Get locally contiguous regions for the new face set and the
// total number of regions across all processors.
@ -188,7 +188,7 @@ void Foam::planeToFaceZone::combine(faceZoneSet& fzSet, const bool add) const
(
mesh_,
meshEdgeRegions,
globalMeshData::ListPlusEqOp<labelList>(),
ListOps::appendEqOp<label>(),
labelList()
);
@ -367,15 +367,30 @@ void Foam::planeToFaceZone::combine(faceZoneSet& fzSet, const bool add) const
Foam::planeToFaceZone::planeToFaceZone
(
const polyMesh& mesh,
const dictionary& dict
const point& basePoint,
const vector& normal,
const faceAction action
)
:
topoSetFaceZoneSource(mesh),
point_(dict.get<vector>("point")),
normal_(dict.get<vector>("normal")),
option_
point_(basePoint),
normal_(normal),
option_(action)
{}
Foam::planeToFaceZone::planeToFaceZone
(
faceZoneActionNames_.getOrDefault("option", dict, faceZoneAction::ALL)
const polyMesh& mesh,
const dictionary& dict
)
:
planeToFaceZone
(
mesh,
dict.get<vector>("point"),
dict.get<vector>("normal"),
faceActionNames_.getOrDefault("option", dict, faceAction::ALL)
)
{}
@ -389,7 +404,7 @@ Foam::planeToFaceZone::planeToFaceZone
topoSetFaceZoneSource(mesh),
point_(checkIs(is)),
normal_(checkIs(is)),
option_(faceZoneActionNames_.read(checkIs(is)))
option_(faceActionNames_.read(checkIs(is)))
{}

View File

@ -34,8 +34,8 @@ Description
Operands:
\table
Operand | Type | Location
output 1 | faceSet | $FOAM_CASE/constant/polyMesh/sets/\<set\>
output 2 | faceZone | $FOAM_CASE/constant/polyMesh/faceZones
output 1 | faceSet | \<constant\>/polyMesh/sets/\<set\>
output 2 | faceZone | \<constant\>/polyMesh/faceZones
\endtable
Usage
@ -119,7 +119,7 @@ class planeToFaceZone
public:
//- Enumeration defining the valid options
enum faceZoneAction
enum faceAction
{
ALL, //<!- Select all faces that meet the criteria
CLOSEST //<!- Select faces belong to the closest contiguous plane
@ -134,7 +134,7 @@ private:
static addToUsageTable usage_;
//- Plane selection methods
static const Enum<faceZoneAction> faceZoneActionNames_;
static const Enum<faceAction> faceActionNames_;
//- Point on the input plane
const vector point_;
@ -143,7 +143,7 @@ private:
const vector normal_;
//- Input plane selection method
const faceZoneAction option_;
const faceAction option_;
// Private Member Functions
@ -162,6 +162,15 @@ public:
//- No default construct
planeToFaceZone() = delete;
//- Construct from components
planeToFaceZone
(
const polyMesh& mesh,
const point& basePoint,
const vector& normal,
const faceAction action = faceAction::ALL
);
//- Construct from dictionary
planeToFaceZone(const polyMesh& mesh, const dictionary& dict);