59 void Foam::planeToFaceZone::combine(faceZoneSet& fzSet,
const bool add)
const
65 cellIsAbovePlane[celli] =
73 faceIsOnPlane[facei] =
82 const label facei = patch.start() + patchFacei;
83 faceIsOnPlane[facei] =
94 if (include_ == include::closest)
98 labelList newSetFaceRegions(newSetFaces.size(), -1);
104 UIndirectList<face>(
mesh_.
faces(), newSetFaces),
115 boolList(newSetPatch.nEdges(),
false),
126 procRegionOffset[proci] +=
127 procRegionOffset[proci - 1]
128 + procNRegions[proci - 1];
132 forAll(newSetFaces, newSetFacei)
134 newSetFaceRegions[newSetFacei] +=
139 nRegions = procRegionOffset.last() + procNRegions.last();
149 forAll(newSetFaces, newSetFacei)
151 const label facei = newSetFaces[newSetFacei];
152 const label regioni = newSetFaceRegions[newSetFacei];
156 meshEdgeRegions[edgei] =
labelList(1, regioni);
163 globalMeshData::ListPlusEqOp<labelList>(),
169 List<labelHashSet> regionRegions(nRegions);
170 forAll(newSetFaces, newSetFacei)
172 const label facei = newSetFaces[newSetFacei];
173 const label regioni = newSetFaceRegions[newSetFacei];
177 forAll(meshEdgeRegions[edgei], edgeRegioni)
179 if (meshEdgeRegions[edgei][edgeRegioni] != regioni)
181 regionRegions[regioni].insert
183 meshEdgeRegions[edgei][edgeRegioni]
194 forAll(regionRegions, regioni)
198 regionMap[iter.key()] =
199 min(regionMap[iter.key()], regionMap[regioni]);
209 forAll(regionMap, regioni)
211 if (regionMap[regioni] > regioni0)
214 regionMap[regioni] = regioni0;
219 nRegions = regioni0 + 1;
223 IndirectList<label>(regionMap, newSetFaceRegions);
227 forAll(newSetFaces, newSetFacei)
229 regionNFaces[newSetFaceRegions[newSetFacei]] ++;
233 Info<<
" Found " << nRegions <<
" contiguous regions with "
234 << regionNFaces <<
" faces" <<
endl;
238 label selectedRegioni = -1;
243 forAll(newSetFaces, newSetFacei)
245 const label facei = newSetFaces[newSetFacei];
246 const label regioni = newSetFaceRegions[newSetFacei];
251 regionMagAreas[regioni] +=
mag(a);
252 regionCentres[regioni] +=
mag(a)*
c;
258 regionCentres /= regionMagAreas;
269 Info<<
" Selecting region " << selectedRegioni <<
" with "
270 << regionNFaces[selectedRegioni]
271 <<
" faces as the closest to point " << point_ <<
endl;
277 label newSetFacei0 = 0;
278 forAll(newSetFaces, newSetFacei)
280 newSetFaces[newSetFacei0] = newSetFaces[newSetFacei];
282 if (newSetFaceRegions[newSetFacei] == selectedRegioni)
287 newSetFaces.resize(newSetFacei0);
292 DynamicList<label> newAddressing;
293 DynamicList<bool> newFlipMap;
297 newAddressing = DynamicList<label>(fzSet.addressing());
298 newFlipMap = DynamicList<bool>(fzSet.flipMap());
301 forAll(newSetFaces, newSetFacei)
303 const label facei = newSetFaces[newSetFacei];
305 if (!fzSet.found(facei))
307 newAddressing.append(facei);
315 newAddressing = DynamicList<label>(fzSet.addressing().size());
316 newFlipMap = DynamicList<bool>(fzSet.flipMap().size());
320 forAll(fzSet.addressing(), i)
322 const label facei = fzSet.addressing()[i];
324 if (!newSet.found(facei))
326 newAddressing.append(facei);
331 fzSet.addressing().transfer(newAddressing);
332 fzSet.flipMap().transfer(newFlipMap);
376 if (!isA<faceZoneSet>(set))
379 <<
"Operation only allowed on a faceZoneSet." <<
endl;
387 Info<<
" Adding faces which form a plane at " << point_
388 <<
" with normal " << normal_ <<
endl;
394 Info<<
" Removing faces which form a plane at " << point_
395 <<
" 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 keyword definitions, which are a keyword followed by any number of values (e....
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
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.
#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.
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.
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.
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)
void add(FieldField< Field1, typename typeOfSum< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
dimensioned< scalar > mag(const dimensioned< Type > &)
defineTypeNameAndDebug(combustionModel, 0)
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.
treeBoundBox combine(const treeBoundBox &a, const treeBoundBox &b)
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)