40 template<
class Type,
class TrackingData>
43 template<
class Type,
class TrackingData>
50 template<
class Type,
class TrackingData>
63 if (!x.valid(td_) && y.valid(td_))
75 template<
class Type,
class TrackingData>
86 pointInfo[i].transform(patch, patchPointLabels[i], transform, td_);
96 template<
class Type,
class TrackingData>
100 const label neighbourEdgeI,
101 const Type& neighbourInfo,
107 bool wasValid = pointInfo.valid(td_);
110 pointInfo.updatePoint
122 if (!changedPoint_[pointi])
124 changedPoint_[pointi] =
true;
125 changedPoints_[nChangedPoints_++] = pointi;
129 if (!wasValid && pointInfo.valid(td_))
143 template<
class Type,
class TrackingData>
147 const Type& neighbourInfo,
153 bool wasValid = pointInfo.valid(td_);
156 pointInfo.updatePoint
167 if (!changedPoint_[pointi])
169 changedPoint_[pointi] =
true;
170 changedPoints_[nChangedPoints_++] = pointi;
174 if (!wasValid && pointInfo.valid(td_))
188 template<
class Type,
class TrackingData>
192 const label neighbourPointi,
193 const Type& neighbourInfo,
199 bool wasValid = edgeInfo.valid(td_);
214 if (!changedEdge_[edgeI])
216 changedEdge_[edgeI] =
true;
217 changedEdges_[nChangedEdges_++] = edgeI;
221 if (!wasValid && edgeInfo.valid(td_))
231 template<
class Type,
class TrackingData>
232 template<
class PatchType>
239 if (isA<PatchType>(mesh_.boundaryMesh()[
patchi]))
249 template<
class Type,
class TrackingData>
260 forAll(mesh_.globalData().processorPatches(), i)
262 label patchi = mesh_.globalData().processorPatches()[i];
264 refCast<const processorPolyPatch>(mesh_.boundaryMesh()[
patchi]);
275 forAll(neighbPoints, thisPointi)
278 if (changedPoint_[meshPointi])
280 patchInfo.
append(allPointInfo_[meshPointi]);
281 thisPoints.
append(thisPointi);
282 nbrPoints.
append(neighbPoints[thisPointi]);
294 toNeighbour << nbrPoints << patchInfo;
304 forAll(mesh_.globalData().processorPatches(), i)
306 label patchi = mesh_.globalData().processorPatches()[i];
308 refCast<const processorPolyPatch>(mesh_.boundaryMesh()[
patchi]);
315 fromNeighbour >> patchPoints >> patchInfo;
332 label meshPointi = meshPoints[patchPoints[i]];
334 if (!allPointInfo_[meshPointi].
equal(patchInfo[i], td_))
340 allPointInfo_[meshPointi]
353 template<
class Type,
class TrackingData>
366 if (isA<cyclicPolyPatch>(patch))
369 refCast<const cyclicPolyPatch>(patch);
386 label thisPointi = pairs[pairI][0];
387 label nbrPointi = pairs[pairI][1];
388 label meshPointi = meshPoints[nbrPointi];
390 if (changedPoint_[meshPointi])
392 nbrInfo.
append(allPointInfo_[meshPointi]);
393 nbrPoints.
append(nbrPointi);
394 thisPoints.
append(thisPointi);
413 label meshPointi = meshPoints[thisPoints[i]];
415 if (!allPointInfo_[meshPointi].
equal(nbrInfo[i], td_))
421 allPointInfo_[meshPointi]
432 template<
class Type,
class TrackingData>
444 forAll(meshPoints, pointi)
446 elems[pointi] = allPointInfo_[meshPoints[pointi]];
458 Type& elem = elems[pointi];
460 const labelList& slavePoints = slaves[pointi];
465 cop(elem, elems[slavePoints[j]]);
471 elems[slavePoints[j]] = elem;
479 forAll(meshPoints, pointi)
481 if (elems[pointi].valid(td_))
483 label meshPointi = meshPoints[pointi];
485 Type& elem = allPointInfo_[meshPointi];
487 bool wasValid = elem.valid(td_);
492 if (!elem.equal(elems[pointi], td_))
495 elem = elems[pointi];
498 if (!wasValid && elem.valid(td_))
504 if (!changedPoint_[meshPointi])
506 changedPoint_[meshPointi] =
true;
507 changedPoints_[nChangedPoints_++] = meshPointi;
514 label totNChanged = nChangedPoints_;
526 template<
class Type,
class TrackingData>
541 allPointInfo_(allPointInfo),
542 allEdgeInfo_(allEdgeInfo),
544 changedPoint_(mesh_.nPoints(),
false),
545 changedPoints_(mesh_.nPoints()),
547 changedEdge_(mesh_.nEdges(),
false),
548 changedEdges_(mesh_.nEdges()),
550 nCyclicPatches_(countPatchType<cyclicPolyPatch>()),
552 nUnvisitedPoints_(mesh_.nPoints()),
553 nUnvisitedEdges_(mesh_.nEdges())
555 if (allPointInfo_.size() != mesh_.nPoints())
558 <<
"size of pointInfo work array is not equal to the number" 559 <<
" of points in the mesh" <<
endl 560 <<
" pointInfo :" << allPointInfo_.size() <<
endl 561 <<
" mesh.nPoints:" << mesh_.nPoints()
564 if (allEdgeInfo_.size() != mesh_.nEdges())
567 <<
"size of edgeInfo work array is not equal to the number" 568 <<
" of edges in the mesh" <<
endl 569 <<
" edgeInfo :" << allEdgeInfo_.size() <<
endl 570 <<
" mesh.nEdges:" << mesh_.nEdges()
576 setPointInfo(changedPoints, changedPointsInfo);
580 Info<< typeName <<
": Seed points : " 585 label iter = iterate(maxIter);
587 if ((maxIter > 0) && (iter >= maxIter))
590 <<
"Maximum number of iterations reached. Increase maxIter." <<
endl 591 <<
" maxIter:" << maxIter <<
endl 592 <<
" nChangedPoints:" << nChangedPoints_ <<
endl 593 <<
" nChangedEdges:" << nChangedEdges_ <<
endl 599 template<
class Type,
class TrackingData>
609 allPointInfo_(allPointInfo),
610 allEdgeInfo_(allEdgeInfo),
612 changedPoint_(mesh_.nPoints(),
false),
613 changedPoints_(mesh_.nPoints()),
615 changedEdge_(mesh_.nEdges(),
false),
616 changedEdges_(mesh_.nEdges()),
618 nCyclicPatches_(countPatchType<cyclicPolyPatch>()),
620 nUnvisitedPoints_(mesh_.nPoints()),
621 nUnvisitedEdges_(mesh_.nEdges())
627 template<
class Type,
class TrackingData>
635 template<
class Type,
class TrackingData>
638 return nUnvisitedPoints_;
642 template<
class Type,
class TrackingData>
645 return nUnvisitedEdges_;
650 template<
class Type,
class TrackingData>
657 forAll(changedPoints, changedPointi)
659 label pointi = changedPoints[changedPointi];
661 bool wasValid = allPointInfo_[pointi].valid(td_);
664 allPointInfo_[pointi] = changedPointsInfo[changedPointi];
667 if (!wasValid && allPointInfo_[pointi].valid(td_))
674 if (!changedPoint_[pointi])
676 changedPoint_[pointi] =
true;
677 changedPoints_[nChangedPoints_++] = pointi;
682 handleCollocatedPoints();
687 template<
class Type,
class TrackingData>
692 label changedEdgeI = 0;
693 changedEdgeI < nChangedEdges_;
697 label edgeI = changedEdges_[changedEdgeI];
699 if (!changedEdge_[edgeI])
703 <<
" not marked as having been changed" <<
nl 704 <<
"This might be caused by multiple occurrences of the same" 709 const Type& neighbourWallInfo = allEdgeInfo_[edgeI];
712 const edge&
e = mesh_.edges()[edgeI];
716 Type& currentWallInfo = allPointInfo_[e[eI]];
718 if (!currentWallInfo.equal(neighbourWallInfo, td_))
731 changedEdge_[edgeI] =
false;
737 if (nCyclicPatches_ > 0)
740 handleCyclicPatches();
754 label totNChanged = nChangedPoints_;
763 template<
class Type,
class TrackingData>
770 label changedPointi = 0;
771 changedPointi < nChangedPoints_;
775 label pointi = changedPoints_[changedPointi];
777 if (!changedPoint_[pointi])
780 <<
"Point " << pointi
781 <<
" not marked as having been changed" <<
nl 782 <<
"This might be caused by multiple occurrences of the same" 786 const Type& neighbourWallInfo = allPointInfo_[pointi];
790 const labelList& edgeLabels = pointEdges[pointi];
791 forAll(edgeLabels, edgeLabelI)
793 label edgeI = edgeLabels[edgeLabelI];
795 Type& currentWallInfo = allEdgeInfo_[edgeI];
797 if (!currentWallInfo.equal(neighbourWallInfo, td_))
810 changedPoint_[pointi] =
false;
822 label totNChanged = nChangedEdges_;
831 template<
class Type,
class TrackingData>
837 if (nCyclicPatches_ > 0)
840 handleCyclicPatches();
852 while (iter < maxIter)
854 while (iter < maxIter)
858 Info<< typeName <<
": Iteration " << iter <<
endl;
861 label nEdges = pointToEdge();
865 Info<< typeName <<
": Total changed edges : " 878 Info<< typeName <<
": Total changed points : " 880 << typeName <<
": Total evaluations : " 882 << typeName <<
": Remaining unvisited points: " 884 << typeName <<
": Remaining unvisited edges : " 903 Info<< typeName <<
": Collocated point sync : "
label nPoints() const
Return number of points supporting patch faces.
const labelListList & globalPointSlaves() const
Reduction class. If x and y are not equal assign value.
#define forAll(list, i)
Loop across all elements in list.
const labelList & nbrPoints() const
Return neighbour point labels. WIP.
void finishedSends(const bool block=true)
Mark all sends as having been done. This will start receives.
errorManipArg< error, int > exit(error &err, const int errNo=1)
const edgeList & coupledPoints() const
Return connected points (from patch local to neighbour patch local)
void reverseDistribute(const label constructSize, List< T > &, const bool dummyTransform=true, const int tag=UPstream::msgType()) const
Reverse distribute data using default commsType.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
label pointToEdge()
Propagate from point to edge. Returns total number of edges.
Various mesh related information for a parallel run. Upon construction, constructs all info using par...
const polyBoundaryMesh & boundaryMesh() const
Return boundaryMesh reference.
label iterate(const label maxIter)
Iterate until no changes or maxIter reached. Returns actual.
Ostream & endl(Ostream &os)
Add newline and flush stream.
label edgeToPoint()
Propagate from edge to point. Returns total number of points.
virtual const transformer & transform() const
Return transformation between the coupled patches.
~PointEdgeWave()
Destructor.
void setPointInfo(const labelList &changedPoints, const List< Type > &changedPointsInfo)
Copy initial data into allPointInfo_.
const cyclicPolyPatch & nbrPatch() const
combineEqOp(TrackingData &td)
void distribute(List< T > &fld, const bool dummyTransform=true, const int tag=UPstream::msgType()) const
Distribute data using default commsType.
Combination-Reduction operation for a parallel run. The information from all nodes is collected on th...
void reserve(const label)
Reserve allocation space for at least this size.
const labelList & meshPoints() const
Return labelList of mesh points in patch. They are constructed.
Neighbour processor patch.
Input inter-processor communications stream operating on external buffer.
A list of faces which address into the list of points.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
int neighbProcNo() const
Return neighbour processor number.
errorManip< error > abort(error &err)
label constructSize() const
Constructed data size.
Output inter-processor communications stream operating on external buffer.
PointEdgeWave(const polyMesh &mesh, const labelList &initialPoints, const List< Type > &initialPointsInfo, UList< Type > &allPointInfo, UList< Type > &allEdgeInfo, const label maxIter, TrackingData &td=defaultTrackingData_)
Construct from mesh, list of changed points with the Type.
void operator()(Type &x, const Type &y) const
Buffers for inter-processor communications streams (UOPstream, UIPstream).
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
const indirectPrimitivePatch & coupledPatch() const
Return patch of all coupled faces.
Class containing processor-to-processor mapping information.
virtual const transformer & transform() const
Return null transform between processor patches.
static bool & parRun()
Is this a parallel run?
bool equal(const T &s1, const T &s2)
const distributionMap & globalPointSlavesMap() const
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
const doubleScalar e
Elementary charge.
Mesh consisting of general polyhedral cells.
label getUnsetPoints() const
A patch is a list of labels that address the faces in the global face list.
void clear()
Clear the addressed list, i.e. set the size to zero.
Wave propagation of information through grid. Every iteration information goes through one layer of e...
label getUnsetEdges() const
Get number of unvisited edges, i.e. edges that were not (yet)
dimensionSet transform(const dimensionSet &)