42 template<
class Type,
class TrackingData>
45 template<
class Type,
class TrackingData>
51 template<
class Type,
class TrackingData>
65 if (!
x.valid(td_) &&
y.valid(td_))
77 template<
class Type,
class TrackingData>
80 const polyPatch&
patch,
87 forAll(patchPointLabels, i)
89 label patchPointi = patchPointLabels[i];
91 const point& pt =
patch.points()[meshPoints[patchPointi]];
93 pointInfo[i].leaveDomain(
patch, patchPointi, pt, td_);
99 template<
class Type,
class TrackingData>
102 const polyPatch&
patch,
104 List<Type>& pointInfo
109 forAll(patchPointLabels, i)
111 label patchPointi = patchPointLabels[i];
113 const point& pt =
patch.points()[meshPoints[patchPointi]];
115 pointInfo[i].enterDomain(
patch, patchPointi, pt, td_);
121 template<
class Type,
class TrackingData>
124 const polyPatch&
patch,
126 List<Type>& pointInfo
129 if (rotTensor.size() == 1)
131 const tensor&
T = rotTensor[0];
135 pointInfo[i].transform(
T, td_);
141 <<
"Non-uniform transformation on patch " <<
patch.name()
142 <<
" of type " <<
patch.type()
143 <<
" not supported for point fields"
148 pointInfo[i].transform(rotTensor[i], td_);
159 template<
class Type,
class TrackingData>
163 const label neighbourEdgeI,
164 const Type& neighbourInfo,
170 bool wasValid = pointInfo.valid(td_);
173 pointInfo.updatePoint
185 if (!changedPoint_[pointi])
187 changedPoint_[pointi] =
true;
188 changedPoints_[nChangedPoints_++] = pointi;
192 if (!wasValid && pointInfo.valid(td_))
206 template<
class Type,
class TrackingData>
210 const Type& neighbourInfo,
216 bool wasValid = pointInfo.valid(td_);
219 pointInfo.updatePoint
230 if (!changedPoint_[pointi])
232 changedPoint_[pointi] =
true;
233 changedPoints_[nChangedPoints_++] = pointi;
237 if (!wasValid && pointInfo.valid(td_))
251 template<
class Type,
class TrackingData>
255 const label neighbourPointi,
256 const Type& neighbourInfo,
262 bool wasValid = edgeInfo.valid(td_);
277 if (!changedEdge_[edgeI])
279 changedEdge_[edgeI] =
true;
280 changedEdges_[nChangedEdges_++] = edgeI;
284 if (!wasValid && edgeInfo.valid(td_))
294 template<
class Type,
class TrackingData>
295 template<
class PatchType>
300 forAll(mesh_.boundaryMesh(), patchi)
302 if (isA<PatchType>(mesh_.boundaryMesh()[patchi]))
312 template<
class Type,
class TrackingData>
323 forAll(mesh_.globalData().processorPatches(), i)
325 label patchi = mesh_.globalData().processorPatches()[i];
327 refCast<const processorPolyPatch>(mesh_.boundaryMesh()[patchi]);
338 forAll(neighbPoints, thisPointi)
340 label meshPointi = procPatch.
meshPoints()[thisPointi];
341 if (changedPoint_[meshPointi])
343 patchInfo.
append(allPointInfo_[meshPointi]);
344 thisPoints.
append(thisPointi);
345 nbrPoints.
append(neighbPoints[thisPointi]);
350 leaveDomain(procPatch, thisPoints, patchInfo);
360 toNeighbour << nbrPoints << patchInfo;
364 pBufs.finishedSends();
370 forAll(mesh_.globalData().processorPatches(), i)
372 label patchi = mesh_.globalData().processorPatches()[i];
373 const processorPolyPatch& procPatch =
374 refCast<const processorPolyPatch>(mesh_.boundaryMesh()[patchi]);
376 List<Type> patchInfo;
380 UIPstream fromNeighbour(procPatch.neighbProcNo(), pBufs);
381 fromNeighbour >> patchPoints >> patchInfo;
392 if (!procPatch.parallel())
394 transform(procPatch, procPatch.forwardT(), patchInfo);
398 enterDomain(procPatch, patchPoints, patchInfo);
401 const labelList& meshPoints = procPatch.meshPoints();
404 label meshPointi = meshPoints[patchPoints[i]];
406 if (!allPointInfo_[meshPointi].
equal(patchInfo[i], td_))
412 allPointInfo_[meshPointi]
425 template<
class Type,
class TrackingData>
430 DynamicList<Type> nbrInfo;
431 DynamicList<label> nbrPoints;
432 DynamicList<label> thisPoints;
434 forAll(mesh_.boundaryMesh(), patchi)
436 const polyPatch&
patch = mesh_.boundaryMesh()[patchi];
438 if (isA<cyclicPolyPatch>(
patch))
440 const cyclicPolyPatch& cycPatch =
441 refCast<const cyclicPolyPatch>(
patch);
444 nbrInfo.reserve(cycPatch.nPoints());
446 nbrPoints.reserve(cycPatch.nPoints());
448 thisPoints.reserve(cycPatch.nPoints());
452 const cyclicPolyPatch& nbrPatch = cycPatch.neighbPatch();
453 const edgeList& pairs = cycPatch.coupledPoints();
454 const labelList& meshPoints = nbrPatch.meshPoints();
458 label thisPointi = pairs[pairI][0];
459 label nbrPointi = pairs[pairI][1];
460 label meshPointi = meshPoints[nbrPointi];
462 if (changedPoint_[meshPointi])
464 nbrInfo.append(allPointInfo_[meshPointi]);
465 nbrPoints.append(nbrPointi);
466 thisPoints.append(thisPointi);
471 leaveDomain(nbrPatch, nbrPoints, nbrInfo);
477 if (!cycPatch.parallel())
480 transform(cycPatch, cycPatch.forwardT(), nbrInfo);
491 enterDomain(cycPatch, thisPoints, nbrInfo);
494 const labelList& meshPoints = cycPatch.meshPoints();
497 label meshPointi = meshPoints[thisPoints[i]];
499 if (!allPointInfo_[meshPointi].
equal(nbrInfo[i], td_))
505 allPointInfo_[meshPointi]
516 template<
class Type,
class TrackingData>
520 const globalMeshData& gmd = mesh_.globalData();
522 const labelList& meshPoints = cpp.meshPoints();
524 const mapDistribute& slavesMap = gmd.globalPointSlavesMap();
527 List<Type> elems(slavesMap.constructSize());
528 forAll(meshPoints, pointi)
530 elems[pointi] = allPointInfo_[meshPoints[pointi]];
535 slavesMap.distribute(elems,
false);
538 combineEqOp<Type, TrackingData> cop(td_);
542 Type& elem = elems[pointi];
544 const labelList& slavePoints = slaves[pointi];
549 cop(elem, elems[slavePoints[j]]);
555 elems[slavePoints[j]] = elem;
560 slavesMap.reverseDistribute(elems.size(), elems,
false);
563 forAll(meshPoints, pointi)
565 if (elems[pointi].valid(td_))
567 label meshPointi = meshPoints[pointi];
569 Type& elem = allPointInfo_[meshPointi];
571 bool wasValid = elem.valid(td_);
576 if (!elem.equal(elems[pointi], td_))
579 elem = elems[pointi];
582 if (!wasValid && elem.valid(td_))
588 if (!changedPoint_[meshPointi])
590 changedPoint_[meshPointi] =
true;
591 changedPoints_[nChangedPoints_++] = meshPointi;
598 label totNChanged = nChangedPoints_;
600 reduce(totNChanged, sumOp<label>());
610 template<
class Type,
class TrackingData>
625 allPointInfo_(allPointInfo),
626 allEdgeInfo_(allEdgeInfo),
628 changedPoint_(mesh_.nPoints(),
false),
629 changedPoints_(mesh_.nPoints()),
631 changedEdge_(mesh_.nEdges(),
false),
632 changedEdges_(mesh_.nEdges()),
634 nCyclicPatches_(countPatchType<cyclicPolyPatch>()),
636 nUnvisitedPoints_(mesh_.nPoints()),
637 nUnvisitedEdges_(mesh_.nEdges())
639 if (allPointInfo_.size() != mesh_.nPoints())
642 <<
"size of pointInfo work array is not equal to the number"
643 <<
" of points in the mesh" <<
endl
644 <<
" pointInfo :" << allPointInfo_.size() <<
endl
645 <<
" mesh.nPoints:" << mesh_.nPoints()
648 if (allEdgeInfo_.size() != mesh_.nEdges())
651 <<
"size of edgeInfo work array is not equal to the number"
652 <<
" of edges in the mesh" <<
endl
653 <<
" edgeInfo :" << allEdgeInfo_.size() <<
endl
654 <<
" mesh.nEdges:" << mesh_.nEdges()
660 setPointInfo(changedPoints, changedPointsInfo);
664 Info<< typeName <<
": Seed points : "
669 label iter = iterate(maxIter);
671 if ((maxIter > 0) && (iter >= maxIter))
674 <<
"Maximum number of iterations reached. Increase maxIter." <<
endl
675 <<
" maxIter:" << maxIter <<
endl
676 <<
" nChangedPoints:" << nChangedPoints_ <<
endl
677 <<
" nChangedEdges:" << nChangedEdges_ <<
endl
683 template<
class Type,
class TrackingData>
693 allPointInfo_(allPointInfo),
694 allEdgeInfo_(allEdgeInfo),
696 changedPoint_(mesh_.nPoints(),
false),
697 changedPoints_(mesh_.nPoints()),
699 changedEdge_(mesh_.nEdges(),
false),
700 changedEdges_(mesh_.nEdges()),
702 nCyclicPatches_(countPatchType<cyclicPolyPatch>()),
704 nUnvisitedPoints_(mesh_.nPoints()),
705 nUnvisitedEdges_(mesh_.nEdges())
711 template<
class Type,
class TrackingData>
714 return nUnvisitedPoints_;
718 template<
class Type,
class TrackingData>
721 return nUnvisitedEdges_;
726 template<
class Type,
class TrackingData>
733 forAll(changedPoints, changedPointi)
735 const label pointi = changedPoints[changedPointi];
737 const bool wasValid = allPointInfo_[pointi].valid(td_);
740 allPointInfo_[pointi] = changedPointsInfo[changedPointi];
743 if (!wasValid && allPointInfo_[pointi].valid(td_))
750 if (!changedPoint_[pointi])
752 changedPoint_[pointi] =
true;
753 changedPoints_[nChangedPoints_++] = pointi;
758 handleCollocatedPoints();
763 template<
class Type,
class TrackingData>
768 label changedEdgeI = 0;
769 changedEdgeI < nChangedEdges_;
773 label edgeI = changedEdges_[changedEdgeI];
775 if (!changedEdge_[edgeI])
779 <<
" not marked as having been changed" <<
nl
780 <<
"This might be caused by multiple occurrences of the same"
785 const Type& neighbourWallInfo = allEdgeInfo_[edgeI];
788 const edge&
e = mesh_.edges()[edgeI];
792 Type& currentWallInfo = allPointInfo_[
e[eI]];
794 if (!currentWallInfo.equal(neighbourWallInfo, td_))
807 changedEdge_[edgeI] =
false;
813 if (nCyclicPatches_ > 0)
816 handleCyclicPatches();
818 if (Pstream::parRun())
830 label totNChanged = nChangedPoints_;
839 template<
class Type,
class TrackingData>
846 label changedPointi = 0;
847 changedPointi < nChangedPoints_;
851 label pointi = changedPoints_[changedPointi];
853 if (!changedPoint_[pointi])
856 <<
"Point " << pointi
857 <<
" not marked as having been changed" <<
nl
858 <<
"This might be caused by multiple occurrences of the same"
862 const Type& neighbourWallInfo = allPointInfo_[pointi];
866 const labelList& edgeLabels = pointEdges[pointi];
867 forAll(edgeLabels, edgeLabelI)
869 label edgeI = edgeLabels[edgeLabelI];
871 Type& currentWallInfo = allEdgeInfo_[edgeI];
873 if (!currentWallInfo.equal(neighbourWallInfo, td_))
886 changedPoint_[pointi] =
false;
898 label totNChanged = nChangedEdges_;
907 template<
class Type,
class TrackingData>
913 if (nCyclicPatches_ > 0)
916 handleCyclicPatches();
918 if (Pstream::parRun())
928 while (iter < maxIter)
930 while (iter < maxIter)
934 Info<< typeName <<
": Iteration " << iter <<
endl;
937 label nEdges = pointToEdge();
941 Info<< typeName <<
": Total changed edges : "
954 Info<< typeName <<
": Total changed points : "
956 << typeName <<
": Total evaluations : "
958 << typeName <<
": Remaining unvisited points: "
960 << typeName <<
": Remaining unvisited edges : "
976 label
nPoints = handleCollocatedPoints();
979 Info<< typeName <<
": Collocated point sync : "