35 class PrimitivePatchType,
40 propagationTol_ = 0.01;
44 class PrimitivePatchType,
49 defaultTrackingData_ = -1;
61 class PrimitivePatchType,
69 const label neighbourFacei,
70 const Type& neighbourInfo,
76 bool wasValid = edgeInfo.valid(td_);
92 if (!changedEdge_[edgeI])
94 changedEdge_[edgeI] =
true;
95 changedEdges_.append(edgeI);
99 if (!wasValid && edgeInfo.valid(td_))
115 class PrimitivePatchType,
123 const label neighbourEdgeI,
124 const Type& neighbourInfo,
130 bool wasValid = faceInfo.valid(td_);
146 if (!changedFace_[facei])
148 changedFace_[facei] =
true;
149 changedFaces_.append(facei);
153 if (!wasValid && faceInfo.valid(td_))
164 class PrimitivePatchType,
171 const globalMeshData& globalData = mesh_.globalData();
172 const distributionMap& map = globalData.globalEdgeSlavesMap();
173 const PackedBoolList& cppOrientation = globalData.globalEdgeOrientation();
179 List<Type> cppEdgeData(map.constructSize());
183 label patchEdgeI = patchEdges_[i];
184 label coupledEdgeI = coupledEdges_[i];
186 if (changedEdge_[patchEdgeI])
188 const Type& data = allEdgeInfo_[patchEdgeI];
193 bool sameOrientation =
195 sameEdgeOrientation_[i]
196 == cppOrientation[coupledEdgeI]
199 cppEdgeData[coupledEdgeI].updateEdge
218 globalData.globalEdgeSlaves(),
219 globalData.globalEdgeTransformedSlaves(),
221 globalData.globalTransforms(),
222 updateOp<PrimitivePatchType, Type, TrackingData>
229 transformOp<PrimitivePatchType, Type, TrackingData>
244 label patchEdgeI = patchEdges_[i];
245 label coupledEdgeI = coupledEdges_[i];
247 const Type& data = cppEdgeData[coupledEdgeI];
251 bool sameOrientation =
253 sameEdgeOrientation_[i]
254 == cppOrientation[coupledEdgeI]
257 allEdgeInfo_[patchEdgeI].updateEdge
267 if (!changedEdge_[patchEdgeI])
269 changedEdges_.append(patchEdgeI);
270 changedEdge_[patchEdgeI] =
true;
283 class PrimitivePatchType,
291 const PrimitivePatchType& patch,
304 allEdgeInfo_(allEdgeInfo),
305 allFaceInfo_(allFaceInfo),
307 changedEdge_(patch_.nEdges()),
308 changedEdges_(patch_.size()),
309 changedFace_(patch_.size()),
310 changedFaces_(patch_.size()),
312 nUnvisitedEdges_(patch_.nEdges()),
313 nUnvisitedFaces_(patch_.size())
317 PatchTools::matchEdges
320 mesh_.globalData().coupledPatch(),
328 if (allEdgeInfo_.size() != patch_.nEdges())
331 <<
"size of edgeInfo work array is not equal to the number" 332 <<
" of edges in the patch" <<
endl 333 <<
" edgeInfo :" << allEdgeInfo_.size() <<
endl 334 <<
" patch.nEdges:" << patch_.nEdges()
337 if (allFaceInfo_.size() != patch_.size())
340 <<
"size of edgeInfo work array is not equal to the number" 341 <<
" of faces in the patch" <<
endl 342 <<
" faceInfo :" << allFaceInfo_.size() <<
endl 343 <<
" patch.size:" << patch_.size()
349 setEdgeInfo(changedEdges, changedEdgesInfo);
353 Pout<<
"Seed edges : " << changedEdges_.size() <<
endl;
357 label iter = iterate(maxIter);
359 if ((maxIter > 0) && (iter >= maxIter))
362 <<
"Maximum number of iterations reached. Increase maxIter." <<
endl 363 <<
" maxIter:" << maxIter <<
endl 364 <<
" changedEdges:" << changedEdges_.size() <<
endl 365 <<
" changedFaces:" << changedFaces_.size() <<
endl 373 class PrimitivePatchType,
381 const PrimitivePatchType& patch,
389 allEdgeInfo_(allEdgeInfo),
390 allFaceInfo_(allFaceInfo),
392 changedEdge_(patch_.nEdges()),
393 changedEdges_(patch_.nEdges()),
394 changedFace_(patch_.size()),
395 changedFaces_(patch_.size()),
397 nUnvisitedEdges_(patch_.nEdges()),
398 nUnvisitedFaces_(patch_.size())
402 PatchTools::matchEdges
405 mesh_.globalData().coupledPatch(),
418 class PrimitivePatchType,
425 return nUnvisitedEdges_;
431 class PrimitivePatchType,
438 return nUnvisitedFaces_;
445 class PrimitivePatchType,
456 forAll(changedEdges, changedEdgeI)
458 label edgeI = changedEdges[changedEdgeI];
460 bool wasValid = allEdgeInfo_[edgeI].valid(td_);
463 allEdgeInfo_[edgeI] = changedEdgesInfo[changedEdgeI];
466 if (!wasValid && allEdgeInfo_[edgeI].valid(td_))
473 if (!changedEdge_[edgeI])
475 changedEdge_[edgeI] =
true;
476 changedEdges_.
append(edgeI);
485 class PrimitivePatchType,
492 changedEdges_.clear();
493 changedEdge_ =
false;
495 forAll(changedFaces_, changedFacei)
497 label facei = changedFaces_[changedFacei];
499 if (!changedFace_[facei])
503 <<
" not marked as having been changed" <<
nl 504 <<
"This might be caused by multiple occurrences of the same" 508 const Type& neighbourWallInfo = allFaceInfo_[facei];
511 const labelList& fEdges = patch_.faceEdges()[facei];
515 label edgeI = fEdges[fEdgeI];
517 Type& currentWallInfo = allEdgeInfo_[edgeI];
519 if (!currentWallInfo.equal(neighbourWallInfo, td_))
538 Pout<<
"Changed edges : " << changedEdges_.size() <<
endl;
548 class PrimitivePatchType,
555 changedFaces_.clear();
556 changedFace_ =
false;
560 forAll(changedEdges_, changedEdgeI)
562 label edgeI = changedEdges_[changedEdgeI];
564 if (!changedEdge_[edgeI])
568 <<
" not marked as having been changed" <<
nl 569 <<
"This might be caused by multiple occurrences of the same" 573 const Type& neighbourWallInfo = allEdgeInfo_[edgeI];
577 const labelList& eFaces = edgeFaces[edgeI];
580 label facei = eFaces[eFacei];
582 Type& currentWallInfo = allFaceInfo_[facei];
584 if (!currentWallInfo.equal(neighbourWallInfo, td_))
599 Pout<<
"Changed faces : " << changedFaces_.size() <<
endl;
609 class PrimitivePatchType,
626 while (iter < maxIter)
630 Pout<<
"Iteration " << iter <<
endl;
633 label nFaces = edgeToFace();
637 Pout<<
"Total changed faces : " << nFaces <<
endl;
645 label nEdges = faceToEdge();
649 Pout<<
"Total changed edges : " << nEdges <<
nl 650 <<
"Total evaluations : " << nEvals_ <<
nl 651 <<
"Remaining unvisited edges : " << nUnvisitedEdges_ <<
nl 652 <<
"Remaining unvisited faces : " << nUnvisitedFaces_ <<
nl
#define forAll(list, i)
Loop across all elements in list.
FvWallInfoData< WallInfo, label > label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
errorManipArg< error, int > exit(error &err, const int errNo=1)
label getUnsetFaces() const
Get number of unvisited faces, i.e. faces that were not (yet)
PatchEdgeFaceWave(const polyMesh &mesh, const PrimitivePatchType &patch, const labelList &initialEdges, const List< Type > &initialEdgesInfo, UList< Type > &allEdgeInfo, UList< Type > &allFaceInfo, const label maxIter, TrackingData &td=defaultTrackingData_)
Construct from patch, list of changed edges with the Type.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Wave propagation of information along patch. Every iteration information goes through one layer of fa...
label faceToEdge()
Propagate from face to edge. Returns total number of edges.
label edgeToFace()
Propagate from edge to face. Returns total number of faces.
Ostream & endl(Ostream &os)
Add newline and flush stream.
void append(const T &)
Append an element at the end of the list.
errorManip< error > abort(error &err)
label iterate(const label maxIter)
Iterate until no changes or maxIter reached. Returns actual.
void setEdgeInfo(const labelList &changedEdges, const List< Type > &changedEdgesInfo)
Copy initial data into allEdgeInfo_.
prefixOSstream Pout(cout, "Pout")
label getUnsetEdges() const
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
Mesh consisting of general polyhedral cells.