PointEdgeWave.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2026 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "PointEdgeWave.H"
27 #include "polyMesh.H"
28 #include "processorPolyPatch.H"
29 #include "cyclicPolyPatch.H"
30 #include "OPstream.H"
31 #include "IPstream.H"
33 #include "debug.H"
34 #include "typeInfo.H"
35 #include "globalMeshData.H"
36 
37 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
38 
39 template<class Type, class TrackingData>
41 
42 template<class Type, class TrackingData>
44 
45 
46 namespace Foam
47 {
48  //- Reduction class. If x and y are not equal assign value.
49  template<class Type, class TrackingData>
51  {
52  TrackingData& td_;
53 
54  public:
55  combineEqOp(TrackingData& td)
56  :
57  td_(td)
58  {}
59 
60  void operator()(Type& x, const Type& y) const
61  {
62  if (!x.valid(td_) && y.valid(td_))
63  {
64  x = y;
65  }
66  }
67  };
68 }
69 
70 
71 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
72 
73 template<class Type, class TrackingData>
75 (
76  const polyPatch& patch,
77  const labelList& patchPointLabels,
78  const transformer& transform,
79  List<Type>& pointInfo
80 ) const
81 {
82  forAll(pointInfo, i)
83  {
84  pointInfo[i].transform(patch, patchPointLabels[i], transform, td_);
85  }
86 }
87 
88 
89 template<class Type, class TrackingData>
91 (
92  const label pointi,
93  const label neighbourEdgeI,
94  const Type& neighbourInfo,
95  Type& pointInfo
96 )
97 {
98  // Update info for pointi, at position pt, with information from
99  // neighbouring edge.
100  // Updates:
101  // - changedPoint_, changedPoints_, nChangedPoints_,
102  // - statistics: nEvals_, nUnvisitedPoints_
103 
104  nEvals_++;
105 
106  bool wasValid = pointInfo.valid(td_);
107 
108  bool propagate =
109  pointInfo.updatePoint
110  (
111  mesh_,
112  pointi,
113  neighbourEdgeI,
114  neighbourInfo,
115  propagationTol_,
116  td_
117  );
118 
119  if (propagate)
120  {
121  if (!changedPoint_[pointi])
122  {
123  changedPoint_[pointi] = true;
124  changedPoints_[nChangedPoints_++] = pointi;
125  }
126  }
127 
128  if (!wasValid && pointInfo.valid(td_))
129  {
130  --nUnvisitedPoints_;
131  }
132 
133  return propagate;
134 }
135 
136 
137 template<class Type, class TrackingData>
139 (
140  const label pointi,
141  const Type& neighbourInfo,
142  Type& pointInfo
143 )
144 {
145  // Update info for pointi, at position pt, with information from
146  // same point.
147  // Updates:
148  // - changedPoint_, changedPoints_, nChangedPoints_,
149  // - statistics: nEvals_, nUnvisitedPoints_
150 
151  nEvals_++;
152 
153  bool wasValid = pointInfo.valid(td_);
154 
155  bool propagate =
156  pointInfo.updatePoint
157  (
158  mesh_,
159  pointi,
160  neighbourInfo,
161  propagationTol_,
162  td_
163  );
164 
165  if (propagate)
166  {
167  if (!changedPoint_[pointi])
168  {
169  changedPoint_[pointi] = true;
170  changedPoints_[nChangedPoints_++] = pointi;
171  }
172  }
173 
174  if (!wasValid && pointInfo.valid(td_))
175  {
176  --nUnvisitedPoints_;
177  }
178 
179  return propagate;
180 }
181 
182 
183 template<class Type, class TrackingData>
185 (
186  const label edgeI,
187  const label neighbourPointi,
188  const Type& neighbourInfo,
189  Type& edgeInfo
190 )
191 {
192  // Update info for edgeI, at position pt, with information from
193  // neighbouring point.
194  // Updates:
195  // - changedEdge_, changedEdges_, nChangedEdges_,
196  // - statistics: nEvals_, nUnvisitedEdge_
197 
198  nEvals_++;
199 
200  bool wasValid = edgeInfo.valid(td_);
201 
202  bool propagate =
203  edgeInfo.updateEdge
204  (
205  mesh_,
206  edgeI,
207  neighbourPointi,
208  neighbourInfo,
209  propagationTol_,
210  td_
211  );
212 
213  if (propagate)
214  {
215  if (!changedEdge_[edgeI])
216  {
217  changedEdge_[edgeI] = true;
218  changedEdges_[nChangedEdges_++] = edgeI;
219  }
220  }
221 
222  if (!wasValid && edgeInfo.valid(td_))
223  {
224  --nUnvisitedEdges_;
225  }
226 
227  return propagate;
228 }
229 
230 
231 template<class Type, class TrackingData>
232 template<class PatchType>
234 {
235  label nPatches = 0;
236 
237  forAll(mesh_.boundary(), patchi)
238  {
239  if (isA<PatchType>(mesh_.boundary()[patchi]))
240  {
241  nPatches++;
242  }
243  }
244  return nPatches;
245 }
246 
247 
248 template<class Type, class TrackingData>
250 {
251  // 1. Send all point info on processor patches.
252 
253  PstreamBuffers pBufs(Pstream::commsTypes::nonBlocking);
254 
255  DynamicList<Type> patchInfo;
256  DynamicList<label> thisPoints;
257  DynamicList<label> nbrPoints;
258 
259  forAll(mesh_.globalData().processorPatches(), i)
260  {
261  label patchi = mesh_.globalData().processorPatches()[i];
262  const processorPolyPatch& procPatch =
263  refCast<const processorPolyPatch>(mesh_.boundary()[patchi]);
264 
265  patchInfo.clear();
266  patchInfo.reserve(procPatch.nPoints());
267  thisPoints.clear();
268  thisPoints.reserve(procPatch.nPoints());
269  nbrPoints.clear();
270  nbrPoints.reserve(procPatch.nPoints());
271 
272  // Get all changed points in reverse order
273  const labelList& neighbPoints = procPatch.nbrPoints();
274  forAll(neighbPoints, thisPointi)
275  {
276  label meshPointi = procPatch.meshPoints()[thisPointi];
277  if (changedPoint_[meshPointi])
278  {
279  patchInfo.append(allPointInfo_[meshPointi]);
280  thisPoints.append(thisPointi);
281  nbrPoints.append(neighbPoints[thisPointi]);
282  }
283  }
284 
285  // if (debug)
286  //{
287  // Pout<< "Processor patch " << patchi << ' ' << procPatch.name()
288  // << " communicating with " << procPatch.neighbProcNo()
289  // << " Sending:" << patchInfo.size() << endl;
290  //}
291 
292  UOPstream toNeighbour(procPatch.neighbProcNo(), pBufs);
293  toNeighbour << nbrPoints << patchInfo;
294  }
295 
296 
297  pBufs.finishedSends();
298 
299  //
300  // 2. Receive all point info on processor patches.
301  //
302 
303  forAll(mesh_.globalData().processorPatches(), i)
304  {
305  label patchi = mesh_.globalData().processorPatches()[i];
306  const processorPolyPatch& procPatch =
307  refCast<const processorPolyPatch>(mesh_.boundary()[patchi]);
308 
309  List<Type> patchInfo;
310  labelList patchPoints;
311 
312  {
313  UIPstream fromNeighbour(procPatch.neighbProcNo(), pBufs);
314  fromNeighbour >> patchPoints >> patchInfo;
315  }
316 
317  // if (debug)
318  //{
319  // Pout<< "Processor patch " << patchi << ' ' << procPatch.name()
320  // << " communicating with " << procPatch.neighbProcNo()
321  // << " Received:" << patchInfo.size() << endl;
322  //}
323 
324  // Transform info across the interface
325  transform(procPatch, patchPoints, procPatch.transform(), patchInfo);
326 
327  // Merge received info
328  const labelList& meshPoints = procPatch.meshPoints();
329  forAll(patchInfo, i)
330  {
331  label meshPointi = meshPoints[patchPoints[i]];
332 
333  if (!allPointInfo_[meshPointi].equal(patchInfo[i], td_))
334  {
335  updatePoint
336  (
337  meshPointi,
338  patchInfo[i],
339  allPointInfo_[meshPointi]
340  );
341  }
342  }
343  }
344 
345  // Collocated points should be handled by face based transfer
346  // (since that is how connectivity is worked out)
347  // They are also explicitly equalised in handleCollocatedPoints to
348  // guarantee identical values.
349 }
350 
351 
352 template<class Type, class TrackingData>
354 {
355  // 1. Send all point info on cyclic patches.
356 
357  DynamicList<Type> nbrInfo;
358  DynamicList<label> nbrPoints;
359  DynamicList<label> thisPoints;
360 
361  forAll(mesh_.boundary(), patchi)
362  {
363  const polyPatch& patch = mesh_.boundary()[patchi];
364 
365  if (isA<cyclicPolyPatch>(patch))
366  {
367  const cyclicPolyPatch& cycPatch =
368  refCast<const cyclicPolyPatch>(patch);
369 
370  nbrInfo.clear();
371  nbrInfo.reserve(cycPatch.nPoints());
372  nbrPoints.clear();
373  nbrPoints.reserve(cycPatch.nPoints());
374  thisPoints.clear();
375  thisPoints.reserve(cycPatch.nPoints());
376 
377  // Collect nbrPatch points that have changed
378  {
379  const cyclicPolyPatch& nbrPatch = cycPatch.nbrPatch();
380  const edgeList& pairs = cycPatch.coupledPoints();
381  const labelList& meshPoints = nbrPatch.meshPoints();
382 
383  forAll(pairs, pairI)
384  {
385  label thisPointi = pairs[pairI][0];
386  label nbrPointi = pairs[pairI][1];
387  label meshPointi = meshPoints[nbrPointi];
388 
389  if (changedPoint_[meshPointi])
390  {
391  nbrInfo.append(allPointInfo_[meshPointi]);
392  nbrPoints.append(nbrPointi);
393  thisPoints.append(thisPointi);
394  }
395  }
396  }
397 
398  // if (debug)
399  //{
400  // Pout<< "Cyclic patch " << patchi << ' ' << patch.name()
401  // << " Changed : " << nbrInfo.size()
402  // << endl;
403  //}
404 
405  // Transform info across the interface
406  transform(cycPatch, thisPoints, cycPatch.transform(), nbrInfo);
407 
408  // Merge received info
409  const labelList& meshPoints = cycPatch.meshPoints();
410  forAll(nbrInfo, i)
411  {
412  label meshPointi = meshPoints[thisPoints[i]];
413 
414  if (!allPointInfo_[meshPointi].equal(nbrInfo[i], td_))
415  {
416  updatePoint
417  (
418  meshPointi,
419  nbrInfo[i],
420  allPointInfo_[meshPointi]
421  );
422  }
423  }
424  }
425  }
426 }
427 
428 
429 template<class Type, class TrackingData>
431 {
432  // Transfer onto coupled patch
433  const globalMeshData& gmd = mesh_.globalData();
434  const indirectPrimitivePatch& cpp = gmd.coupledPatch();
435  const labelList& meshPoints = cpp.meshPoints();
436 
437  const distributionMap& slavesMap = gmd.globalPointSlavesMap();
438  const labelListList& slaves = gmd.globalPointSlaves();
439 
440  List<Type> elems(slavesMap.constructSize());
441  forAll(meshPoints, pointi)
442  {
443  elems[pointi] = allPointInfo_[meshPoints[pointi]];
444  }
445 
446  // Pull slave data onto master (which might or might not have any
447  // initialised points). No need to update transformed slots.
448  slavesMap.distribute(elems, false);
449 
450  // Combine master data with slave data
451  combineEqOp<Type, TrackingData> cop(td_);
452 
453  forAll(slaves, pointi)
454  {
455  Type& elem = elems[pointi];
456 
457  const labelList& slavePoints = slaves[pointi];
458 
459  // Combine master with untransformed slave data
460  forAll(slavePoints, j)
461  {
462  cop(elem, elems[slavePoints[j]]);
463  }
464 
465  // Copy result back to slave slots
466  forAll(slavePoints, j)
467  {
468  elems[slavePoints[j]] = elem;
469  }
470  }
471 
472  // Push slave-slot data back to slaves
473  slavesMap.reverseDistribute(elems.size(), elems, false);
474 
475  // Extract back onto mesh
476  forAll(meshPoints, pointi)
477  {
478  if (elems[pointi].valid(td_))
479  {
480  label meshPointi = meshPoints[pointi];
481 
482  Type& elem = allPointInfo_[meshPointi];
483 
484  bool wasValid = elem.valid(td_);
485 
486  // Like updatePoint but bypass Type::updatePoint with its tolerance
487  // checking
488  // if (!elem.valid(td_) || !elem.equal(elems[pointi], td_))
489  if (!elem.equal(elems[pointi], td_))
490  {
491  nEvals_++;
492  elem = elems[pointi];
493 
494  // See if element now valid
495  if (!wasValid && elem.valid(td_))
496  {
497  --nUnvisitedPoints_;
498  }
499 
500  // Update database of changed points
501  if (!changedPoint_[meshPointi])
502  {
503  changedPoint_[meshPointi] = true;
504  changedPoints_[nChangedPoints_++] = meshPointi;
505  }
506  }
507  }
508  }
509 
510  // Sum nChangedPoints over all procs
511  label totNChanged = nChangedPoints_;
512 
513  reduce(totNChanged, sumOp<label>());
514 
515  return totNChanged;
516 }
517 
518 
519 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
520 
521 template<class Type, class TrackingData>
523 (
524  const polyMesh& mesh,
525  const labelList& startPoints,
526  const List<Type>& startPointsInfo,
527 
528  UList<Type>& allPointInfo,
529  UList<Type>& allEdgeInfo,
530 
531  const label maxIter,
532  TrackingData& td
533 )
534 :
535  mesh_(mesh),
536  allPointInfo_(allPointInfo),
537  allEdgeInfo_(allEdgeInfo),
538  td_(td),
539  changedPoint_(mesh_.nPoints(), false),
540  changedPoints_(mesh_.nPoints()),
541  nChangedPoints_(0),
542  changedEdge_(mesh_.nEdges(), false),
543  changedEdges_(mesh_.nEdges()),
544  nChangedEdges_(0),
545  nCyclicPatches_(countPatchType<cyclicPolyPatch>()),
546  nEvals_(0),
547  nUnvisitedPoints_(mesh_.nPoints()),
548  nUnvisitedEdges_(mesh_.nEdges())
549 {
550  if (allPointInfo_.size() != mesh_.nPoints())
551  {
553  << "size of pointInfo work array is not equal to the number"
554  << " of points in the mesh" << endl
555  << " pointInfo :" << allPointInfo_.size() << endl
556  << " mesh.nPoints:" << mesh_.nPoints()
557  << exit(FatalError);
558  }
559  if (allEdgeInfo_.size() != mesh_.nEdges())
560  {
562  << "size of edgeInfo work array is not equal to the number"
563  << " of edges in the mesh" << endl
564  << " edgeInfo :" << allEdgeInfo_.size() << endl
565  << " mesh.nEdges:" << mesh_.nEdges()
566  << exit(FatalError);
567  }
568 
569 
570  // Set from initial changed points data
571  setPointInfo(startPoints, startPointsInfo);
572 
573  if (debug)
574  {
575  Info<< typeName << ": Seed points : "
576  << returnReduce(nChangedPoints_, sumOp<label>()) << endl;
577  }
578 
579  // Iterate until nothing changes
580  label iter = iterate(maxIter);
581 
582  if ((maxIter > 0) && (iter >= maxIter))
583  {
585  << "Maximum number of iterations reached. Increase maxIter." << endl
586  << " maxIter:" << maxIter << endl
587  << " nChangedPoints:" << nChangedPoints_ << endl
588  << " nChangedEdges:" << nChangedEdges_ << endl
589  << exit(FatalError);
590  }
591 }
592 
593 
594 template<class Type, class TrackingData>
596 (
597  const polyMesh& mesh,
598  UList<Type>& allPointInfo,
599  UList<Type>& allEdgeInfo,
600  TrackingData& td
601 )
602 :
603  mesh_(mesh),
604  allPointInfo_(allPointInfo),
605  allEdgeInfo_(allEdgeInfo),
606  td_(td),
607  changedPoint_(mesh_.nPoints(), false),
608  changedPoints_(mesh_.nPoints()),
609  nChangedPoints_(0),
610  changedEdge_(mesh_.nEdges(), false),
611  changedEdges_(mesh_.nEdges()),
612  nChangedEdges_(0),
613  nCyclicPatches_(countPatchType<cyclicPolyPatch>()),
614  nEvals_(0),
615  nUnvisitedPoints_(mesh_.nPoints()),
616  nUnvisitedEdges_(mesh_.nEdges())
617 {}
618 
619 
620 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
621 
622 template<class Type, class TrackingData>
624 {}
625 
626 
627 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
628 
629 
630 template<class Type, class TrackingData>
632 {
633  return nUnvisitedPoints_;
634 }
635 
636 
637 template<class Type, class TrackingData>
639 {
640  return nUnvisitedEdges_;
641 }
642 
643 
644 // Copy point information into member data
645 template<class Type, class TrackingData>
647 (
648  const labelList& startPoints,
649  const List<Type>& startPointsInfo
650 )
651 {
652  forAll(startPoints, startPointi)
653  {
654  label pointi = startPoints[startPointi];
655 
656  bool wasValid = allPointInfo_[pointi].valid(td_);
657 
658  // Copy info for pointi
659  allPointInfo_[pointi] = startPointsInfo[startPointi];
660 
661  // Maintain count of unset points
662  if (!wasValid && allPointInfo_[pointi].valid(td_))
663  {
664  --nUnvisitedPoints_;
665  }
666 
667  // Mark pointi as changed, both on list and on point itself.
668 
669  if (!changedPoint_[pointi])
670  {
671  changedPoint_[pointi] = true;
672  changedPoints_[nChangedPoints_++] = pointi;
673  }
674  }
675 
676  // Sync
677  handleCollocatedPoints();
678 }
679 
680 
681 template<class Type, class TrackingData>
683 {
684  for
685  (
686  label changedEdgeI = 0;
687  changedEdgeI < nChangedEdges_;
688  changedEdgeI++
689  )
690  {
691  label edgeI = changedEdges_[changedEdgeI];
692 
693  if (!changedEdge_[edgeI])
694  {
696  << "edge " << edgeI
697  << " not marked as having been changed" << nl
698  << "This might be caused by multiple occurrences of the same"
699  << " seed point." << abort(FatalError);
700  }
701 
702 
703  const Type& neighbourWallInfo = allEdgeInfo_[edgeI];
704 
705  // Evaluate all connected points (= edge endpoints)
706  const edge& e = mesh_.edges()[edgeI];
707 
708  forAll(e, eI)
709  {
710  Type& currentWallInfo = allPointInfo_[e[eI]];
711 
712  if (!currentWallInfo.equal(neighbourWallInfo, td_))
713  {
714  updatePoint
715  (
716  e[eI],
717  edgeI,
718  neighbourWallInfo,
719  currentWallInfo
720  );
721  }
722  }
723 
724  // Reset status of edge
725  changedEdge_[edgeI] = false;
726  }
727 
728  // Handled all changed edges by now
729  nChangedEdges_ = 0;
730 
731  if (nCyclicPatches_ > 0)
732  {
733  // Transfer changed points across cyclic halves
734  handleCyclicPatches();
735  }
736  if (Pstream::parRun())
737  {
738  // Transfer changed points from neighbouring processors.
739  handleProcPatches();
740  }
741 
742  // Sum nChangedPoints over all procs
743  label totNChanged = nChangedPoints_;
744 
745  reduce(totNChanged, sumOp<label>());
746 
747  return totNChanged;
748 }
749 
750 
751 template<class Type, class TrackingData>
753 {
754  const labelListList& pointEdges = mesh_.pointEdges();
755 
756  for
757  (
758  label changedPointi = 0;
759  changedPointi < nChangedPoints_;
760  changedPointi++
761  )
762  {
763  label pointi = changedPoints_[changedPointi];
764 
765  if (!changedPoint_[pointi])
766  {
768  << "Point " << pointi
769  << " not marked as having been changed" << nl
770  << "This might be caused by multiple occurrences of the same"
771  << " seed point." << abort(FatalError);
772  }
773 
774  const Type& neighbourWallInfo = allPointInfo_[pointi];
775 
776  // Evaluate all connected edges
777 
778  const labelList& edgeLabels = pointEdges[pointi];
779  forAll(edgeLabels, edgeLabelI)
780  {
781  label edgeI = edgeLabels[edgeLabelI];
782 
783  Type& currentWallInfo = allEdgeInfo_[edgeI];
784 
785  if (!currentWallInfo.equal(neighbourWallInfo, td_))
786  {
787  updateEdge
788  (
789  edgeI,
790  pointi,
791  neighbourWallInfo,
792  currentWallInfo
793  );
794  }
795  }
796 
797  // Reset status of point
798  changedPoint_[pointi] = false;
799  }
800 
801  // Handled all changed points by now
802  nChangedPoints_ = 0;
803 
804  // if (debug)
805  //{
806  // Pout<< "Changed edges : " << nChangedEdges_ << endl;
807  //}
808 
809  // Sum nChangedPoints over all procs
810  label totNChanged = nChangedEdges_;
811 
812  reduce(totNChanged, sumOp<label>());
813 
814  return totNChanged;
815 }
816 
817 
818 template<class Type, class TrackingData>
820 (
821  const label maxIter
822 )
823 {
824  if (nCyclicPatches_ > 0)
825  {
826  // Transfer changed points across cyclic halves
827  handleCyclicPatches();
828  }
829  if (Pstream::parRun())
830  {
831  // Transfer changed points from neighbouring processors.
832  handleProcPatches();
833  }
834 
835  nEvals_ = 0;
836 
837  label iter = 0;
838 
839  while (iter < maxIter)
840  {
841  while (iter < maxIter)
842  {
843  if (debug)
844  {
845  Info<< typeName << ": Iteration " << iter << endl;
846  }
847 
848  label nEdges = pointToEdge();
849 
850  if (debug)
851  {
852  Info<< typeName << ": Total changed edges : "
853  << nEdges << endl;
854  }
855 
856  if (nEdges == 0)
857  {
858  break;
859  }
860 
861  label nPoints = edgeToPoint();
862 
863  if (debug)
864  {
865  Info<< typeName << ": Total changed points : "
866  << nPoints << nl
867  << typeName << ": Total evaluations : "
868  << returnReduce(nEvals_, sumOp<label>()) << nl
869  << typeName << ": Remaining unvisited points: "
870  << returnReduce(nUnvisitedPoints_, sumOp<label>()) << nl
871  << typeName << ": Remaining unvisited edges : "
872  << returnReduce(nUnvisitedEdges_, sumOp<label>()) << nl
873  << endl;
874  }
875 
876  if (nPoints == 0)
877  {
878  break;
879  }
880 
881  iter++;
882  }
883 
884 
885  // Enforce collocated points are exactly equal. This might still mean
886  // non-collocated points are not equal though. WIP.
887  label nPoints = handleCollocatedPoints();
888  if (debug)
889  {
890  Info<< typeName << ": Collocated point sync : "
891  << nPoints << nl << endl;
892  }
893 
894  if (nPoints == 0)
895  {
896  break;
897  }
898  }
899 
900  return iter;
901 }
902 
903 
904 // ************************************************************************* //
scalar y
Combination-Reduction operation for a parallel run. The information from all nodes is collected on th...
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:449
void reserve(const label)
Reserve allocation space for at least this size.
Definition: DynamicListI.H:152
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
Definition: DynamicListI.H:296
void clear()
Clear the addressed list, i.e. set the size to zero.
Definition: DynamicListI.H:236
Wave propagation of information through grid. Every iteration information goes through one layer of e...
Definition: PointEdgeWave.H:89
label getUnsetPoints() const
void setPointInfo(const labelList &startPoints, const List< Type > &startPointsInfo)
Copy start data into allPointInfo_.
PointEdgeWave(const polyMesh &mesh, const labelList &startPoints, const List< Type > &startPointsInfo, UList< Type > &allPointInfo, UList< Type > &allEdgeInfo, const label maxIter, TrackingData &td=defaultTrackingData_)
Construct from mesh, list of changed points with the Type.
label iterate(const label maxIter)
Iterate until no changes or maxIter reached. Returns actual.
label pointToEdge()
Propagate from point to edge. Returns total number of edges.
label edgeToPoint()
Propagate from edge to point. Returns total number of points.
label getUnsetEdges() const
Get number of unvisited edges, i.e. edges that were not (yet)
~PointEdgeWave()
Destructor.
label nPoints() const
Return number of points supporting patch faces.
const labelList & meshPoints() const
Return labelList of mesh points in patch. They are constructed.
Buffers for inter-processor communications streams (UOPstream, UIPstream).
label size() const
Return the number of elements in the UList.
Definition: UListI.H:311
static bool & parRun()
Is this a parallel run?
Definition: UPstream.H:399
Reduction class. If x and y are not equal assign value.
Definition: PointEdgeWave.C:51
combineEqOp(TrackingData &td)
Definition: PointEdgeWave.C:55
void operator()(Type &x, const Type &y) const
Definition: PointEdgeWave.C:60
Cyclic plane patch.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
Definition: edge.H:61
Motion of the mesh specified as a list of pointMeshMovers.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:78
label nPoints() const
label nEdges() const
Neighbour processor patch.
int neighbProcNo() const
Return neighbour processor number.
const labelList & nbrPoints() const
Return neighbour point labels. WIP.
Template function which returns the un-mangled name of a given type. Useful for types which do not ha...
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:334
label patchi
label nPoints
bool valid(const PtrList< ModelType > &l)
Namespace for OpenFOAM.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
bool equal(const T &s1, const T &s2)
Definition: doubleFloat.H:62
const doubleScalar e
Definition: doubleScalar.H:106
List< label > labelList
A List of labels.
Definition: labelList.H:56
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:288
void transform(GeometricField< Type, GeoMesh > &rtf, const GeometricField< tensor, GeoMesh > &trf, const GeometricField< Type, GeoMesh > &tf)
errorManip< error > abort(error &err)
Definition: errorManip.H:131
messageStream Info
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
List< labelList > labelListList
A List of labelList.
Definition: labelList.H:57
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
error FatalError
List< edge > edgeList
Definition: edgeList.H:38
PrimitivePatch< IndirectList< face >, const pointField & > indirectPrimitivePatch
Foam::indirectPrimitivePatch.
static const char nl
Definition: Ostream.H:297
label nPatches
Definition: readKivaGrid.H:396
Basic run-time type information using word as the type's name. Used to enhance the standard RTTI to c...