37 namespace zoneGenerators
59 boolList flipMap(faceIndices.size(),
false);
63 const label facei = faceIndices[fi];
65 if ((faceAreas[facei] & normal_) < 0)
80 if (fZone.checkParallelSync())
83 <<
"Face zone " << fZone.name()
84 <<
" is not parallel synchronised."
85 <<
" Any coupled face also needs its coupled version to be included"
86 <<
" and with opposite flipMap."
94 IndirectList<face>(mesh_.faces(), faceIndices),
101 List<patchFaceOrientation> allEdgeInfo(patch.nEdges());
102 List<patchFaceOrientation> allFaceInfo(patch.size());
108 const polyBoundaryMesh& bm = mesh_.boundaryMesh();
110 label nProtected = 0;
112 forAll(faceIndices, facei)
114 const label meshFacei = faceIndices[facei];
121 && !isMasterFace[meshFacei]
132 Info<<
"Protected from visiting "
134 <<
" slaves of coupled faces" <<
nl <<
endl;
139 labelList nMasterFaces(patch.nEdges(), 0);
141 forAll(faceIndices, facei)
143 const label meshFacei = faceIndices[facei];
145 if (isMasterFace[meshFacei])
147 const labelList& fEdges = patch.faceEdges()[facei];
150 nMasterFaces[fEdges[fEdgei]]++;
158 patch.meshEdges(mesh_.edges(), mesh_.pointEdges()),
165 label nProtected = 0;
167 forAll(nMasterFaces, edgei)
169 if (nMasterFaces[edgei] > 2)
178 Info<<
"Protected from visiting "
180 <<
" non-manifold edges" <<
nl <<
endl;
185 DynamicList<label> changedEdges;
186 DynamicList<patchFaceOrientation> changedInfo;
188 const scalar tol = PatchEdgeFaceWave
196 globalIndex globalFaces(patch.size());
202 forAll(allFaceInfo, facei)
206 unsetFacei = globalFaces.toGlobal(facei);
211 reduce(unsetFacei, minOp<label>());
218 const label proci = globalFaces.whichProcID(unsetFacei);
219 const label seedFacei = globalFaces.toLocal(proci, unsetFacei);
223 Info<<
"Seeding from processor " << proci <<
" face " << seedFacei
231 const vector d = outsidePoint_ - patch.faceCentres()[seedFacei];
232 const vector& fn = patch.faceNormals()[seedFacei];
235 patchFaceOrientation& faceInfo = allFaceInfo[seedFacei];
244 Pout<<
"Face " << seedFacei <<
" at "
245 << patch.faceCentres()[seedFacei]
246 <<
" with normal " << fn
247 <<
" needs to be flipped." <<
endl;
252 Pout<<
"Face " << seedFacei <<
" at "
253 << patch.faceCentres()[seedFacei]
254 <<
" with normal " << fn
255 <<
" points in positive direction (cos = " << (fn&d)/
mag(d)
260 const labelList& fEdges = patch.faceEdges()[seedFacei];
263 const label edgei = fEdges[fEdgei];
265 patchFaceOrientation& edgeInfo = allEdgeInfo[edgei];
269 edgeInfo.updateEdge<
int>
281 changedEdges.append(edgei);
282 changedInfo.append(edgeInfo);
288 if (
returnReduce(changedEdges.size(), sumOp<label>()) == 0)
315 const polyBoundaryMesh& bm = mesh_.boundaryMesh();
319 mesh_.nFaces()-mesh_.nInternalFaces(),
325 const label meshFacei = faceIndices[i];
326 if (!mesh_.isInternalFace(meshFacei))
328 neiStatus[meshFacei-mesh_.nInternalFaces()] =
329 allFaceInfo[i].flipStatus();
336 const label meshFacei = faceIndices[i];
343 && !isMasterFace[meshFacei]
347 const label bFacei = meshFacei-mesh_.nInternalFaces();
360 <<
"Incorrect status for face " << meshFacei
370 boolList flipMap(faceIndices.size());
372 forAll(allFaceInfo, facei)
376 flipMap[facei] =
false;
380 flipMap[facei] =
true;
385 <<
"Problem : unvisited face " << facei
386 <<
" centre:" << mesh_.faceCentres()[faceIndices[facei]]
397 const faceZone& fZone
402 return normalOrientation(fZone);
406 return pointOrientation(fZone);
442 zoneSet zs(zoneGenerator_->generate());
#define forAll(list, i)
Loop across all elements in list.
Macros for easy insertion into run-time selection tables.
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.
Named list of face indices representing a sub-set of the mesh faces.
Mesh consisting of general polyhedral cells.
const vectorField & faceAreas() const
A class for handling words, derived from string.
Abstract base class for all zoneGenerators, providing runtime selection.
const polyMesh & mesh_
Reference to the polyMesh.
A zoneGenerator which looks-up and returns a zoneSet containing point, and/or cell and/or faces zones...
A zoneGenerator which sets the face orientation flipMap.
virtual ~orient()
Destructor.
virtual zoneSet generate() const
Generate and return the zoneSet.
orient(const word &name, const polyMesh &mesh, const dictionary &dict)
Construct from dictionary.
Zone container returned by zoneGenerator::generate.
const faceZone & fZone() const
Return a reference to the faceZone if allocated.
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
defineTypeNameAndDebug(cylinderHeadPoints, 0)
addToRunTimeSelectionTable(zoneGenerator, cylinderHeadPoints, dictionary)
errorManipArg< error, int > exit(error &err, const int errNo=1)
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.
errorManip< error > abort(error &err)
List< bool > boolList
Bool container classes.
void mag(LagrangianPatchField< scalar > &f, const LagrangianPatchField< Type > &f1)
Vector< scalar > vector
A scalar version of the templated Vector.
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
Field< vector > vectorField
Specialisation of Field<T> for vector.
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
prefixOSstream Pout(cout, "Pout")
void magSqr(LagrangianPatchField< scalar > &f, const LagrangianPatchField< Type > &f1)
static const label labelMax
PrimitivePatch< IndirectList< face >, const pointField & > indirectPrimitivePatch
Foam::indirectPrimitivePatch.
tmp< DimensionedField< TypeR, GeoMesh, Field > > New(const tmp< DimensionedField< TypeR, GeoMesh, Field >> &tdf1, const word &name, const dimensionSet &dimensions)