40 template<
class Type,
class TrackingData>
43 template<
class Type,
class TrackingData>
49 template<
class Type,
class TrackingData>
62 if (!x.valid(td_) && y.valid(td_))
74 template<
class Type,
class TrackingData>
84 forAll(patchPointLabels, i)
86 label patchPointi = patchPointLabels[i];
88 const point& pt = patch.
points()[meshPoints[patchPointi]];
90 pointInfo[i].leaveDomain(patch, patchPointi, pt, td_);
96 template<
class Type,
class TrackingData>
106 forAll(patchPointLabels, i)
108 label patchPointi = patchPointLabels[i];
110 const point& pt = patch.
points()[meshPoints[patchPointi]];
112 pointInfo[i].enterDomain(patch, patchPointi, pt, td_);
118 template<
class Type,
class TrackingData>
128 pointInfo[i].transform(rotTensor, td_);
138 template<
class Type,
class TrackingData>
142 const label neighbourEdgeI,
143 const Type& neighbourInfo,
149 bool wasValid = pointInfo.valid(td_);
152 pointInfo.updatePoint
164 if (!changedPoint_[pointi])
166 changedPoint_[pointi] =
true;
167 changedPoints_[nChangedPoints_++] = pointi;
171 if (!wasValid && pointInfo.valid(td_))
185 template<
class Type,
class TrackingData>
189 const Type& neighbourInfo,
195 bool wasValid = pointInfo.valid(td_);
198 pointInfo.updatePoint
209 if (!changedPoint_[pointi])
211 changedPoint_[pointi] =
true;
212 changedPoints_[nChangedPoints_++] = pointi;
216 if (!wasValid && pointInfo.valid(td_))
230 template<
class Type,
class TrackingData>
234 const label neighbourPointi,
235 const Type& neighbourInfo,
241 bool wasValid = edgeInfo.valid(td_);
256 if (!changedEdge_[edgeI])
258 changedEdge_[edgeI] =
true;
259 changedEdges_[nChangedEdges_++] = edgeI;
263 if (!wasValid && edgeInfo.valid(td_))
273 template<
class Type,
class TrackingData>
274 template<
class PatchType>
281 if (isA<PatchType>(mesh_.boundaryMesh()[
patchi]))
291 template<
class Type,
class TrackingData>
302 forAll(mesh_.globalData().processorPatches(), i)
304 label patchi = mesh_.globalData().processorPatches()[i];
306 refCast<const processorPolyPatch>(mesh_.boundaryMesh()[
patchi]);
317 forAll(neighbPoints, thisPointi)
320 if (changedPoint_[meshPointi])
322 patchInfo.
append(allPointInfo_[meshPointi]);
323 thisPoints.
append(thisPointi);
324 nbrPoints.
append(neighbPoints[thisPointi]);
329 leaveDomain(procPatch, thisPoints, patchInfo);
339 toNeighbour << nbrPoints << patchInfo;
349 forAll(mesh_.globalData().processorPatches(), i)
351 label patchi = mesh_.globalData().processorPatches()[i];
353 refCast<const processorPolyPatch>(mesh_.boundaryMesh()[
patchi]);
360 fromNeighbour >> patchPoints >> patchInfo;
377 enterDomain(procPatch, patchPoints, patchInfo);
383 label meshPointi = meshPoints[patchPoints[i]];
385 if (!allPointInfo_[meshPointi].
equal(patchInfo[i], td_))
391 allPointInfo_[meshPointi]
404 template<
class Type,
class TrackingData>
417 if (isA<cyclicPolyPatch>(patch))
420 refCast<const cyclicPolyPatch>(patch);
437 label thisPointi = pairs[pairI][0];
438 label nbrPointi = pairs[pairI][1];
439 label meshPointi = meshPoints[nbrPointi];
441 if (changedPoint_[meshPointi])
443 nbrInfo.
append(allPointInfo_[meshPointi]);
444 nbrPoints.
append(nbrPointi);
445 thisPoints.
append(thisPointi);
450 leaveDomain(nbrPatch, nbrPoints, nbrInfo);
470 enterDomain(cycPatch, thisPoints, nbrInfo);
476 label meshPointi = meshPoints[thisPoints[i]];
478 if (!allPointInfo_[meshPointi].
equal(nbrInfo[i], td_))
484 allPointInfo_[meshPointi]
495 template<
class Type,
class TrackingData>
507 forAll(meshPoints, pointi)
509 elems[pointi] = allPointInfo_[meshPoints[pointi]];
521 Type& elem = elems[pointi];
523 const labelList& slavePoints = slaves[pointi];
528 cop(elem, elems[slavePoints[j]]);
534 elems[slavePoints[j]] = elem;
542 forAll(meshPoints, pointi)
544 if (elems[pointi].valid(td_))
546 label meshPointi = meshPoints[pointi];
548 Type& elem = allPointInfo_[meshPointi];
550 bool wasValid = elem.valid(td_);
555 if (!elem.equal(elems[pointi], td_))
558 elem = elems[pointi];
561 if (!wasValid && elem.valid(td_))
567 if (!changedPoint_[meshPointi])
569 changedPoint_[meshPointi] =
true;
570 changedPoints_[nChangedPoints_++] = meshPointi;
577 label totNChanged = nChangedPoints_;
589 template<
class Type,
class TrackingData>
604 allPointInfo_(allPointInfo),
605 allEdgeInfo_(allEdgeInfo),
607 changedPoint_(mesh_.nPoints(),
false),
608 changedPoints_(mesh_.nPoints()),
610 changedEdge_(mesh_.nEdges(),
false),
611 changedEdges_(mesh_.nEdges()),
613 nCyclicPatches_(countPatchType<cyclicPolyPatch>()),
615 nUnvisitedPoints_(mesh_.nPoints()),
616 nUnvisitedEdges_(mesh_.nEdges())
618 if (allPointInfo_.size() != mesh_.nPoints())
621 <<
"size of pointInfo work array is not equal to the number" 622 <<
" of points in the mesh" <<
endl 623 <<
" pointInfo :" << allPointInfo_.size() <<
endl 624 <<
" mesh.nPoints:" << mesh_.nPoints()
627 if (allEdgeInfo_.size() != mesh_.nEdges())
630 <<
"size of edgeInfo work array is not equal to the number" 631 <<
" of edges in the mesh" <<
endl 632 <<
" edgeInfo :" << allEdgeInfo_.size() <<
endl 633 <<
" mesh.nEdges:" << mesh_.nEdges()
639 setPointInfo(changedPoints, changedPointsInfo);
643 Info<< typeName <<
": Seed points : " 648 label iter = iterate(maxIter);
650 if ((maxIter > 0) && (iter >= maxIter))
653 <<
"Maximum number of iterations reached. Increase maxIter." <<
endl 654 <<
" maxIter:" << maxIter <<
endl 655 <<
" nChangedPoints:" << nChangedPoints_ <<
endl 656 <<
" nChangedEdges:" << nChangedEdges_ <<
endl 662 template<
class Type,
class TrackingData>
672 allPointInfo_(allPointInfo),
673 allEdgeInfo_(allEdgeInfo),
675 changedPoint_(mesh_.nPoints(),
false),
676 changedPoints_(mesh_.nPoints()),
678 changedEdge_(mesh_.nEdges(),
false),
679 changedEdges_(mesh_.nEdges()),
681 nCyclicPatches_(countPatchType<cyclicPolyPatch>()),
683 nUnvisitedPoints_(mesh_.nPoints()),
684 nUnvisitedEdges_(mesh_.nEdges())
690 template<
class Type,
class TrackingData>
698 template<
class Type,
class TrackingData>
701 return nUnvisitedPoints_;
705 template<
class Type,
class TrackingData>
708 return nUnvisitedEdges_;
713 template<
class Type,
class TrackingData>
720 forAll(changedPoints, changedPointi)
722 label pointi = changedPoints[changedPointi];
724 bool wasValid = allPointInfo_[pointi].valid(td_);
727 allPointInfo_[pointi] = changedPointsInfo[changedPointi];
730 if (!wasValid && allPointInfo_[pointi].valid(td_))
737 if (!changedPoint_[pointi])
739 changedPoint_[pointi] =
true;
740 changedPoints_[nChangedPoints_++] = pointi;
745 handleCollocatedPoints();
750 template<
class Type,
class TrackingData>
755 label changedEdgeI = 0;
756 changedEdgeI < nChangedEdges_;
760 label edgeI = changedEdges_[changedEdgeI];
762 if (!changedEdge_[edgeI])
766 <<
" not marked as having been changed" <<
nl 767 <<
"This might be caused by multiple occurrences of the same" 772 const Type& neighbourWallInfo = allEdgeInfo_[edgeI];
775 const edge&
e = mesh_.edges()[edgeI];
779 Type& currentWallInfo = allPointInfo_[e[eI]];
781 if (!currentWallInfo.equal(neighbourWallInfo, td_))
794 changedEdge_[edgeI] =
false;
800 if (nCyclicPatches_ > 0)
803 handleCyclicPatches();
817 label totNChanged = nChangedPoints_;
826 template<
class Type,
class TrackingData>
833 label changedPointi = 0;
834 changedPointi < nChangedPoints_;
838 label pointi = changedPoints_[changedPointi];
840 if (!changedPoint_[pointi])
843 <<
"Point " << pointi
844 <<
" not marked as having been changed" <<
nl 845 <<
"This might be caused by multiple occurrences of the same" 849 const Type& neighbourWallInfo = allPointInfo_[pointi];
853 const labelList& edgeLabels = pointEdges[pointi];
854 forAll(edgeLabels, edgeLabelI)
856 label edgeI = edgeLabels[edgeLabelI];
858 Type& currentWallInfo = allEdgeInfo_[edgeI];
860 if (!currentWallInfo.equal(neighbourWallInfo, td_))
873 changedPoint_[pointi] =
false;
885 label totNChanged = nChangedEdges_;
894 template<
class Type,
class TrackingData>
900 if (nCyclicPatches_ > 0)
903 handleCyclicPatches();
915 while (iter < maxIter)
917 while (iter < maxIter)
921 Info<< typeName <<
": Iteration " << iter <<
endl;
924 label nEdges = pointToEdge();
928 Info<< typeName <<
": Total changed edges : " 941 Info<< typeName <<
": Total changed points : " 943 << typeName <<
": Total evaluations : " 945 << typeName <<
": Remaining unvisited points: " 947 << typeName <<
": Remaining unvisited edges : " 966 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.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
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)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
void distribute(List< T > &fld, const bool dummyTransform=true, const int tag=UPstream::msgType()) const
Distribute data using default commsType.
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.
PointEdgeWave(const polyMesh &mesh, const labelList &initialPoints, const List< Type > &initialPointsInfo, UList< Type > &allPointInfo, UList< Type > &allEdgeInfo, const label maxIter, TrackingData &td=dummyTrackData_)
Construct from mesh, list of changed points with the Type.
Ostream & endl(Ostream &os)
Add newline and flush stream.
const mapDistribute & globalPointSlavesMap() const
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)
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.
const Field< PointType > & points() const
Return reference to global points.
int neighbProcNo() const
Return neighbour processor number.
errorManip< error > abort(error &err)
Output inter-processor communications stream operating on external buffer.
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)
void reverseDistribute(const label constructSize, List< T > &, const bool dummyTransform=true, const int tag=UPstream::msgType()) const
Reverse distribute data using default commsType.
const indirectPrimitivePatch & coupledPatch() const
Return patch of all coupled faces.
label constructSize() const
Constructed data size.
virtual const transformer & transform() const
Return null transform between processor patches.
static bool & parRun()
Is this a parallel run?
Class containing processor-to-processor mapping information.
bool equal(const T &s1, const T &s2)
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 &)