42 template<
class Type,
class TrackingData>
45 template<
class Type,
class TrackingData>
51 template<
class Type,
class TrackingData>
64 if (!
x.valid(td_) &&
y.valid(td_))
76 template<
class Type,
class TrackingData>
79 const polyPatch&
patch,
86 forAll(patchPointLabels, i)
88 label patchPointi = patchPointLabels[i];
90 const point& pt =
patch.points()[meshPoints[patchPointi]];
92 pointInfo[i].leaveDomain(
patch, patchPointi, pt, td_);
98 template<
class Type,
class TrackingData>
101 const polyPatch&
patch,
103 List<Type>& pointInfo
108 forAll(patchPointLabels, i)
110 label patchPointi = patchPointLabels[i];
112 const point& pt =
patch.points()[meshPoints[patchPointi]];
114 pointInfo[i].enterDomain(
patch, patchPointi, pt, td_);
120 template<
class Type,
class TrackingData>
123 const polyPatch&
patch,
125 List<Type>& pointInfo
128 if (rotTensor.size() == 1)
130 const tensor&
T = rotTensor[0];
134 pointInfo[i].transform(
T, td_);
140 <<
"Non-uniform transformation on patch " <<
patch.name()
141 <<
" of type " <<
patch.type()
142 <<
" not supported for point fields"
147 pointInfo[i].transform(rotTensor[i], td_);
158 template<
class Type,
class TrackingData>
162 const label neighbourEdgeI,
163 const Type& neighbourInfo,
169 bool wasValid = pointInfo.valid(td_);
172 pointInfo.updatePoint
184 if (!changedPoint_[pointi])
186 changedPoint_[pointi] =
true;
187 changedPoints_[nChangedPoints_++] = pointi;
191 if (!wasValid && pointInfo.valid(td_))
205 template<
class Type,
class TrackingData>
209 const Type& neighbourInfo,
215 bool wasValid = pointInfo.valid(td_);
218 pointInfo.updatePoint
229 if (!changedPoint_[pointi])
231 changedPoint_[pointi] =
true;
232 changedPoints_[nChangedPoints_++] = pointi;
236 if (!wasValid && pointInfo.valid(td_))
250 template<
class Type,
class TrackingData>
254 const label neighbourPointi,
255 const Type& neighbourInfo,
261 bool wasValid = edgeInfo.valid(td_);
276 if (!changedEdge_[edgeI])
278 changedEdge_[edgeI] =
true;
279 changedEdges_[nChangedEdges_++] = edgeI;
283 if (!wasValid && edgeInfo.valid(td_))
293 template<
class Type,
class TrackingData>
294 template<
class PatchType>
299 forAll(mesh_.boundaryMesh(), patchi)
301 if (isA<PatchType>(mesh_.boundaryMesh()[patchi]))
311 template<
class Type,
class TrackingData>
322 forAll(mesh_.globalData().processorPatches(), i)
324 label patchi = mesh_.globalData().processorPatches()[i];
326 refCast<const processorPolyPatch>(mesh_.boundaryMesh()[patchi]);
337 forAll(neighbPoints, thisPointi)
340 if (changedPoint_[meshPointi])
342 patchInfo.
append(allPointInfo_[meshPointi]);
343 thisPoints.
append(thisPointi);
344 nbrPoints.
append(neighbPoints[thisPointi]);
349 leaveDomain(procPatch, thisPoints, patchInfo);
359 toNeighbour << nbrPoints << patchInfo;
363 pBufs.finishedSends();
369 forAll(mesh_.globalData().processorPatches(), i)
371 label patchi = mesh_.globalData().processorPatches()[i];
372 const processorPolyPatch& procPatch =
373 refCast<const processorPolyPatch>(mesh_.boundaryMesh()[patchi]);
375 List<Type> patchInfo;
379 UIPstream fromNeighbour(procPatch.neighbProcNo(), pBufs);
380 fromNeighbour >> patchPoints >> patchInfo;
391 if (!procPatch.parallel())
393 transform(procPatch, procPatch.forwardT(), patchInfo);
397 enterDomain(procPatch, patchPoints, patchInfo);
400 const labelList& meshPoints = procPatch.meshPoints();
403 label meshPointi = meshPoints[patchPoints[i]];
405 if (!allPointInfo_[meshPointi].
equal(patchInfo[i], td_))
411 allPointInfo_[meshPointi]
424 template<
class Type,
class TrackingData>
429 DynamicList<Type> nbrInfo;
430 DynamicList<label> nbrPoints;
431 DynamicList<label> thisPoints;
433 forAll(mesh_.boundaryMesh(), patchi)
435 const polyPatch&
patch = mesh_.boundaryMesh()[patchi];
437 if (isA<cyclicPolyPatch>(
patch))
439 const cyclicPolyPatch& cycPatch =
440 refCast<const cyclicPolyPatch>(
patch);
443 nbrInfo.reserve(cycPatch.nPoints());
445 nbrPoints.reserve(cycPatch.nPoints());
447 thisPoints.reserve(cycPatch.nPoints());
451 const cyclicPolyPatch& nbrPatch = cycPatch.neighbPatch();
452 const edgeList& pairs = cycPatch.coupledPoints();
453 const labelList& meshPoints = nbrPatch.meshPoints();
457 label thisPointi = pairs[pairI][0];
458 label nbrPointi = pairs[pairI][1];
459 label meshPointi = meshPoints[nbrPointi];
461 if (changedPoint_[meshPointi])
463 nbrInfo.append(allPointInfo_[meshPointi]);
464 nbrPoints.append(nbrPointi);
465 thisPoints.append(thisPointi);
470 leaveDomain(nbrPatch, nbrPoints, nbrInfo);
476 if (!cycPatch.parallel())
479 transform(cycPatch, cycPatch.forwardT(), nbrInfo);
490 enterDomain(cycPatch, thisPoints, nbrInfo);
493 const labelList& meshPoints = cycPatch.meshPoints();
496 label meshPointi = meshPoints[thisPoints[i]];
498 if (!allPointInfo_[meshPointi].
equal(nbrInfo[i], td_))
504 allPointInfo_[meshPointi]
515 template<
class Type,
class TrackingData>
519 const globalMeshData& gmd = mesh_.globalData();
521 const labelList& meshPoints = cpp.meshPoints();
523 const mapDistribute& slavesMap = gmd.globalPointSlavesMap();
526 List<Type> elems(slavesMap.constructSize());
527 forAll(meshPoints, pointi)
529 elems[pointi] = allPointInfo_[meshPoints[pointi]];
534 slavesMap.distribute(elems,
false);
537 combineEqOp<Type, TrackingData> cop(td_);
541 Type& elem = elems[pointi];
543 const labelList& slavePoints = slaves[pointi];
548 cop(elem, elems[slavePoints[j]]);
554 elems[slavePoints[j]] = elem;
559 slavesMap.reverseDistribute(elems.size(), elems,
false);
562 forAll(meshPoints, pointi)
564 if (elems[pointi].valid(td_))
566 label meshPointi = meshPoints[pointi];
568 Type& elem = allPointInfo_[meshPointi];
570 bool wasValid = elem.valid(td_);
575 if (!elem.equal(elems[pointi], td_))
578 elem = elems[pointi];
581 if (!wasValid && elem.valid(td_))
587 if (!changedPoint_[meshPointi])
589 changedPoint_[meshPointi] =
true;
590 changedPoints_[nChangedPoints_++] = meshPointi;
597 label totNChanged = nChangedPoints_;
599 reduce(totNChanged, sumOp<label>());
609 template<
class Type,
class TrackingData>
624 allPointInfo_(allPointInfo),
625 allEdgeInfo_(allEdgeInfo),
627 changedPoint_(mesh_.nPoints(),
false),
628 changedPoints_(mesh_.nPoints()),
630 changedEdge_(mesh_.nEdges(),
false),
631 changedEdges_(mesh_.nEdges()),
633 nCyclicPatches_(countPatchType<cyclicPolyPatch>()),
635 nUnvisitedPoints_(mesh_.nPoints()),
636 nUnvisitedEdges_(mesh_.nEdges())
638 if (allPointInfo_.size() != mesh_.nPoints())
641 <<
"size of pointInfo work array is not equal to the number"
642 <<
" of points in the mesh" <<
endl
643 <<
" pointInfo :" << allPointInfo_.size() <<
endl
644 <<
" mesh.nPoints:" << mesh_.nPoints()
647 if (allEdgeInfo_.size() != mesh_.nEdges())
650 <<
"size of edgeInfo work array is not equal to the number"
651 <<
" of edges in the mesh" <<
endl
652 <<
" edgeInfo :" << allEdgeInfo_.size() <<
endl
653 <<
" mesh.nEdges:" << mesh_.nEdges()
659 setPointInfo(changedPoints, changedPointsInfo);
663 Info<< typeName <<
": Seed points : "
668 label iter = iterate(maxIter);
670 if ((maxIter > 0) && (iter >= maxIter))
673 <<
"Maximum number of iterations reached. Increase maxIter." <<
endl
674 <<
" maxIter:" << maxIter <<
endl
675 <<
" nChangedPoints:" << nChangedPoints_ <<
endl
676 <<
" nChangedEdges:" << nChangedEdges_ <<
endl
682 template<
class Type,
class TrackingData>
692 allPointInfo_(allPointInfo),
693 allEdgeInfo_(allEdgeInfo),
695 changedPoint_(mesh_.nPoints(),
false),
696 changedPoints_(mesh_.nPoints()),
698 changedEdge_(mesh_.nEdges(),
false),
699 changedEdges_(mesh_.nEdges()),
701 nCyclicPatches_(countPatchType<cyclicPolyPatch>()),
703 nUnvisitedPoints_(mesh_.nPoints()),
704 nUnvisitedEdges_(mesh_.nEdges())
710 template<
class Type,
class TrackingData>
718 template<
class Type,
class TrackingData>
721 return nUnvisitedPoints_;
725 template<
class Type,
class TrackingData>
728 return nUnvisitedEdges_;
733 template<
class Type,
class TrackingData>
740 forAll(changedPoints, changedPointi)
742 const label pointi = changedPoints[changedPointi];
744 const bool wasValid = allPointInfo_[pointi].valid(td_);
747 allPointInfo_[pointi] = changedPointsInfo[changedPointi];
750 if (!wasValid && allPointInfo_[pointi].valid(td_))
757 if (!changedPoint_[pointi])
759 changedPoint_[pointi] =
true;
760 changedPoints_[nChangedPoints_++] = pointi;
765 handleCollocatedPoints();
770 template<
class Type,
class TrackingData>
775 label changedEdgeI = 0;
776 changedEdgeI < nChangedEdges_;
780 label edgeI = changedEdges_[changedEdgeI];
782 if (!changedEdge_[edgeI])
786 <<
" not marked as having been changed" <<
nl
787 <<
"This might be caused by multiple occurences of the same"
792 const Type& neighbourWallInfo = allEdgeInfo_[edgeI];
795 const edge&
e = mesh_.edges()[edgeI];
799 Type& currentWallInfo = allPointInfo_[
e[eI]];
801 if (!currentWallInfo.equal(neighbourWallInfo, td_))
814 changedEdge_[edgeI] =
false;
820 if (nCyclicPatches_ > 0)
823 handleCyclicPatches();
825 if (Pstream::parRun())
837 label totNChanged = nChangedPoints_;
846 template<
class Type,
class TrackingData>
853 label changedPointi = 0;
854 changedPointi < nChangedPoints_;
858 label pointi = changedPoints_[changedPointi];
860 if (!changedPoint_[pointi])
863 <<
"Point " << pointi
864 <<
" not marked as having been changed" <<
nl
865 <<
"This might be caused by multiple occurences of the same"
869 const Type& neighbourWallInfo = allPointInfo_[pointi];
873 const labelList& edgeLabels = pointEdges[pointi];
874 forAll(edgeLabels, edgeLabelI)
876 label edgeI = edgeLabels[edgeLabelI];
878 Type& currentWallInfo = allEdgeInfo_[edgeI];
880 if (!currentWallInfo.equal(neighbourWallInfo, td_))
893 changedPoint_[pointi] =
false;
905 label totNChanged = nChangedEdges_;
914 template<
class Type,
class TrackingData>
920 if (nCyclicPatches_ > 0)
923 handleCyclicPatches();
925 if (Pstream::parRun())
935 while (iter < maxIter)
937 while (iter < maxIter)
941 Info<< typeName <<
": Iteration " << iter <<
endl;
944 label nEdges = pointToEdge();
948 Info<< typeName <<
": Total changed edges : "
961 Info<< typeName <<
": Total changed points : "
963 << typeName <<
": Total evaluations : "
965 << typeName <<
": Remaining unvisited points: "
967 << typeName <<
": Remaining unvisited edges : "
986 Info<< typeName <<
": Collocated point sync : "