67 planeToFaceZone::typeName,
68 "\n Usage: planeToFaceZone (px py pz) (nx ny nz) include\n\n"
69 " Select faces for which the adjacent cell centres lie on opposite "
78Foam::planeToFaceZone::faceActionNames_
80 { faceAction::ALL,
"all" },
81 { faceAction::CLOSEST,
"closest" },
95 cellIsAbovePlane.set(celli);
109 faceIsOnPlane.set(facei);
117 const label facei =
patch.start() + patchFacei;
120 faceIsOnPlane.set(facei);
127 labelList newSetFaces(faceIsOnPlane.sortedToc());
128 faceIsOnPlane.clear();
136 labelList newSetFaceRegions(newSetFaces.size(), -1);
142 UIndirectList<face>(
mesh_.
faces(), newSetFaces),
163 procRegionOffset[proci] =
164 procRegionOffset[proci - 1]
165 + procNRegions[proci - 1];
169 for (label& regioni : newSetFaceRegions)
175 nRegions = procRegionOffset.last() + procNRegions.last();
185 forAll(newSetFaces, newSetFacei)
187 const label facei = newSetFaces[newSetFacei];
188 const label regioni = newSetFaceRegions[newSetFacei];
191 meshEdgeRegions[edgei] =
labelList(one{}, regioni);
198 ListOps::appendEqOp<label>(),
204 List<bitSet> regionRegions(nRegions);
205 forAll(newSetFaces, newSetFacei)
207 const label facei = newSetFaces[newSetFacei];
208 const label regioni = newSetFaceRegions[newSetFacei];
212 regionRegions[regioni].set(meshEdgeRegions[edgei]);
214 forAll(regionRegions, regioni)
217 regionRegions[regioni].unset(regioni);
224 forAll(regionRegions, regioni)
226 for (
const label regi : regionRegions[regioni])
229 regionMap[regi] =
min(regionMap[regi], regionMap[regioni]);
239 forAll(regionMap, regioni)
241 if (regionMap[regioni] > regioni0)
244 regionMap[regioni] = regioni0;
249 nRegions = regioni0 + 1;
253 IndirectList<label>(regionMap, newSetFaceRegions);
257 for (
const label regioni : newSetFaceRegions)
259 ++ regionNFaces[regioni];
263 Info<<
" Found " << nRegions <<
" contiguous regions with "
264 << regionNFaces <<
" faces" <<
endl;
268 label selectedRegioni = -1;
273 forAll(newSetFaces, newSetFacei)
275 const label facei = newSetFaces[newSetFacei];
276 const label regioni = newSetFaceRegions[newSetFacei];
281 regionWeights[regioni] += w;
282 regionCentres[regioni] += w*
c;
289 regionCentres /= regionWeights;
303 Info<<
" Selecting region " << selectedRegioni <<
" with "
304 << regionNFaces[selectedRegioni]
305 <<
" faces as the closest to point " << point_ <<
endl;
311 label newSetFacei0 = 0;
312 forAll(newSetFaces, newSetFacei)
314 newSetFaces[newSetFacei0] = newSetFaces[newSetFacei];
316 if (newSetFaceRegions[newSetFacei] == selectedRegioni)
321 newSetFaces.resize(newSetFacei0);
326 DynamicList<label> newAddressing;
327 DynamicList<bool> newFlipMap;
331 newAddressing = fzSet.addressing();
332 newFlipMap = fzSet.flipMap();
335 const auto& exclude = fzSet;
336 for (
const label facei : newSetFaces)
338 if (!exclude.found(facei))
340 newAddressing.append(facei);
348 newAddressing.reserve(fzSet.addressing().size());
349 newFlipMap.reserve(newAddressing.capacity());
352 bitSet exclude(newSetFaces);
353 for (
const label facei : fzSet.addressing())
355 if (!exclude.found(facei))
357 newAddressing.append(facei);
362 fzSet.addressing().transfer(newAddressing);
363 fzSet.flipMap().transfer(newFlipMap);
373 const point& basePoint,
409 normal_(checkIs(is)),
410 option_(faceActionNames_.
read(checkIs(is)))
422 if (!isA<faceZoneSet>(set))
425 <<
"Operation only allowed on a faceZoneSet." <<
endl;
435 Info<<
" Adding faces that form a plane at "
436 << point_ <<
" with normal " << normal_ <<
endl;
445 Info<<
" Removing faces that form a plane at "
446 << point_ <<
" with normal " << normal_ <<
endl;
Macros for easy insertion into run-time selection tables.
#define addNamedToRunTimeSelectionTable(baseType, thisType, argNames, lookupName)
Add to construction table with 'lookupName' as the key.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
label nProcs() const noexcept
Number of ranks associated with PstreamBuffers.
static void allGatherList(const List< commsStruct > &comms, List< T > &values, const int tag, const label comm)
static void listCombineAllGather(const List< commsStruct > &comms, List< T > &values, const CombineOp &cop, const int tag, const label comm)
After completion all processors have the same data.
static void broadcast(Type &value, const label comm=UPstream::worldComm)
static void listCombineGather(const List< commsStruct > &comms, List< T > &values, const CombineOp &cop, const int tag, const label comm)
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Like faceSet but -reads data from faceZone -updates faceZone when writing.
A topoSetSource to select faces based on the adjacent cell centres spanning a given plane....
planeToFaceZone()=delete
No default construct.
virtual void applyToSet(const topoSetSource::setAction action, topoSet &) const
Apply specified action to the topoSet.
faceAction
Enumeration defining the valid options.
@ CLOSEST
Select faces belong to the closest contiguous plane.
Geometric class that creates a 3D plane and can return the intersection point between a line and the ...
Mesh consisting of general polyhedral cells.
virtual const faceList & faces() const
Return raw faces.
virtual const labelList & faceOwner() const
Return face owner.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
virtual const labelList & faceNeighbour() const
Return face neighbour.
virtual const pointField & points() const
Return raw points.
const vectorField & faceCentres() const
const vectorField & cellCentres() const
label nCells() const noexcept
Number of mesh cells.
label nFaces() const noexcept
Number of mesh faces.
const labelListList & faceEdges() const
const vectorField & faceAreas() const
const cellList & cells() const
label nEdges() const
Number of mesh edges.
int myProcNo() const noexcept
Return processor number.
splitCell * master() const
The topoSetFaceZoneSource is a intermediate class for handling topoSet sources for selecting face zon...
Class with constructor to add usage string to table.
Base class of a source for a topoSet.
setAction
Enumeration defining various actions.
@ SUBTRACT
Subtract elements from current set.
@ ADD
Add elements to current set.
@ NEW
Create a new set and ADD elements to it.
const polyMesh & mesh_
Reference to the mesh.
General set of labels of mesh quantity (points, cells, faces).
A class for handling words, derived from Foam::string.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
#define WarningInFunction
Report a warning using Foam::Warning.
const dimensionedScalar c
Speed of light in a vacuum.
const std::string patch
OpenFOAM patch number as a std::string.
labelList identity(const label len, label start=0)
Return an identity map of the given length with (map[i] == i)
bool read(const char *buf, int32_t &val)
Same as readInt32.
List< label > labelList
A List of labels.
label findMin(const ListType &input, label start=0)
messageStream Info
Information stream (stdout output on master, null elsewhere)
vectorField pointField
pointField is a vectorField.
vector point
Point is a vector.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Ostream & endl(Ostream &os)
Add newline and flush stream.
PrimitivePatch< UIndirectList< face >, const pointField & > uindirectPrimitivePatch
A PrimitivePatch with UIndirectList for the faces, const reference for the point field.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
List< labelList > labelListList
A List of labelList.
void add(FieldField< Field1, typename typeOfSum< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
static constexpr const zero Zero
Global zero (0)
T returnReduce(const T &value, const BinaryOp &bop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Reduce (copy) and return value.
dict add("bounds", meshBb)
#define forAll(list, i)
Loop across all elements in list.