59 void Foam::planeToFaceZone::combine(
faceZoneSet& fzSet,
const bool add)
const 62 boolList cellIsAbovePlane(mesh_.nCells());
63 forAll(mesh_.cells(), celli)
65 cellIsAbovePlane[celli] =
66 ((mesh_.cellCentres()[celli] - point_) & normal_) > 0;
70 boolList faceIsOnPlane(mesh_.nFaces());
71 forAll(mesh_.faceNeighbour(), facei)
73 faceIsOnPlane[facei] =
74 cellIsAbovePlane[mesh_.faceOwner()[facei]]
75 != cellIsAbovePlane[mesh_.faceNeighbour()[facei]];
82 const label facei = patch.
start() + patchFacei;
83 faceIsOnPlane[facei] =
84 patch.
coupled() && cellIsAbovePlane[mesh_.faceOwner()[facei]];
94 if (include_ == include::closest)
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];
153 forAll(mesh_.faceEdges()[facei], faceEdgei)
155 const label edgei = mesh_.faceEdges()[facei][faceEdgei];
156 meshEdgeRegions[edgei] =
labelList(1, regioni);
170 forAll(newSetFaces, newSetFacei)
172 const label facei = newSetFaces[newSetFacei];
173 const label regioni = newSetFaceRegions[newSetFacei];
174 forAll(mesh_.faceEdges()[facei], faceEdgei)
176 const label edgei = mesh_.faceEdges()[facei][faceEdgei];
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;
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];
248 const vector& a = mesh_.faceAreas()[facei];
249 const point&
c = mesh_.faceCentres()[facei];
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);
301 forAll(newSetFaces, newSetFacei)
303 const label facei = newSetFaces[newSetFacei];
305 if (!fzSet.
found(facei))
307 newAddressing.
append(facei);
308 newFlipMap.
append(cellIsAbovePlane[mesh_.faceOwner()[facei]]);
324 if (!newSet.found(facei))
326 newAddressing.
append(facei);
327 newFlipMap.
append(cellIsAbovePlane[mesh_.faceOwner()[facei]]);
355 includeNames_[include::all]
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;
static void scatterList(const List< commsStruct > &comms, List< T > &Values, const int tag, const label comm)
Scatter data. Reverse of gatherList.
const boolList & flipMap() const
static void listCombineScatter(const List< commsStruct > &comms, List< T > &Value, const int tag, const label comm)
Scatter data. Reverse of combineGather.
#define forAll(list, i)
Loop across all elements in list.
A list of keyword definitions, which are a keyword followed by any number of values (e...
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
const polyBoundaryMesh & boundaryMesh() const
Return boundaryMesh reference.
void size(const label)
Override size to be inconsistent with allocated storage.
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
Ostream & endl(Ostream &os)
Add newline and flush stream.
labelList identity(const label len)
Create identity map (map[i] == i) of given length.
label findMin(const ListType &, const label start=0)
Find index of min element (and less than given element).
void resize(const label)
Alias for setSize(const label)
labelList findIndices(const ListType &, typename ListType::const_reference, const label start=0)
Find all occurrences of given element. Linear search.
Initialise the NamedEnum HashTable from the static list of names.
static void listCombineGather(const List< commsStruct > &comms, List< T > &Value, const CombineOp &cop, const int tag, const label comm)
const dimensionedScalar c
Speed of light in a vacuum.
Macros for easy insertion into run-time selection tables.
Base class of a source for a topoSet.
List< bool > boolList
Bool container classes.
static const NamedEnum< include, 2 > includeNames_
Included region names.
A list of faces which address into the list of points.
virtual bool coupled() const
Return true if this patch is geometrically coupled (i.e. faces and.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
bool found(const Key &) const
Return true if hashedEntry is found in table.
A class for handling words, derived from string.
setAction
Enumeration defining the valid actions.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
List< label > labelList
A List of labels.
virtual ~planeToFaceZone()
Destructor.
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
defineTypeNameAndDebug(combustionModel, 0)
void updateSet()
Sort addressing and make faceSet part consistent with addressing.
Like faceSet but -reads data from faceZone -updates faceZone when writing.
General set of labels of mesh quantity (points, cells, faces).
static label nProcs(const label communicator=0)
Number of processes in parallel run.
T lookupOrDefault(const word &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T,.
#define WarningInFunction
Report a warning using Foam::Warning.
A topoSetSource to select faces based on the adjacent cell centres spanning a given plane...
A List with indirect addressing.
label start() const
Return start label of this patch in the polyMesh face list.
planeToFaceZone(const polyMesh &mesh, const dictionary &dict)
Construct from dictionary.
dimensioned< scalar > mag(const dimensioned< Type > &)
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
Mesh consisting of general polyhedral cells.
virtual void applyToSet(const topoSetSource::setAction action, topoSet &) const
A patch is a list of labels that address the faces in the global face list.
T & last()
Return the last element of the list.
static void gatherList(const List< commsStruct > &comms, List< T > &Values, const int tag, const label comm)
Gather data but keep individual values separate.
const labelList & addressing() const
A List with indirect addressing.
void transfer(List< T > &)
Transfer the contents of the argument List into this list.
treeBoundBox combine(const treeBoundBox &a, const treeBoundBox &b)
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.