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

View File

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