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>(),
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);
355 const polyMesh&
mesh,
356 const dictionary&
dict
366 dict.lookupOrDefault<word>
369 includeNames_[include::
all]
390 if (!isA<faceZoneSet>(set))
393 <<
"Operation only allowed on a faceZoneSet." <<
endl;
397 faceZoneSet& fzSet = refCast<faceZoneSet>(set);
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)
virtual ~planeToFaceZone()
Destructor.
static const NamedEnum< include, 2 > includeNames_
Included region names.
virtual void applyToSet(const topoSetSource::setAction action, topoSet &) const
planeToFaceZone(const polyMesh &mesh, const dictionary &dict)
Construct from dictionary.
Motion of the mesh specified as a list of pointMeshMovers.
const polyBoundaryMesh & boundary() const
Return boundary mesh.
virtual const faceList & faces() const
Return raw faces.
virtual const labelList & faceOwner() const
Return face owner.
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
setAction
Enumeration defining the valid actions.
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.
const unitSet & lookup(const word &unitName)
Lookup and return the named unit from the table.
const dimensionSet & dimless
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)
void add(GeometricField< typename typeOfSum< Type1, Type2 >::type, GeoMesh, PrimitiveField1 > &gf, const GeometricField< Type1, GeoMesh, PrimitiveField2 > &gf1, const GeometricField< Type2, GeoMesh, PrimitiveField3 > &gf2)
Ostream & endl(Ostream &os)
Add newline and flush stream.
const dimensionSet & dimLength
labelList findIndices(const ListType &, typename ListType::const_reference, const label start=0)
Find all occurrences of given element. Linear search.
vectorField pointField
pointField is a vectorField.
List< bool > boolList
Bool container classes.
vector point
Point is a vector.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
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)
dimensioned< Type > min(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
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.
tmp< DimensionedField< scalar, GeoMesh, Field > > mag(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
labelList identityMap(const label len)
Create identity map (map[i] == i) of given length.
treeBoundBox combine(const treeBoundBox &a, const treeBoundBox &b)
defineTypeNameAndDebug(atmosphericBoundaryLayer, 0)