43 template<
class Type,
class TrackingData>
46 template<
class Type,
class TrackingData>
52 template<
class Type,
class TrackingData>
66 if (!
x.valid(td_) &&
y.valid(td_))
78 template<
class Type,
class TrackingData>
81 const polyPatch&
patch,
88 forAll(patchPointLabels, i)
90 label patchPointi = patchPointLabels[i];
92 const point& pt =
patch.points()[meshPoints[patchPointi]];
94 pointInfo[i].leaveDomain(
patch, patchPointi, pt, td_);
100 template<
class Type,
class TrackingData>
103 const polyPatch&
patch,
105 List<Type>& pointInfo
110 forAll(patchPointLabels, i)
112 label patchPointi = patchPointLabels[i];
114 const point& pt =
patch.points()[meshPoints[patchPointi]];
116 pointInfo[i].enterDomain(
patch, patchPointi, pt, td_);
122 template<
class Type,
class TrackingData>
125 const polyPatch&
patch,
127 List<Type>& pointInfo
130 if (rotTensor.size() == 1)
132 const tensor&
T = rotTensor[0];
136 pointInfo[i].transform(
T, td_);
142 <<
"Non-uniform transformation on patch " <<
patch.name()
143 <<
" of type " <<
patch.type()
144 <<
" not supported for point fields"
149 pointInfo[i].transform(rotTensor[i], td_);
160 template<
class Type,
class TrackingData>
164 const label neighbourEdgeI,
165 const Type& neighbourInfo,
171 bool wasValid = pointInfo.valid(td_);
174 pointInfo.updatePoint
186 if (!changedPoint_[pointi])
188 changedPoint_[pointi] =
true;
189 changedPoints_[nChangedPoints_++] = pointi;
193 if (!wasValid && pointInfo.valid(td_))
207 template<
class Type,
class TrackingData>
211 const Type& neighbourInfo,
217 bool wasValid = pointInfo.valid(td_);
220 pointInfo.updatePoint
231 if (!changedPoint_[pointi])
233 changedPoint_[pointi] =
true;
234 changedPoints_[nChangedPoints_++] = pointi;
238 if (!wasValid && pointInfo.valid(td_))
252 template<
class Type,
class TrackingData>
256 const label neighbourPointi,
257 const Type& neighbourInfo,
263 bool wasValid = edgeInfo.valid(td_);
278 if (!changedEdge_[edgeI])
280 changedEdge_[edgeI] =
true;
281 changedEdges_[nChangedEdges_++] = edgeI;
285 if (!wasValid && edgeInfo.valid(td_))
295 template<
class Type,
class TrackingData>
296 template<
class PatchType>
301 forAll(mesh_.boundaryMesh(), patchi)
303 if (isA<PatchType>(mesh_.boundaryMesh()[patchi]))
313 template<
class Type,
class TrackingData>
324 forAll(mesh_.globalData().processorPatches(), i)
326 label patchi = mesh_.globalData().processorPatches()[i];
328 refCast<const processorPolyPatch>(mesh_.boundaryMesh()[patchi]);
339 forAll(neighbPoints, thisPointi)
341 label meshPointi = procPatch.
meshPoints()[thisPointi];
342 if (changedPoint_[meshPointi])
344 patchInfo.
append(allPointInfo_[meshPointi]);
345 thisPoints.
append(thisPointi);
346 nbrPoints.
append(neighbPoints[thisPointi]);
351 leaveDomain(procPatch, thisPoints, patchInfo);
361 toNeighbour << nbrPoints << patchInfo;
365 pBufs.finishedSends();
371 forAll(mesh_.globalData().processorPatches(), i)
373 label patchi = mesh_.globalData().processorPatches()[i];
374 const processorPolyPatch& procPatch =
375 refCast<const processorPolyPatch>(mesh_.boundaryMesh()[patchi]);
377 List<Type> patchInfo;
381 UIPstream fromNeighbour(procPatch.neighbProcNo(), pBufs);
382 fromNeighbour >> patchPoints >> patchInfo;
393 if (!procPatch.parallel())
395 transform(procPatch, procPatch.forwardT(), patchInfo);
399 enterDomain(procPatch, patchPoints, patchInfo);
402 const labelList& meshPoints = procPatch.meshPoints();
405 label meshPointi = meshPoints[patchPoints[i]];
407 if (!allPointInfo_[meshPointi].
equal(patchInfo[i], td_))
413 allPointInfo_[meshPointi]
426 template<
class Type,
class TrackingData>
431 DynamicList<Type> nbrInfo;
432 DynamicList<label> nbrPoints;
433 DynamicList<label> thisPoints;
435 forAll(mesh_.boundaryMesh(), patchi)
437 const polyPatch&
patch = mesh_.boundaryMesh()[patchi];
439 const cyclicPolyPatch* cpp = isA<cyclicPolyPatch>(
patch);
443 const auto& cycPatch = *cpp;
444 const auto& nbrPatch = cycPatch.neighbPatch();
447 nbrInfo.reserve(cycPatch.nPoints());
449 nbrPoints.reserve(cycPatch.nPoints());
451 thisPoints.reserve(cycPatch.nPoints());
455 const edgeList& pairs = cycPatch.coupledPoints();
456 const labelList& meshPoints = nbrPatch.meshPoints();
460 label thisPointi = pairs[pairI][0];
461 label nbrPointi = pairs[pairI][1];
462 label meshPointi = meshPoints[nbrPointi];
464 if (changedPoint_[meshPointi])
466 nbrInfo.append(allPointInfo_[meshPointi]);
467 nbrPoints.append(nbrPointi);
468 thisPoints.append(thisPointi);
473 leaveDomain(nbrPatch, nbrPoints, nbrInfo);
479 if (!cycPatch.parallel())
482 transform(cycPatch, cycPatch.forwardT(), nbrInfo);
493 enterDomain(cycPatch, thisPoints, nbrInfo);
496 const labelList& meshPoints = cycPatch.meshPoints();
499 label meshPointi = meshPoints[thisPoints[i]];
501 if (!allPointInfo_[meshPointi].
equal(nbrInfo[i], td_))
507 allPointInfo_[meshPointi]
518 template<
class Type,
class TrackingData>
522 const globalMeshData& gmd = mesh_.globalData();
524 const labelList& meshPoints = cpp.meshPoints();
526 const mapDistribute& slavesMap = gmd.globalPointSlavesMap();
529 List<Type> elems(slavesMap.constructSize());
530 forAll(meshPoints, pointi)
532 elems[pointi] = allPointInfo_[meshPoints[pointi]];
537 slavesMap.distribute(elems,
false);
540 combineEqOp<Type, TrackingData> cop(td_);
544 Type& elem = elems[pointi];
546 const labelList& slavePoints = slaves[pointi];
551 cop(elem, elems[slavePoints[j]]);
557 elems[slavePoints[j]] = elem;
562 slavesMap.reverseDistribute(elems.size(), elems,
false);
565 forAll(meshPoints, pointi)
567 if (elems[pointi].valid(td_))
569 label meshPointi = meshPoints[pointi];
571 Type& elem = allPointInfo_[meshPointi];
573 bool wasValid = elem.valid(td_);
578 if (!elem.equal(elems[pointi], td_))
581 elem = elems[pointi];
584 if (!wasValid && elem.valid(td_))
590 if (!changedPoint_[meshPointi])
592 changedPoint_[meshPointi] =
true;
593 changedPoints_[nChangedPoints_++] = meshPointi;
600 label totNChanged = nChangedPoints_;
602 reduce(totNChanged, sumOp<label>());
612 template<
class Type,
class TrackingData>
627 allPointInfo_(allPointInfo),
628 allEdgeInfo_(allEdgeInfo),
630 changedPoint_(mesh_.nPoints(),
false),
631 changedPoints_(mesh_.nPoints()),
633 changedEdge_(mesh_.nEdges(),
false),
634 changedEdges_(mesh_.nEdges()),
636 nCyclicPatches_(countPatchType<cyclicPolyPatch>()),
638 nUnvisitedPoints_(mesh_.nPoints()),
639 nUnvisitedEdges_(mesh_.nEdges())
641 if (allPointInfo_.size() != mesh_.nPoints())
644 <<
"size of pointInfo work array is not equal to the number"
645 <<
" of points in the mesh" <<
endl
646 <<
" pointInfo :" << allPointInfo_.size() <<
endl
647 <<
" mesh.nPoints:" << mesh_.nPoints()
650 if (allEdgeInfo_.size() != mesh_.nEdges())
653 <<
"size of edgeInfo work array is not equal to the number"
654 <<
" of edges in the mesh" <<
endl
655 <<
" edgeInfo :" << allEdgeInfo_.size() <<
endl
656 <<
" mesh.nEdges:" << mesh_.nEdges()
662 setPointInfo(changedPoints, changedPointsInfo);
666 Info<< typeName <<
": Seed points : "
671 label iter = iterate(maxIter);
673 if ((maxIter > 0) && (iter >= maxIter))
676 <<
"Maximum number of iterations reached. Increase maxIter." <<
endl
677 <<
" maxIter:" << maxIter <<
endl
678 <<
" nChangedPoints:" << nChangedPoints_ <<
endl
679 <<
" nChangedEdges:" << nChangedEdges_ <<
endl
685 template<
class Type,
class TrackingData>
695 allPointInfo_(allPointInfo),
696 allEdgeInfo_(allEdgeInfo),
698 changedPoint_(mesh_.nPoints(),
false),
699 changedPoints_(mesh_.nPoints()),
701 changedEdge_(mesh_.nEdges(),
false),
702 changedEdges_(mesh_.nEdges()),
704 nCyclicPatches_(countPatchType<cyclicPolyPatch>()),
706 nUnvisitedPoints_(mesh_.nPoints()),
707 nUnvisitedEdges_(mesh_.nEdges())
713 template<
class Type,
class TrackingData>
716 return nUnvisitedPoints_;
720 template<
class Type,
class TrackingData>
723 return nUnvisitedEdges_;
728 template<
class Type,
class TrackingData>
735 forAll(changedPoints, changedPointi)
737 const label pointi = changedPoints[changedPointi];
739 const bool wasValid = allPointInfo_[pointi].valid(td_);
742 allPointInfo_[pointi] = changedPointsInfo[changedPointi];
745 if (!wasValid && allPointInfo_[pointi].valid(td_))
752 if (!changedPoint_[pointi])
754 changedPoint_[pointi] =
true;
755 changedPoints_[nChangedPoints_++] = pointi;
760 handleCollocatedPoints();
765 template<
class Type,
class TrackingData>
770 label changedEdgeI = 0;
771 changedEdgeI < nChangedEdges_;
775 label edgeI = changedEdges_[changedEdgeI];
777 if (!changedEdge_[edgeI])
781 <<
" not marked as having been changed" <<
nl
782 <<
"This might be caused by multiple occurrences of the same"
787 const Type& neighbourWallInfo = allEdgeInfo_[edgeI];
790 const edge&
e = mesh_.edges()[edgeI];
794 Type& currentWallInfo = allPointInfo_[
e[eI]];
796 if (!currentWallInfo.equal(neighbourWallInfo, td_))
809 changedEdge_[edgeI] =
false;
815 if (nCyclicPatches_ > 0)
818 handleCyclicPatches();
820 if (Pstream::parRun())
832 label totNChanged = nChangedPoints_;
841 template<
class Type,
class TrackingData>
848 label changedPointi = 0;
849 changedPointi < nChangedPoints_;
853 label pointi = changedPoints_[changedPointi];
855 if (!changedPoint_[pointi])
858 <<
"Point " << pointi
859 <<
" not marked as having been changed" <<
nl
860 <<
"This might be caused by multiple occurrences of the same"
864 const Type& neighbourWallInfo = allPointInfo_[pointi];
868 const labelList& edgeLabels = pointEdges[pointi];
869 forAll(edgeLabels, edgeLabelI)
871 label edgeI = edgeLabels[edgeLabelI];
873 Type& currentWallInfo = allEdgeInfo_[edgeI];
875 if (!currentWallInfo.equal(neighbourWallInfo, td_))
888 changedPoint_[pointi] =
false;
900 label totNChanged = nChangedEdges_;
909 template<
class Type,
class TrackingData>
915 if (nCyclicPatches_ > 0)
918 handleCyclicPatches();
920 if (Pstream::parRun())
930 while (iter < maxIter)
932 while (iter < maxIter)
936 Info<< typeName <<
": Iteration " << iter <<
endl;
939 label nEdges = pointToEdge();
943 Info<< typeName <<
": Total changed edges : "
956 Info<< typeName <<
": Total changed points : "
958 << typeName <<
": Total evaluations : "
960 << typeName <<
": Remaining unvisited points: "
962 << typeName <<
": Remaining unvisited edges : "
978 label
nPoints = handleCollocatedPoints();
981 Info<< typeName <<
": Collocated point sync : "