60 planeToFaceZone::typeName,
61 "\n Usage: planeToFaceZone (px py pz) (nx ny nz) include\n\n" 62 " Select faces for which the adjacent cell centres lie on opposite " 69 void Foam::planeToFaceZone::combine(
faceZoneSet& fzSet,
const bool add)
const 72 boolList cellIsAbovePlane(mesh_.nCells());
73 forAll(mesh_.cells(), celli)
75 cellIsAbovePlane[celli] =
76 ((mesh_.cellCentres()[celli] - point_) & normal_) > 0;
80 boolList faceIsOnPlane(mesh_.nFaces());
81 forAll(mesh_.faceNeighbour(), facei)
83 faceIsOnPlane[facei] =
84 cellIsAbovePlane[mesh_.faceOwner()[facei]]
85 != cellIsAbovePlane[mesh_.faceNeighbour()[facei]];
92 const label facei = patch.
start() + patchFacei;
93 faceIsOnPlane[facei] =
94 patch.
coupled() && cellIsAbovePlane[mesh_.faceOwner()[facei]];
104 if (include_ == include::closest)
125 boolList(newSetPatch.nEdges(),
false),
136 procRegionOffset[proci] +=
137 procRegionOffset[proci - 1]
138 + procNRegions[proci - 1];
142 forAll(newSetFaces, newSetFacei)
144 newSetFaceRegions[newSetFacei] +=
149 nRegions = procRegionOffset.
last() + procNRegions.last();
159 forAll(newSetFaces, newSetFacei)
161 const label facei = newSetFaces[newSetFacei];
162 const label regioni = newSetFaceRegions[newSetFacei];
163 forAll(mesh_.faceEdges()[facei], faceEdgei)
165 const label edgei = mesh_.faceEdges()[facei][faceEdgei];
166 meshEdgeRegions[edgei] =
labelList(1, regioni);
180 forAll(newSetFaces, newSetFacei)
182 const label facei = newSetFaces[newSetFacei];
183 const label regioni = newSetFaceRegions[newSetFacei];
184 forAll(mesh_.faceEdges()[facei], faceEdgei)
186 const label edgei = mesh_.faceEdges()[facei][faceEdgei];
187 forAll(meshEdgeRegions[edgei], edgeRegioni)
189 if (meshEdgeRegions[edgei][edgeRegioni] != regioni)
191 regionRegions[regioni].insert
193 meshEdgeRegions[edgei][edgeRegioni]
204 forAll(regionRegions, regioni)
208 regionMap[iter.key()] =
209 min(regionMap[iter.key()], regionMap[regioni]);
219 forAll(regionMap, regioni)
221 if (regionMap[regioni] > regioni0)
224 regionMap[regioni] = regioni0;
229 nRegions = regioni0 + 1;
237 forAll(newSetFaces, newSetFacei)
239 regionNFaces[newSetFaceRegions[newSetFacei]] ++;
243 Info<<
" Found " << nRegions <<
" contiguous regions with " 244 << regionNFaces <<
" faces" <<
endl;
248 label selectedRegioni = -1;
253 forAll(newSetFaces, newSetFacei)
255 const label facei = newSetFaces[newSetFacei];
256 const label regioni = newSetFaceRegions[newSetFacei];
258 const vector& a = mesh_.faceAreas()[facei];
259 const point&
c = mesh_.faceCentres()[facei];
261 regionMagAreas[regioni] +=
mag(a);
262 regionCentres[regioni] +=
mag(a)*
c;
268 regionCentres /= regionMagAreas;
279 Info<<
" Selecting region " << selectedRegioni <<
" with " 280 << regionNFaces[selectedRegioni]
281 <<
" faces as the closest to point " << point_ <<
endl;
287 label newSetFacei0 = 0;
288 forAll(newSetFaces, newSetFacei)
290 newSetFaces[newSetFacei0] = newSetFaces[newSetFacei];
292 if (newSetFaceRegions[newSetFacei] == selectedRegioni)
297 newSetFaces.
resize(newSetFacei0);
311 forAll(newSetFaces, newSetFacei)
313 const label facei = newSetFaces[newSetFacei];
315 if (!fzSet.
found(facei))
317 newAddressing.
append(facei);
318 newFlipMap.
append(cellIsAbovePlane[mesh_.faceOwner()[facei]]);
334 if (!newSet.found(facei))
336 newAddressing.
append(facei);
337 newFlipMap.
append(cellIsAbovePlane[mesh_.faceOwner()[facei]]);
365 includeNames_[include::all]
380 normal_(checkIs(is)),
381 include_(includeNames_[
word(checkIs(is))])
399 if (!isA<faceZoneSet>(
set))
402 <<
"Operation only allowed on a faceZoneSet." <<
endl;
410 Info<<
" Adding faces which form a plane at " << point_
411 <<
" with normal " << normal_ <<
endl;
417 Info<<
" Removing faces which form a plane at " << point_
418 <<
" 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.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
A list of keyword definitions, which are a keyword followed by any number of values (e...
const polyBoundaryMesh & boundaryMesh() const
Return boundaryMesh reference.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
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.
AccessType combine(const List< T > &, AccessOp aop=accessOp< T >())
Combines sublists into one big list.
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.
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.
List< label > labelList
A List of labels.
virtual ~planeToFaceZone()
Destructor.
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
void add(FieldField< Field1, typename typeOfSum< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
defineTypeNameAndDebug(combustionModel, 0)
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
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.
Class with constructor to add usage string to table.
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.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.