64 forAll(mesh_.boundaryMesh(), patchI)
66 const polyPatch& patch = mesh_.boundaryMesh()[patchI];
68 if (isA<cyclicPolyPatch>(patch))
70 label halfSize = patch.size()/2;
72 SubList<face> halfAFaces
85 SubList<face> halfBFaces
89 patch.start() + halfSize
103 template <
class Type>
106 const polyPatch& meshPatch,
109 List<Type>& pointInfo
112 const labelList& meshPoints = patch.meshPoints();
114 forAll(patchPointLabels, i)
116 label patchPointI = patchPointLabels[i];
118 const point& pt = patch.points()[meshPoints[patchPointI]];
120 pointInfo[i].leaveDomain(meshPatch, patchPointI, pt);
126 template <
class Type>
129 const polyPatch& meshPatch,
132 List<Type>& pointInfo
135 const labelList& meshPoints = patch.meshPoints();
137 forAll(patchPointLabels, i)
139 label patchPointI = patchPointLabels[i];
141 const point& pt = patch.points()[meshPoints[patchPointI]];
143 pointInfo[i].enterDomain(meshPatch, patchPointI, pt);
149 template <
class Type>
153 List<Type>& pointInfo
156 if (rotTensor.size() == 1)
158 const tensor&
T = rotTensor[0];
162 pointInfo[i].transform(T);
169 "PointEdgeWave<Type>::transform(const tensorField&, List<Type>&)"
174 pointInfo[i].transform(rotTensor[i]);
185 template <
class Type>
189 const label neighbourEdgeI,
190 const Type& neighbourInfo,
197 bool wasValid = pointInfo.valid();
200 pointInfo.updatePoint
211 if (!changedPoint_[pointI])
213 changedPoint_[pointI] =
true;
214 changedPoints_[nChangedPoints_++] = pointI;
218 if (!wasValid && pointInfo.valid())
232 template <
class Type>
236 const Type& neighbourInfo,
243 bool wasValid = pointInfo.valid();
246 pointInfo.updatePoint
256 if (!changedPoint_[pointI])
258 changedPoint_[pointI] =
true;
259 changedPoints_[nChangedPoints_++] = pointI;
263 if (!wasValid && pointInfo.valid())
277 template <
class Type>
281 const label neighbourPointI,
282 const Type& neighbourInfo,
289 bool wasValid = edgeInfo.valid();
303 if (!changedEdge_[edgeI])
305 changedEdge_[edgeI] =
true;
306 changedEdges_[nChangedEdges_++] = edgeI;
310 if (!wasValid && edgeInfo.valid())
320 template <
class Type>
321 template <
class PatchType>
326 forAll(mesh_.boundaryMesh(), patchI)
328 if (isA<PatchType>(mesh_.boundaryMesh()[patchI]))
338 template <
class Type>
343 DynamicList<Type>& patchInfo,
344 DynamicList<label>& patchPoints,
345 DynamicList<label>& owner,
346 DynamicList<label>& ownerIndex
349 const labelList& meshPoints = patch.meshPoints();
350 const faceList& localFaces = patch.localFaces();
353 forAll(meshPoints, patchPointI)
355 label meshPointI = meshPoints[patchPointI];
357 if (changedPoint_[meshPointI])
359 patchInfo.append(allPointInfo_[meshPointI]);
360 patchPoints.append(patchPointI);
362 label patchFaceI = pointFaces[patchPointI][0];
364 const face&
f = localFaces[patchFaceI];
368 owner.append(patchFaceI);
369 ownerIndex.append(index);
374 patchPoints.shrink();
381 template <
class Type>
384 const polyPatch& meshPatch,
388 List<Type>& patchInfo
391 const faceList& localFaces = patch.localFaces();
392 const labelList& meshPoints = patch.meshPoints();
395 labelList changedPatchPoints(patchInfo.size());
396 labelList changedMeshPoints(patchInfo.size());
400 label faceI = owner[i];
402 const face& f = localFaces[faceI];
404 label index = (f.size() - ownerIndex[i]) % f.size();
406 changedPatchPoints[i] = f[index];
407 changedMeshPoints[i] = meshPoints[f[index]];
411 enterDomain(meshPatch, patch, changedPatchPoints, patchInfo);
418 changedMeshPoints[i],
421 allPointInfo_[changedMeshPoints[i]]
429 template <
class Type>
435 forAll(mesh_.boundaryMesh(), patchI)
437 const polyPatch& patch = mesh_.boundaryMesh()[patchI];
439 if (isA<processorPolyPatch>(patch))
443 DynamicList<Type> patchInfo(patch.nPoints());
444 DynamicList<label> patchPoints(patch.nPoints());
445 DynamicList<label> owner(patch.nPoints());
446 DynamicList<label> ownerIndex(patch.nPoints());
448 getChangedPatchPoints
458 leaveDomain(patch, patch, patchPoints, patchInfo);
460 const processorPolyPatch& procPatch =
461 refCast<const processorPolyPatch>(patch);
465 Pout<<
"Processor patch " << patchI <<
' ' << patch.
name()
466 <<
" communicating with " << procPatch.neighbProcNo()
467 <<
" Sending:" << patchInfo.size() <<
endl;
474 procPatch.neighbProcNo()
477 toNeighbour << owner << ownerIndex << patchInfo;
487 forAll(mesh_.boundaryMesh(), patchI)
489 const polyPatch& patch = mesh_.boundaryMesh()[patchI];
491 if (isA<processorPolyPatch>(patch))
493 const processorPolyPatch& procPatch =
494 refCast<const processorPolyPatch>(patch);
496 List<Type> patchInfo;
500 IPstream fromNeighbour
503 procPatch.neighbProcNo()
506 fromNeighbour >> owner >> ownerIndex >> patchInfo;
511 Pout<<
"Processor patch " << patchI <<
' ' << patch.
name()
512 <<
" communicating with " << procPatch.neighbProcNo()
513 <<
" Received:" << patchInfo.size() <<
endl;
517 if (!procPatch.parallel())
519 transform(procPatch.forwardT(), patchInfo);
540 const globalMeshData& pd = mesh_.globalData();
542 List<Type> sharedData(pd.nGlobalPoints());
544 forAll(pd.sharedPointLabels(), i)
546 label meshPointI = pd.sharedPointLabels()[i];
549 sharedData[pd.sharedPointAddr()[i]] = allPointInfo_[meshPointI];
556 forAll(pd.sharedPointLabels(), i)
558 label meshPointI = pd.sharedPointLabels()[i];
564 sharedData[pd.sharedPointAddr()[i]],
566 allPointInfo_[meshPointI]
572 template <
class Type>
580 forAll(mesh_.boundaryMesh(), patchI)
582 const polyPatch& patch = mesh_.boundaryMesh()[patchI];
584 if (isA<cyclicPolyPatch>(patch))
591 DynamicList<Type> halfAInfo(halfA.nPoints());
592 DynamicList<label> halfAPoints(halfA.nPoints());
593 DynamicList<label> halfAOwner(halfA.nPoints());
594 DynamicList<label> halfAIndex(halfA.nPoints());
596 getChangedPatchPoints
607 DynamicList<Type> halfBInfo(halfB.nPoints());
608 DynamicList<label> halfBPoints(halfB.nPoints());
609 DynamicList<label> halfBOwner(halfB.nPoints());
610 DynamicList<label> halfBIndex(halfB.nPoints());
612 getChangedPatchPoints
623 leaveDomain(patch, halfA, halfAPoints, halfAInfo);
626 leaveDomain(patch, halfB, halfBPoints, halfBInfo);
630 const cyclicPolyPatch& cycPatch =
631 refCast<const cyclicPolyPatch>(patch);
633 if (!cycPatch.parallel())
636 transform(cycPatch.reverseT(), halfAInfo);
639 transform(cycPatch.forwardT(), halfBInfo);
644 Pout<<
"Cyclic patch " << patchI <<
' ' << patch.
name()
645 <<
" Changed on first half : " << halfAInfo.size()
646 <<
" Changed on second half : " << halfBInfo.size()
683 template <
class Type>
697 allPointInfo_(allPointInfo),
698 allEdgeInfo_(allEdgeInfo),
699 changedPoint_(mesh_.nPoints(),
false),
700 changedPoints_(mesh_.nPoints()),
702 changedEdge_(mesh_.nEdges(),
false),
703 changedEdges_(mesh_.nEdges()),
705 nCyclicPatches_(countPatchType<cyclicPolyPatch>()),
706 cycHalves_(2*nCyclicPatches_),
708 nUnvisitedPoints_(mesh_.nPoints()),
709 nUnvisitedEdges_(mesh_.nEdges())
711 if (allPointInfo_.size() != mesh_.nPoints())
715 "PointEdgeWave<Type>::PointEdgeWave"
716 "(const polyMesh&, const labelList&, const List<Type>,"
717 " List<Type>&, List<Type>&, const label maxIter)"
718 ) <<
"size of pointInfo work array is not equal to the number"
719 <<
" of points in the mesh" <<
endl
720 <<
" pointInfo :" << allPointInfo_.size() <<
endl
721 <<
" mesh.nPoints:" << mesh_.nPoints()
724 if (allEdgeInfo_.size() != mesh_.nEdges())
728 "PointEdgeWave<Type>::PointEdgeWave"
729 "(const polyMesh&, const labelList&, const List<Type>,"
730 " List<Type>&, List<Type>&, const label maxIter)"
731 ) <<
"size of edgeInfo work array is not equal to the number"
732 <<
" of edges in the mesh" <<
endl
733 <<
" edgeInfo :" << allEdgeInfo_.size() <<
endl
734 <<
" mesh.nEdges:" << mesh_.nEdges()
740 if (nCyclicPatches_ > 0)
742 calcCyclicAddressing();
747 setPointInfo(changedPoints, changedPointsInfo);
751 Pout<<
"Seed points : " << nChangedPoints_ <<
endl;
755 label iter = iterate(maxIter);
757 if ((maxIter > 0) && (iter >= maxIter))
761 "PointEdgeWave<Type>::PointEdgeWave"
762 "(const polyMesh&, const labelList&, const List<Type>,"
763 " List<Type>&, List<Type>&, const label maxIter)"
764 ) <<
"Maximum number of iterations reached. Increase maxIter." <<
endl
765 <<
" maxIter:" << maxIter <<
endl
766 <<
" nChangedPoints:" << nChangedPoints_ <<
endl
767 <<
" nChangedEdges:" << nChangedEdges_ <<
endl
775 template <
class Type>
783 template <
class Type>
786 return nUnvisitedPoints_;
790 template <
class Type>
793 return nUnvisitedEdges_;
798 template <
class Type>
805 forAll(changedPoints, changedPointI)
807 label pointI = changedPoints[changedPointI];
809 bool wasValid = allPointInfo_[pointI].valid();
812 allPointInfo_[pointI] = changedPointsInfo[changedPointI];
815 if (!wasValid && allPointInfo_[pointI].valid())
822 if (!changedPoint_[pointI])
824 changedPoint_[pointI] =
true;
825 changedPoints_[nChangedPoints_++] = pointI;
832 template <
class Type>
837 label changedEdgeI = 0;
838 changedEdgeI < nChangedEdges_;
842 label edgeI = changedEdges_[changedEdgeI];
844 if (!changedEdge_[edgeI])
848 <<
" not marked as having been changed" <<
nl
849 <<
"This might be caused by multiple occurences of the same"
854 const Type& neighbourWallInfo = allEdgeInfo_[edgeI];
857 const edge&
e = mesh_.edges()[edgeI];
861 Type& currentWallInfo = allPointInfo_[e[eI]];
863 if (currentWallInfo != neighbourWallInfo)
877 changedEdge_[edgeI] =
false;
883 if (nCyclicPatches_ > 0)
886 handleCyclicPatches();
888 if (Pstream::parRun())
896 Pout<<
"Changed points : " << nChangedPoints_ <<
endl;
900 label totNChanged = nChangedPoints_;
909 template <
class Type>
916 label changedPointI = 0;
917 changedPointI < nChangedPoints_;
921 label pointI = changedPoints_[changedPointI];
923 if (!changedPoint_[pointI])
926 <<
"Point " << pointI
927 <<
" not marked as having been changed" <<
nl
928 <<
"This might be caused by multiple occurences of the same"
932 const Type& neighbourWallInfo = allPointInfo_[pointI];
936 const labelList& edgeLabels = pointEdges[pointI];
937 forAll(edgeLabels, edgeLabelI)
939 label edgeI = edgeLabels[edgeLabelI];
941 Type& currentWallInfo = allEdgeInfo_[edgeI];
943 if (currentWallInfo != neighbourWallInfo)
957 changedPoint_[pointI] =
false;
965 Pout<<
"Changed edges : " << nChangedEdges_ <<
endl;
969 label totNChanged = nChangedEdges_;
978 template <
class Type>
981 if (nCyclicPatches_ > 0)
984 handleCyclicPatches();
986 if (Pstream::parRun())
996 while(iter < maxIter)
1000 Pout<<
"Iteration " << iter <<
endl;
1003 label nEdges = pointToEdge();
1007 Pout<<
"Total changed edges : " << nEdges <<
endl;
1015 label
nPoints = edgeToPoint();
1019 Pout<<
"Total changed points : " << nPoints <<
endl;
1021 Pout<<
"Total evaluations : " << nEvals_ <<
endl;
1023 Pout<<
"Remaining unvisited points: " << nUnvisitedPoints_ <<
endl;
1025 Pout<<
"Remaining unvisited edges : " << nUnvisitedEdges_ <<
endl;