00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #include "PointEdgeWave.H"
00028 #include "polyMesh.H"
00029 #include "processorPolyPatch.H"
00030 #include "cyclicPolyPatch.H"
00031 #include "OPstream.H"
00032 #include "IPstream.H"
00033 #include "PstreamCombineReduceOps.H"
00034 #include "debug.H"
00035 #include "typeInfo.H"
00036
00037
00038
00039 template <class Type>
00040 Foam::scalar Foam::PointEdgeWave<Type>::propagationTol_ = 0.01;
00041
00042
00043
00044 template <class Type>
00045 void Foam::PointEdgeWave<Type>::offset(const label val, labelList& elems)
00046 {
00047 forAll(elems, i)
00048 {
00049 elems[i] += val;
00050 }
00051 }
00052
00053
00054
00055
00056
00057
00058
00059
00060 template <class Type>
00061 void Foam::PointEdgeWave<Type>::calcCyclicAddressing()
00062 {
00063 label cycHalf = 0;
00064
00065 forAll(mesh_.boundaryMesh(), patchI)
00066 {
00067 const polyPatch& patch = mesh_.boundaryMesh()[patchI];
00068
00069 if (isA<cyclicPolyPatch>(patch))
00070 {
00071 label halfSize = patch.size()/2;
00072
00073 SubList<face> halfAFaces
00074 (
00075 mesh_.faces(),
00076 halfSize,
00077 patch.start()
00078 );
00079
00080 cycHalves_.set
00081 (
00082 cycHalf++,
00083 new primitivePatch(halfAFaces, mesh_.points())
00084 );
00085
00086 SubList<face> halfBFaces
00087 (
00088 mesh_.faces(),
00089 halfSize,
00090 patch.start() + halfSize
00091 );
00092
00093 cycHalves_.set
00094 (
00095 cycHalf++,
00096 new primitivePatch(halfBFaces, mesh_.points())
00097 );
00098 }
00099 }
00100 }
00101
00102
00103
00104 template <class Type>
00105 void Foam::PointEdgeWave<Type>::leaveDomain
00106 (
00107 const polyPatch& meshPatch,
00108 const primitivePatch& patch,
00109 const labelList& patchPointLabels,
00110 List<Type>& pointInfo
00111 ) const
00112 {
00113 const labelList& meshPoints = patch.meshPoints();
00114
00115 forAll(patchPointLabels, i)
00116 {
00117 label patchPointI = patchPointLabels[i];
00118
00119 const point& pt = patch.points()[meshPoints[patchPointI]];
00120
00121 pointInfo[i].leaveDomain(meshPatch, patchPointI, pt);
00122 }
00123 }
00124
00125
00126
00127 template <class Type>
00128 void Foam::PointEdgeWave<Type>::enterDomain
00129 (
00130 const polyPatch& meshPatch,
00131 const primitivePatch& patch,
00132 const labelList& patchPointLabels,
00133 List<Type>& pointInfo
00134 ) const
00135 {
00136 const labelList& meshPoints = patch.meshPoints();
00137
00138 forAll(patchPointLabels, i)
00139 {
00140 label patchPointI = patchPointLabels[i];
00141
00142 const point& pt = patch.points()[meshPoints[patchPointI]];
00143
00144 pointInfo[i].enterDomain(meshPatch, patchPointI, pt);
00145 }
00146 }
00147
00148
00149
00150 template <class Type>
00151 void Foam::PointEdgeWave<Type>::transform
00152 (
00153 const tensorField& rotTensor,
00154 List<Type>& pointInfo
00155 ) const
00156 {
00157 if (rotTensor.size() == 1)
00158 {
00159 const tensor& T = rotTensor[0];
00160
00161 forAll(pointInfo, i)
00162 {
00163 pointInfo[i].transform(T);
00164 }
00165 }
00166 else
00167 {
00168 FatalErrorIn
00169 (
00170 "PointEdgeWave<Type>::transform(const tensorField&, List<Type>&)"
00171 ) << "Parallel cyclics not supported" << abort(FatalError);
00172
00173 forAll(pointInfo, i)
00174 {
00175 pointInfo[i].transform(rotTensor[i]);
00176 }
00177 }
00178 }
00179
00180
00181
00182
00183
00184
00185
00186 template <class Type>
00187 bool Foam::PointEdgeWave<Type>::updatePoint
00188 (
00189 const label pointI,
00190 const label neighbourEdgeI,
00191 const Type& neighbourInfo,
00192 const scalar tol,
00193 Type& pointInfo
00194 )
00195 {
00196 nEvals_++;
00197
00198 bool wasValid = pointInfo.valid();
00199
00200 bool propagate =
00201 pointInfo.updatePoint
00202 (
00203 mesh_,
00204 pointI,
00205 neighbourEdgeI,
00206 neighbourInfo,
00207 tol
00208 );
00209
00210 if (propagate)
00211 {
00212 if (!changedPoint_[pointI])
00213 {
00214 changedPoint_[pointI] = true;
00215 changedPoints_[nChangedPoints_++] = pointI;
00216 }
00217 }
00218
00219 if (!wasValid && pointInfo.valid())
00220 {
00221 --nUnvisitedPoints_;
00222 }
00223
00224 return propagate;
00225 }
00226
00227
00228
00229
00230
00231
00232
00233 template <class Type>
00234 bool Foam::PointEdgeWave<Type>::updatePoint
00235 (
00236 const label pointI,
00237 const Type& neighbourInfo,
00238 const scalar tol,
00239 Type& pointInfo
00240 )
00241 {
00242 nEvals_++;
00243
00244 bool wasValid = pointInfo.valid();
00245
00246 bool propagate =
00247 pointInfo.updatePoint
00248 (
00249 mesh_,
00250 pointI,
00251 neighbourInfo,
00252 tol
00253 );
00254
00255 if (propagate)
00256 {
00257 if (!changedPoint_[pointI])
00258 {
00259 changedPoint_[pointI] = true;
00260 changedPoints_[nChangedPoints_++] = pointI;
00261 }
00262 }
00263
00264 if (!wasValid && pointInfo.valid())
00265 {
00266 --nUnvisitedPoints_;
00267 }
00268
00269 return propagate;
00270 }
00271
00272
00273
00274
00275
00276
00277
00278 template <class Type>
00279 bool Foam::PointEdgeWave<Type>::updateEdge
00280 (
00281 const label edgeI,
00282 const label neighbourPointI,
00283 const Type& neighbourInfo,
00284 const scalar tol,
00285 Type& edgeInfo
00286 )
00287 {
00288 nEvals_++;
00289
00290 bool wasValid = edgeInfo.valid();
00291
00292 bool propagate =
00293 edgeInfo.updateEdge
00294 (
00295 mesh_,
00296 edgeI,
00297 neighbourPointI,
00298 neighbourInfo,
00299 tol
00300 );
00301
00302 if (propagate)
00303 {
00304 if (!changedEdge_[edgeI])
00305 {
00306 changedEdge_[edgeI] = true;
00307 changedEdges_[nChangedEdges_++] = edgeI;
00308 }
00309 }
00310
00311 if (!wasValid && edgeInfo.valid())
00312 {
00313 --nUnvisitedEdges_;
00314 }
00315
00316 return propagate;
00317 }
00318
00319
00320
00321 template <class Type>
00322 template <class PatchType>
00323 Foam::label Foam::PointEdgeWave<Type>::countPatchType() const
00324 {
00325 label nPatches = 0;
00326
00327 forAll(mesh_.boundaryMesh(), patchI)
00328 {
00329 if (isA<PatchType>(mesh_.boundaryMesh()[patchI]))
00330 {
00331 nPatches++;
00332 }
00333 }
00334 return nPatches;
00335 }
00336
00337
00338
00339 template <class Type>
00340 void Foam::PointEdgeWave<Type>::getChangedPatchPoints
00341 (
00342 const primitivePatch& patch,
00343
00344 DynamicList<Type>& patchInfo,
00345 DynamicList<label>& patchPoints,
00346 DynamicList<label>& owner,
00347 DynamicList<label>& ownerIndex
00348 ) const
00349 {
00350 const labelList& meshPoints = patch.meshPoints();
00351 const faceList& localFaces = patch.localFaces();
00352 const labelListList& pointFaces = patch.pointFaces();
00353
00354 forAll(meshPoints, patchPointI)
00355 {
00356 label meshPointI = meshPoints[patchPointI];
00357
00358 if (changedPoint_[meshPointI])
00359 {
00360 patchInfo.append(allPointInfo_[meshPointI]);
00361 patchPoints.append(patchPointI);
00362
00363 label patchFaceI = pointFaces[patchPointI][0];
00364
00365 const face& f = localFaces[patchFaceI];
00366
00367 label index = findIndex(f, patchPointI);
00368
00369 owner.append(patchFaceI);
00370 ownerIndex.append(index);
00371 }
00372 }
00373
00374 patchInfo.shrink();
00375 patchPoints.shrink();
00376 owner.shrink();
00377 ownerIndex.shrink();
00378 }
00379
00380
00381
00382 template <class Type>
00383 void Foam::PointEdgeWave<Type>::updateFromPatchInfo
00384 (
00385 const polyPatch& meshPatch,
00386 const primitivePatch& patch,
00387 const labelList& owner,
00388 const labelList& ownerIndex,
00389 List<Type>& patchInfo
00390 )
00391 {
00392 const faceList& localFaces = patch.localFaces();
00393 const labelList& meshPoints = patch.meshPoints();
00394
00395
00396 labelList changedPatchPoints(patchInfo.size());
00397 labelList changedMeshPoints(patchInfo.size());
00398
00399 forAll(owner, i)
00400 {
00401 label faceI = owner[i];
00402
00403 const face& f = localFaces[faceI];
00404
00405 label index = (f.size() - ownerIndex[i]) % f.size();
00406
00407 changedPatchPoints[i] = f[index];
00408 changedMeshPoints[i] = meshPoints[f[index]];
00409 }
00410
00411
00412 enterDomain(meshPatch, patch, changedPatchPoints, patchInfo);
00413
00414
00415 forAll(patchInfo, i)
00416 {
00417 updatePoint
00418 (
00419 changedMeshPoints[i],
00420 patchInfo[i],
00421 propagationTol_,
00422 allPointInfo_[changedMeshPoints[i]]
00423 );
00424 }
00425 }
00426
00427
00428
00429
00430 template <class Type>
00431 void Foam::PointEdgeWave<Type>::handleProcPatches()
00432 {
00433
00434
00435
00436 forAll(mesh_.boundaryMesh(), patchI)
00437 {
00438 const polyPatch& patch = mesh_.boundaryMesh()[patchI];
00439
00440 if (isA<processorPolyPatch>(patch))
00441 {
00442
00443
00444 DynamicList<Type> patchInfo(patch.nPoints());
00445 DynamicList<label> patchPoints(patch.nPoints());
00446 DynamicList<label> owner(patch.nPoints());
00447 DynamicList<label> ownerIndex(patch.nPoints());
00448
00449 getChangedPatchPoints
00450 (
00451 patch,
00452 patchInfo,
00453 patchPoints,
00454 owner,
00455 ownerIndex
00456 );
00457
00458
00459 leaveDomain(patch, patch, patchPoints, patchInfo);
00460
00461 const processorPolyPatch& procPatch =
00462 refCast<const processorPolyPatch>(patch);
00463
00464 if (debug)
00465 {
00466 Pout<< "Processor patch " << patchI << ' ' << patch.name()
00467 << " communicating with " << procPatch.neighbProcNo()
00468 << " Sending:" << patchInfo.size() << endl;
00469 }
00470
00471 {
00472 OPstream toNeighbour
00473 (
00474 Pstream::blocking,
00475 procPatch.neighbProcNo()
00476 );
00477
00478 toNeighbour << owner << ownerIndex << patchInfo;
00479 }
00480 }
00481 }
00482
00483
00484
00485
00486
00487
00488 forAll(mesh_.boundaryMesh(), patchI)
00489 {
00490 const polyPatch& patch = mesh_.boundaryMesh()[patchI];
00491
00492 if (isA<processorPolyPatch>(patch))
00493 {
00494 const processorPolyPatch& procPatch =
00495 refCast<const processorPolyPatch>(patch);
00496
00497 List<Type> patchInfo;
00498 labelList owner;
00499 labelList ownerIndex;
00500 {
00501 IPstream fromNeighbour
00502 (
00503 Pstream::blocking,
00504 procPatch.neighbProcNo()
00505 );
00506
00507 fromNeighbour >> owner >> ownerIndex >> patchInfo;
00508 }
00509
00510 if (debug)
00511 {
00512 Pout<< "Processor patch " << patchI << ' ' << patch.name()
00513 << " communicating with " << procPatch.neighbProcNo()
00514 << " Received:" << patchInfo.size() << endl;
00515 }
00516
00517
00518 if (!procPatch.parallel())
00519 {
00520 transform(procPatch.reverseT(), patchInfo);
00521 }
00522
00523 updateFromPatchInfo
00524 (
00525 patch,
00526 patch,
00527 owner,
00528 ownerIndex,
00529 patchInfo
00530 );
00531 }
00532 }
00533
00534
00535
00536
00537
00538
00539
00540
00541 const globalMeshData& pd = mesh_.globalData();
00542
00543 List<Type> sharedData(pd.nGlobalPoints());
00544
00545 forAll(pd.sharedPointLabels(), i)
00546 {
00547 label meshPointI = pd.sharedPointLabels()[i];
00548
00549
00550 sharedData[pd.sharedPointAddr()[i]] = allPointInfo_[meshPointI];
00551 }
00552
00553
00554
00555 combineReduce(sharedData, listUpdateOp<Type>());
00556
00557 forAll(pd.sharedPointLabels(), i)
00558 {
00559 label meshPointI = pd.sharedPointLabels()[i];
00560
00561
00562 updatePoint
00563 (
00564 meshPointI,
00565 sharedData[pd.sharedPointAddr()[i]],
00566 propagationTol_,
00567 allPointInfo_[meshPointI]
00568 );
00569 }
00570 }
00571
00572
00573 template <class Type>
00574 void Foam::PointEdgeWave<Type>::handleCyclicPatches()
00575 {
00576
00577
00578
00579 label cycHalf = 0;
00580
00581 forAll(mesh_.boundaryMesh(), patchI)
00582 {
00583 const polyPatch& patch = mesh_.boundaryMesh()[patchI];
00584
00585 if (isA<cyclicPolyPatch>(patch))
00586 {
00587 const primitivePatch& halfA = cycHalves_[cycHalf++];
00588 const primitivePatch& halfB = cycHalves_[cycHalf++];
00589
00590
00591
00592 DynamicList<Type> halfAInfo(halfA.nPoints());
00593 DynamicList<label> halfAPoints(halfA.nPoints());
00594 DynamicList<label> halfAOwner(halfA.nPoints());
00595 DynamicList<label> halfAIndex(halfA.nPoints());
00596
00597 getChangedPatchPoints
00598 (
00599 halfA,
00600 halfAInfo,
00601 halfAPoints,
00602 halfAOwner,
00603 halfAIndex
00604 );
00605
00606
00607
00608 DynamicList<Type> halfBInfo(halfB.nPoints());
00609 DynamicList<label> halfBPoints(halfB.nPoints());
00610 DynamicList<label> halfBOwner(halfB.nPoints());
00611 DynamicList<label> halfBIndex(halfB.nPoints());
00612
00613 getChangedPatchPoints
00614 (
00615 halfB,
00616 halfBInfo,
00617 halfBPoints,
00618 halfBOwner,
00619 halfBIndex
00620 );
00621
00622
00623
00624 leaveDomain(patch, halfA, halfAPoints, halfAInfo);
00625
00626
00627 leaveDomain(patch, halfB, halfBPoints, halfBInfo);
00628
00629
00630
00631 const cyclicPolyPatch& cycPatch =
00632 refCast<const cyclicPolyPatch>(patch);
00633
00634 if (!cycPatch.parallel())
00635 {
00636
00637 transform(cycPatch.forwardT(), halfAInfo);
00638
00639
00640 transform(cycPatch.reverseT(), halfBInfo);
00641 }
00642
00643 if (debug)
00644 {
00645 Pout<< "Cyclic patch " << patchI << ' ' << patch.name()
00646 << " Changed on first half : " << halfAInfo.size()
00647 << " Changed on second half : " << halfBInfo.size()
00648 << endl;
00649 }
00650
00651
00652 updateFromPatchInfo
00653 (
00654 patch,
00655 halfA,
00656 halfBOwner,
00657 halfBIndex,
00658 halfBInfo
00659 );
00660
00661
00662 updateFromPatchInfo
00663 (
00664 patch,
00665 halfB,
00666 halfAOwner,
00667 halfAIndex,
00668 halfAInfo
00669 );
00670
00671 if (debug)
00672 {
00673
00674 }
00675 }
00676 }
00677 }
00678
00679
00680
00681
00682
00683
00684 template <class Type>
00685 Foam::PointEdgeWave<Type>::PointEdgeWave
00686 (
00687 const polyMesh& mesh,
00688 const labelList& changedPoints,
00689 const List<Type>& changedPointsInfo,
00690
00691 List<Type>& allPointInfo,
00692 List<Type>& allEdgeInfo,
00693
00694 const label maxIter
00695 )
00696 :
00697 mesh_(mesh),
00698 allPointInfo_(allPointInfo),
00699 allEdgeInfo_(allEdgeInfo),
00700 changedPoint_(mesh_.nPoints(), false),
00701 changedPoints_(mesh_.nPoints()),
00702 nChangedPoints_(0),
00703 changedEdge_(mesh_.nEdges(), false),
00704 changedEdges_(mesh_.nEdges()),
00705 nChangedEdges_(0),
00706 nCyclicPatches_(countPatchType<cyclicPolyPatch>()),
00707 cycHalves_(2*nCyclicPatches_),
00708 nEvals_(0),
00709 nUnvisitedPoints_(mesh_.nPoints()),
00710 nUnvisitedEdges_(mesh_.nEdges())
00711 {
00712 if (allPointInfo_.size() != mesh_.nPoints())
00713 {
00714 FatalErrorIn
00715 (
00716 "PointEdgeWave<Type>::PointEdgeWave"
00717 "(const polyMesh&, const labelList&, const List<Type>,"
00718 " List<Type>&, List<Type>&, const label maxIter)"
00719 ) << "size of pointInfo work array is not equal to the number"
00720 << " of points in the mesh" << endl
00721 << " pointInfo :" << allPointInfo_.size() << endl
00722 << " mesh.nPoints:" << mesh_.nPoints()
00723 << exit(FatalError);
00724 }
00725 if (allEdgeInfo_.size() != mesh_.nEdges())
00726 {
00727 FatalErrorIn
00728 (
00729 "PointEdgeWave<Type>::PointEdgeWave"
00730 "(const polyMesh&, const labelList&, const List<Type>,"
00731 " List<Type>&, List<Type>&, const label maxIter)"
00732 ) << "size of edgeInfo work array is not equal to the number"
00733 << " of edges in the mesh" << endl
00734 << " edgeInfo :" << allEdgeInfo_.size() << endl
00735 << " mesh.nEdges:" << mesh_.nEdges()
00736 << exit(FatalError);
00737 }
00738
00739
00740
00741 if (nCyclicPatches_ > 0)
00742 {
00743 calcCyclicAddressing();
00744 }
00745
00746
00747
00748 setPointInfo(changedPoints, changedPointsInfo);
00749
00750 if (debug)
00751 {
00752 Pout<< "Seed points : " << nChangedPoints_ << endl;
00753 }
00754
00755
00756 label iter = iterate(maxIter);
00757
00758 if ((maxIter > 0) && (iter >= maxIter))
00759 {
00760 FatalErrorIn
00761 (
00762 "PointEdgeWave<Type>::PointEdgeWave"
00763 "(const polyMesh&, const labelList&, const List<Type>,"
00764 " List<Type>&, List<Type>&, const label maxIter)"
00765 ) << "Maximum number of iterations reached. Increase maxIter." << endl
00766 << " maxIter:" << maxIter << endl
00767 << " nChangedPoints:" << nChangedPoints_ << endl
00768 << " nChangedEdges:" << nChangedEdges_ << endl
00769 << exit(FatalError);
00770 }
00771 }
00772
00773
00774
00775
00776 template <class Type>
00777 Foam::PointEdgeWave<Type>::~PointEdgeWave()
00778 {}
00779
00780
00781
00782
00783
00784 template <class Type>
00785 Foam::label Foam::PointEdgeWave<Type>::getUnsetPoints() const
00786 {
00787 return nUnvisitedPoints_;
00788 }
00789
00790
00791 template <class Type>
00792 Foam::label Foam::PointEdgeWave<Type>::getUnsetEdges() const
00793 {
00794 return nUnvisitedEdges_;
00795 }
00796
00797
00798
00799 template <class Type>
00800 void Foam::PointEdgeWave<Type>::setPointInfo
00801 (
00802 const labelList& changedPoints,
00803 const List<Type>& changedPointsInfo
00804 )
00805 {
00806 forAll(changedPoints, changedPointI)
00807 {
00808 label pointI = changedPoints[changedPointI];
00809
00810 bool wasValid = allPointInfo_[pointI].valid();
00811
00812
00813 allPointInfo_[pointI] = changedPointsInfo[changedPointI];
00814
00815
00816 if (!wasValid && allPointInfo_[pointI].valid())
00817 {
00818 --nUnvisitedPoints_;
00819 }
00820
00821
00822
00823 if (!changedPoint_[pointI])
00824 {
00825 changedPoint_[pointI] = true;
00826 changedPoints_[nChangedPoints_++] = pointI;
00827 }
00828 }
00829 }
00830
00831
00832
00833 template <class Type>
00834 Foam::label Foam::PointEdgeWave<Type>::edgeToPoint()
00835 {
00836 for
00837 (
00838 label changedEdgeI = 0;
00839 changedEdgeI < nChangedEdges_;
00840 changedEdgeI++
00841 )
00842 {
00843 label edgeI = changedEdges_[changedEdgeI];
00844
00845 if (!changedEdge_[edgeI])
00846 {
00847 FatalErrorIn("PointEdgeWave<Type>::edgeToPoint()")
00848 << "edge " << edgeI
00849 << " not marked as having been changed" << nl
00850 << "This might be caused by multiple occurences of the same"
00851 << " seed point." << abort(FatalError);
00852 }
00853
00854
00855 const Type& neighbourWallInfo = allEdgeInfo_[edgeI];
00856
00857
00858 const edge& e = mesh_.edges()[edgeI];
00859
00860 forAll(e, eI)
00861 {
00862 Type& currentWallInfo = allPointInfo_[e[eI]];
00863
00864 if (currentWallInfo != neighbourWallInfo)
00865 {
00866 updatePoint
00867 (
00868 e[eI],
00869 edgeI,
00870 neighbourWallInfo,
00871 propagationTol_,
00872 currentWallInfo
00873 );
00874 }
00875 }
00876
00877
00878 changedEdge_[edgeI] = false;
00879 }
00880
00881
00882 nChangedEdges_ = 0;
00883
00884 if (nCyclicPatches_ > 0)
00885 {
00886
00887 handleCyclicPatches();
00888 }
00889 if (Pstream::parRun())
00890 {
00891
00892 handleProcPatches();
00893 }
00894
00895 if (debug)
00896 {
00897 Pout<< "Changed points : " << nChangedPoints_ << endl;
00898 }
00899
00900
00901 label totNChanged = nChangedPoints_;
00902
00903 reduce(totNChanged, sumOp<label>());
00904
00905 return totNChanged;
00906 }
00907
00908
00909
00910 template <class Type>
00911 Foam::label Foam::PointEdgeWave<Type>::pointToEdge()
00912 {
00913 const labelListList& pointEdges = mesh_.pointEdges();
00914
00915 for
00916 (
00917 label changedPointI = 0;
00918 changedPointI < nChangedPoints_;
00919 changedPointI++
00920 )
00921 {
00922 label pointI = changedPoints_[changedPointI];
00923
00924 if (!changedPoint_[pointI])
00925 {
00926 FatalErrorIn("PointEdgeWave<Type>::pointToEdge()")
00927 << "Point " << pointI
00928 << " not marked as having been changed" << nl
00929 << "This might be caused by multiple occurences of the same"
00930 << " seed point." << abort(FatalError);
00931 }
00932
00933 const Type& neighbourWallInfo = allPointInfo_[pointI];
00934
00935
00936
00937 const labelList& edgeLabels = pointEdges[pointI];
00938 forAll(edgeLabels, edgeLabelI)
00939 {
00940 label edgeI = edgeLabels[edgeLabelI];
00941
00942 Type& currentWallInfo = allEdgeInfo_[edgeI];
00943
00944 if (currentWallInfo != neighbourWallInfo)
00945 {
00946 updateEdge
00947 (
00948 edgeI,
00949 pointI,
00950 neighbourWallInfo,
00951 propagationTol_,
00952 currentWallInfo
00953 );
00954 }
00955 }
00956
00957
00958 changedPoint_[pointI] = false;
00959 }
00960
00961
00962 nChangedPoints_ = 0;
00963
00964 if (debug)
00965 {
00966 Pout<< "Changed edges : " << nChangedEdges_ << endl;
00967 }
00968
00969
00970 label totNChanged = nChangedEdges_;
00971
00972 reduce(totNChanged, sumOp<label>());
00973
00974 return totNChanged;
00975 }
00976
00977
00978
00979 template <class Type>
00980 Foam::label Foam::PointEdgeWave<Type>::iterate(const label maxIter)
00981 {
00982 if (nCyclicPatches_ > 0)
00983 {
00984
00985 handleCyclicPatches();
00986 }
00987 if (Pstream::parRun())
00988 {
00989
00990 handleProcPatches();
00991 }
00992
00993 nEvals_ = 0;
00994
00995 label iter = 0;
00996
00997 while(iter < maxIter)
00998 {
00999 if (debug)
01000 {
01001 Pout<< "Iteration " << iter << endl;
01002 }
01003
01004 label nEdges = pointToEdge();
01005
01006 if (debug)
01007 {
01008 Pout<< "Total changed edges : " << nEdges << endl;
01009 }
01010
01011 if (nEdges == 0)
01012 {
01013 break;
01014 }
01015
01016 label nPoints = edgeToPoint();
01017
01018 if (debug)
01019 {
01020 Pout<< "Total changed points : " << nPoints << endl;
01021
01022 Pout<< "Total evaluations : " << nEvals_ << endl;
01023
01024 Pout<< "Remaining unvisited points: " << nUnvisitedPoints_ << endl;
01025
01026 Pout<< "Remaining unvisited edges : " << nUnvisitedEdges_ << endl;
01027
01028 Pout<< endl;
01029 }
01030
01031 if (nPoints == 0)
01032 {
01033 break;
01034 }
01035
01036 iter++;
01037 }
01038
01039 return iter;
01040 }
01041
01042