35 class PrimitivePatchType,
40 propagationTol_ = 0.01;
44 class PrimitivePatchType,
50 dummyTrackData_ = 12345;
62 class PrimitivePatchType,
70 const label neighbourFacei,
71 const Type& neighbourInfo,
77 bool wasValid = edgeInfo.valid(td_);
93 if (!changedEdge_[edgeI])
95 changedEdge_[edgeI] =
true;
96 changedEdges_.append(edgeI);
100 if (!wasValid && edgeInfo.valid(td_))
116 class PrimitivePatchType,
124 const label neighbourEdgeI,
125 const Type& neighbourInfo,
131 bool wasValid = faceInfo.valid(td_);
147 if (!changedFace_[facei])
149 changedFace_[facei] =
true;
150 changedFaces_.append(facei);
154 if (!wasValid && faceInfo.valid(td_))
165 class PrimitivePatchType,
172 const globalMeshData& globalData = mesh_.globalData();
173 const mapDistribute& map = globalData.globalEdgeSlavesMap();
174 const PackedBoolList& cppOrientation = globalData.globalEdgeOrientation();
180 List<Type> cppEdgeData(map.constructSize());
184 label patchEdgeI = patchEdges_[i];
185 label coupledEdgeI = coupledEdges_[i];
187 if (changedEdge_[patchEdgeI])
189 const Type& data = allEdgeInfo_[patchEdgeI];
194 bool sameOrientation =
196 sameEdgeOrientation_[i]
197 == cppOrientation[coupledEdgeI]
200 cppEdgeData[coupledEdgeI].updateEdge
219 globalData.globalEdgeSlaves(),
220 globalData.globalEdgeTransformedSlaves(),
222 globalData.globalTransforms(),
223 updateOp<PrimitivePatchType, Type, TrackingData>
230 transformOp<PrimitivePatchType, Type, TrackingData>
245 label patchEdgeI = patchEdges_[i];
246 label coupledEdgeI = coupledEdges_[i];
248 const Type& data = cppEdgeData[coupledEdgeI];
252 bool sameOrientation =
254 sameEdgeOrientation_[i]
255 == cppOrientation[coupledEdgeI]
258 allEdgeInfo_[patchEdgeI].updateEdge
268 if (!changedEdge_[patchEdgeI])
270 changedEdges_.append(patchEdgeI);
271 changedEdge_[patchEdgeI] =
true;
284 class PrimitivePatchType,
292 const PrimitivePatchType& patch,
305 allEdgeInfo_(allEdgeInfo),
306 allFaceInfo_(allFaceInfo),
308 changedEdge_(patch_.nEdges()),
309 changedEdges_(patch_.size()),
310 changedFace_(patch_.size()),
311 changedFaces_(patch_.size()),
313 nUnvisitedEdges_(patch_.nEdges()),
314 nUnvisitedFaces_(patch_.size())
318 PatchTools::matchEdges
321 mesh_.globalData().coupledPatch(),
329 if (allEdgeInfo_.size() != patch_.nEdges())
332 <<
"size of edgeInfo work array is not equal to the number" 333 <<
" of edges in the patch" <<
endl 334 <<
" edgeInfo :" << allEdgeInfo_.size() <<
endl 335 <<
" patch.nEdges:" << patch_.nEdges()
338 if (allFaceInfo_.size() != patch_.size())
341 <<
"size of edgeInfo work array is not equal to the number" 342 <<
" of faces in the patch" <<
endl 343 <<
" faceInfo :" << allFaceInfo_.size() <<
endl 344 <<
" patch.size:" << patch_.size()
350 setEdgeInfo(changedEdges, changedEdgesInfo);
354 Pout<<
"Seed edges : " << changedEdges_.size() <<
endl;
358 label iter = iterate(maxIter);
360 if ((maxIter > 0) && (iter >= maxIter))
363 <<
"Maximum number of iterations reached. Increase maxIter." <<
endl 364 <<
" maxIter:" << maxIter <<
endl 365 <<
" changedEdges:" << changedEdges_.size() <<
endl 366 <<
" changedFaces:" << changedFaces_.size() <<
endl 374 class PrimitivePatchType,
382 const PrimitivePatchType& patch,
390 allEdgeInfo_(allEdgeInfo),
391 allFaceInfo_(allFaceInfo),
393 changedEdge_(patch_.nEdges()),
394 changedEdges_(patch_.nEdges()),
395 changedFace_(patch_.size()),
396 changedFaces_(patch_.size()),
398 nUnvisitedEdges_(patch_.nEdges()),
399 nUnvisitedFaces_(patch_.size())
403 PatchTools::matchEdges
406 mesh_.globalData().coupledPatch(),
419 class PrimitivePatchType,
426 return nUnvisitedEdges_;
432 class PrimitivePatchType,
439 return nUnvisitedFaces_;
446 class PrimitivePatchType,
457 forAll(changedEdges, changedEdgeI)
459 label edgeI = changedEdges[changedEdgeI];
461 bool wasValid = allEdgeInfo_[edgeI].valid(td_);
464 allEdgeInfo_[edgeI] = changedEdgesInfo[changedEdgeI];
467 if (!wasValid && allEdgeInfo_[edgeI].valid(td_))
474 if (!changedEdge_[edgeI])
476 changedEdge_[edgeI] =
true;
477 changedEdges_.
append(edgeI);
486 class PrimitivePatchType,
493 changedEdges_.clear();
494 changedEdge_ =
false;
496 forAll(changedFaces_, changedFacei)
498 label facei = changedFaces_[changedFacei];
500 if (!changedFace_[facei])
504 <<
" not marked as having been changed" <<
nl 505 <<
"This might be caused by multiple occurrences of the same" 509 const Type& neighbourWallInfo = allFaceInfo_[facei];
512 const labelList& fEdges = patch_.faceEdges()[facei];
516 label edgeI = fEdges[fEdgeI];
518 Type& currentWallInfo = allEdgeInfo_[edgeI];
520 if (!currentWallInfo.equal(neighbourWallInfo, td_))
539 Pout<<
"Changed edges : " << changedEdges_.size() <<
endl;
549 class PrimitivePatchType,
556 changedFaces_.clear();
557 changedFace_ =
false;
561 forAll(changedEdges_, changedEdgeI)
563 label edgeI = changedEdges_[changedEdgeI];
565 if (!changedEdge_[edgeI])
569 <<
" not marked as having been changed" <<
nl 570 <<
"This might be caused by multiple occurrences of the same" 574 const Type& neighbourWallInfo = allEdgeInfo_[edgeI];
578 const labelList& eFaces = edgeFaces[edgeI];
581 label facei = eFaces[eFacei];
583 Type& currentWallInfo = allFaceInfo_[facei];
585 if (!currentWallInfo.equal(neighbourWallInfo, td_))
600 Pout<<
"Changed faces : " << changedFaces_.size() <<
endl;
610 class PrimitivePatchType,
627 while (iter < maxIter)
631 Pout<<
"Iteration " << iter <<
endl;
634 label nFaces = edgeToFace();
638 Pout<<
"Total changed faces : " << nFaces <<
endl;
646 label nEdges = faceToEdge();
650 Pout<<
"Total changed edges : " << nEdges <<
nl 651 <<
"Total evaluations : " << nEvals_ <<
nl 652 <<
"Remaining unvisited edges : " << nUnvisitedEdges_ <<
nl 653 <<
"Remaining unvisited faces : " << nUnvisitedFaces_ <<
nl
#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.
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)
#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.
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=dummyTrackData_)
Construct from patch, list of changed edges with the Type.
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.