52 void Foam::planeToFaceZone::combine(faceZoneSet& fzSet,
const bool add)
const
58 cellIsAbovePlane[celli] =
72 forAll(bFaceNbrCellIsAbovePlane, bFacei)
74 bFaceNbrCellIsAbovePlane[bFacei] =
75 ((bFaceNbrCellCentres[bFacei] - point_) & normal_) > 0;
83 faceIsOnPlane[facei] =
90 if (!patch.coupled())
continue;
93 const label facei = patch.start() + patchFacei;
94 faceIsOnPlane[facei] =
108 if (include_ == include::closest)
112 labelList newSetFaceRegions(newSetFaces.size(), -1);
118 UIndirectList<face>(
mesh_.
faces(), newSetFaces),
129 boolList(newSetPatch.nEdges(),
false),
140 procRegionOffset[proci] +=
141 procRegionOffset[proci - 1]
142 + procNRegions[proci - 1];
146 forAll(newSetFaces, newSetFacei)
148 newSetFaceRegions[newSetFacei] +=
153 nRegions = procRegionOffset.last() + procNRegions.last();
163 forAll(newSetFaces, newSetFacei)
165 const label facei = newSetFaces[newSetFacei];
166 const label regioni = newSetFaceRegions[newSetFacei];
170 meshEdgeRegions[edgei] =
labelList(1, regioni);
177 globalMeshData::ListPlusEqOp<labelList>(),
183 List<labelHashSet> regionRegions(nRegions);
184 forAll(newSetFaces, newSetFacei)
186 const label facei = newSetFaces[newSetFacei];
187 const label regioni = newSetFaceRegions[newSetFacei];
191 forAll(meshEdgeRegions[edgei], edgeRegioni)
193 if (meshEdgeRegions[edgei][edgeRegioni] != regioni)
195 regionRegions[regioni].insert
197 meshEdgeRegions[edgei][edgeRegioni]
208 forAll(regionRegions, regioni)
212 regionMap[iter.key()] =
213 min(regionMap[iter.key()], regionMap[regioni]);
223 forAll(regionMap, regioni)
225 if (regionMap[regioni] > regioni0)
228 regionMap[regioni] = regioni0;
233 nRegions = regioni0 + 1;
237 IndirectList<label>(regionMap, newSetFaceRegions);
241 forAll(newSetFaces, newSetFacei)
243 regionNFaces[newSetFaceRegions[newSetFacei]] ++;
247 Info<<
" Found " << nRegions <<
" contiguous regions with "
248 << regionNFaces <<
" faces" <<
endl;
252 label selectedRegioni = -1;
257 forAll(newSetFaces, newSetFacei)
259 const label facei = newSetFaces[newSetFacei];
260 const label regioni = newSetFaceRegions[newSetFacei];
265 regionMagAreas[regioni] +=
mag(a);
266 regionCentres[regioni] +=
mag(a)*
c;
272 regionCentres /= regionMagAreas;
283 Info<<
" Selecting region " << selectedRegioni <<
" with "
284 << regionNFaces[selectedRegioni]
285 <<
" faces as the closest to point " << point_ <<
endl;
291 label newSetFacei0 = 0;
292 forAll(newSetFaces, newSetFacei)
294 newSetFaces[newSetFacei0] = newSetFaces[newSetFacei];
296 if (newSetFaceRegions[newSetFacei] == selectedRegioni)
301 newSetFaces.resize(newSetFacei0);
306 DynamicList<label> newAddressing;
307 DynamicList<bool> newFlipMap;
311 newAddressing = DynamicList<label>(fzSet.addressing());
312 newFlipMap = DynamicList<bool>(fzSet.flipMap());
315 forAll(newSetFaces, newSetFacei)
317 const label facei = newSetFaces[newSetFacei];
319 if (!fzSet.found(facei))
321 newAddressing.append(facei);
329 newAddressing = DynamicList<label>(fzSet.addressing().size());
330 newFlipMap = DynamicList<bool>(fzSet.flipMap().size());
334 forAll(fzSet.addressing(), i)
336 const label facei = fzSet.addressing()[i];
338 if (!newSet.found(facei))
340 newAddressing.append(facei);
345 fzSet.addressing().transfer(newAddressing);
346 fzSet.flipMap().transfer(newFlipMap);
390 if (!isA<faceZoneSet>(set))
393 <<
"Operation only allowed on a faceZoneSet." <<
endl;
401 Info<<
" Adding faces which form a plane at " << point_
402 <<
" with normal " << normal_ <<
endl;
408 Info<<
" Removing faces which form a plane at " << point_
409 <<
" with normal " << normal_ <<
endl;
#define forAll(list, i)
Loop across all elements in list.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
Macros for easy insertion into run-time selection tables.
Initialise the NamedEnum HashTable from the static list of names.
static void scatterList(const List< commsStruct > &comms, List< T > &Values, const int tag, const label comm)
Scatter data. Reverse of gatherList.
static void listCombineGather(const List< commsStruct > &comms, List< T > &Value, const CombineOp &cop, const int tag, const label comm)
static void listCombineScatter(const List< commsStruct > &comms, List< T > &Value, const int tag, const label comm)
Scatter data. Reverse of combineGather.
static void gatherList(const List< commsStruct > &comms, List< T > &Values, const int tag, const label comm)
Gather data but keep individual values separate.
static label nProcs(const label communicator=0)
Number of processes in parallel run.
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
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....
virtual void applyToSet(const topoSetSource::setAction action, topoSet &) const
static const NamedEnum< include, 2 > includeNames_
Included region names.
include
Enumeration for what to include.
virtual ~planeToFaceZone()
Destructor.
planeToFaceZone(const polyMesh &mesh, const dictionary &dict)
Construct from dictionary.
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
label nInternalFaces() const
const vectorField & cellCentres() const
const labelListList & faceEdges() const
const vectorField & faceAreas() const
const cellList & cells() const
Base class of a source for a topoSet.
setAction
Enumeration defining the valid actions.
General set of labels of mesh quantity (points, cells, faces).
A class for handling words, derived from string.
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
#define WarningInFunction
Report a warning using Foam::Warning.
const dimensionedScalar c
Speed of light in a vacuum.
List< label > labelList
A List of labels.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
addToRunTimeSelectionTable(polyPatch, mergedCyclicPolyPatch, word)
Ostream & endl(Ostream &os)
Add newline and flush stream.
labelList findIndices(const ListType &, typename ListType::const_reference, const label start=0)
Find all occurrences of given element. Linear search.
const dimensionSet dimless
const dimensionSet dimLength
vectorField pointField
pointField is a vectorField.
List< bool > boolList
Bool container classes.
vector point
Point is a vector.
void mag(LagrangianPatchField< scalar > &f, const LagrangianPatchField< Type > &f1)
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
Vector< scalar > vector
A scalar version of the templated Vector.
PrimitivePatch< UIndirectList< face >, const pointField & > uindirectPrimitivePatch
Foam::uindirectPrimitivePatch.
List< labelList > labelListList
A List of labelList.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
defineTypeNameAndDebug(combustionModel, 0)
Field< vector > vectorField
Specialisation of Field<T> for vector.
label findMin(const ListType &, const label start=0)
Find index of min element (and less than given element).
HashSet< label, Hash< label > > labelHashSet
A HashSet with label keys.
labelList identityMap(const label len)
Create identity map (map[i] == i) of given length.
void add(LagrangianPatchField< typename typeOfSum< Type1, Type2 >::type > &f, const LagrangianPatchField< Type1 > &f1, const LagrangianPatchField< Type2 > &f2)
treeBoundBox combine(const treeBoundBox &a, const treeBoundBox &b)