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>
126 if (rotTensor.
size() == 1)
128 const tensor&
T = rotTensor[0];
132 pointInfo[i].transform(T, td_);
138 <<
"Non-uniform transformation on patch " << patch.
name()
139 <<
" of type " << patch.type()
140 <<
" not supported for point fields" 145 pointInfo[i].transform(rotTensor[i], td_);
156 template<
class Type,
class TrackingData>
160 const label neighbourEdgeI,
161 const Type& neighbourInfo,
167 bool wasValid = pointInfo.valid(td_);
170 pointInfo.updatePoint
182 if (!changedPoint_[pointi])
184 changedPoint_[pointi] =
true;
185 changedPoints_[nChangedPoints_++] = pointi;
189 if (!wasValid && pointInfo.valid(td_))
203 template<
class Type,
class TrackingData>
207 const Type& neighbourInfo,
213 bool wasValid = pointInfo.valid(td_);
216 pointInfo.updatePoint
227 if (!changedPoint_[pointi])
229 changedPoint_[pointi] =
true;
230 changedPoints_[nChangedPoints_++] = pointi;
234 if (!wasValid && pointInfo.valid(td_))
248 template<
class Type,
class TrackingData>
252 const label neighbourPointi,
253 const Type& neighbourInfo,
259 bool wasValid = edgeInfo.valid(td_);
274 if (!changedEdge_[edgeI])
276 changedEdge_[edgeI] =
true;
277 changedEdges_[nChangedEdges_++] = edgeI;
281 if (!wasValid && edgeInfo.valid(td_))
291 template<
class Type,
class TrackingData>
292 template<
class PatchType>
299 if (isA<PatchType>(mesh_.boundaryMesh()[
patchi]))
309 template<
class Type,
class TrackingData>
320 forAll(mesh_.globalData().processorPatches(), i)
322 label patchi = mesh_.globalData().processorPatches()[i];
324 refCast<const processorPolyPatch>(mesh_.boundaryMesh()[
patchi]);
335 forAll(neighbPoints, thisPointi)
338 if (changedPoint_[meshPointi])
340 patchInfo.
append(allPointInfo_[meshPointi]);
341 thisPoints.
append(thisPointi);
342 nbrPoints.
append(neighbPoints[thisPointi]);
347 leaveDomain(procPatch, thisPoints, patchInfo);
357 toNeighbour << nbrPoints << patchInfo;
367 forAll(mesh_.globalData().processorPatches(), i)
369 label patchi = mesh_.globalData().processorPatches()[i];
371 refCast<const processorPolyPatch>(mesh_.boundaryMesh()[
patchi]);
378 fromNeighbour >> patchPoints >> patchInfo;
395 enterDomain(procPatch, patchPoints, patchInfo);
401 label meshPointi = meshPoints[patchPoints[i]];
403 if (!allPointInfo_[meshPointi].
equal(patchInfo[i], td_))
409 allPointInfo_[meshPointi]
422 template<
class Type,
class TrackingData>
435 if (isA<cyclicPolyPatch>(patch))
438 refCast<const cyclicPolyPatch>(patch);
455 label thisPointi = pairs[pairI][0];
456 label nbrPointi = pairs[pairI][1];
457 label meshPointi = meshPoints[nbrPointi];
459 if (changedPoint_[meshPointi])
461 nbrInfo.
append(allPointInfo_[meshPointi]);
462 nbrPoints.
append(nbrPointi);
463 thisPoints.
append(thisPointi);
468 leaveDomain(nbrPatch, nbrPoints, nbrInfo);
488 enterDomain(cycPatch, thisPoints, nbrInfo);
494 label meshPointi = meshPoints[thisPoints[i]];
496 if (!allPointInfo_[meshPointi].
equal(nbrInfo[i], td_))
502 allPointInfo_[meshPointi]
513 template<
class Type,
class TrackingData>
525 forAll(meshPoints, pointi)
527 elems[pointi] = allPointInfo_[meshPoints[pointi]];
539 Type& elem = elems[pointi];
541 const labelList& slavePoints = slaves[pointi];
546 cop(elem, elems[slavePoints[j]]);
552 elems[slavePoints[j]] = elem;
560 forAll(meshPoints, pointi)
562 if (elems[pointi].valid(td_))
564 label meshPointi = meshPoints[pointi];
566 Type& elem = allPointInfo_[meshPointi];
568 bool wasValid = elem.valid(td_);
573 if (!elem.equal(elems[pointi], td_))
576 elem = elems[pointi];
579 if (!wasValid && elem.valid(td_))
585 if (!changedPoint_[meshPointi])
587 changedPoint_[meshPointi] =
true;
588 changedPoints_[nChangedPoints_++] = meshPointi;
595 label totNChanged = nChangedPoints_;
607 template<
class Type,
class TrackingData>
622 allPointInfo_(allPointInfo),
623 allEdgeInfo_(allEdgeInfo),
625 changedPoint_(mesh_.nPoints(),
false),
626 changedPoints_(mesh_.nPoints()),
628 changedEdge_(mesh_.nEdges(),
false),
629 changedEdges_(mesh_.nEdges()),
631 nCyclicPatches_(countPatchType<cyclicPolyPatch>()),
633 nUnvisitedPoints_(mesh_.nPoints()),
634 nUnvisitedEdges_(mesh_.nEdges())
636 if (allPointInfo_.size() != mesh_.nPoints())
639 <<
"size of pointInfo work array is not equal to the number" 640 <<
" of points in the mesh" <<
endl 641 <<
" pointInfo :" << allPointInfo_.size() <<
endl 642 <<
" mesh.nPoints:" << mesh_.nPoints()
645 if (allEdgeInfo_.size() != mesh_.nEdges())
648 <<
"size of edgeInfo work array is not equal to the number" 649 <<
" of edges in the mesh" <<
endl 650 <<
" edgeInfo :" << allEdgeInfo_.size() <<
endl 651 <<
" mesh.nEdges:" << mesh_.nEdges()
657 setPointInfo(changedPoints, changedPointsInfo);
661 Info<< typeName <<
": Seed points : " 666 label iter = iterate(maxIter);
668 if ((maxIter > 0) && (iter >= maxIter))
671 <<
"Maximum number of iterations reached. Increase maxIter." <<
endl 672 <<
" maxIter:" << maxIter <<
endl 673 <<
" nChangedPoints:" << nChangedPoints_ <<
endl 674 <<
" nChangedEdges:" << nChangedEdges_ <<
endl 680 template<
class Type,
class TrackingData>
690 allPointInfo_(allPointInfo),
691 allEdgeInfo_(allEdgeInfo),
693 changedPoint_(mesh_.nPoints(),
false),
694 changedPoints_(mesh_.nPoints()),
696 changedEdge_(mesh_.nEdges(),
false),
697 changedEdges_(mesh_.nEdges()),
699 nCyclicPatches_(countPatchType<cyclicPolyPatch>()),
701 nUnvisitedPoints_(mesh_.nPoints()),
702 nUnvisitedEdges_(mesh_.nEdges())
708 template<
class Type,
class TrackingData>
716 template<
class Type,
class TrackingData>
719 return nUnvisitedPoints_;
723 template<
class Type,
class TrackingData>
726 return nUnvisitedEdges_;
731 template<
class Type,
class TrackingData>
738 forAll(changedPoints, changedPointi)
740 label pointi = changedPoints[changedPointi];
742 bool wasValid = allPointInfo_[pointi].valid(td_);
745 allPointInfo_[pointi] = changedPointsInfo[changedPointi];
748 if (!wasValid && allPointInfo_[pointi].valid(td_))
755 if (!changedPoint_[pointi])
757 changedPoint_[pointi] =
true;
758 changedPoints_[nChangedPoints_++] = pointi;
763 handleCollocatedPoints();
768 template<
class Type,
class TrackingData>
773 label changedEdgeI = 0;
774 changedEdgeI < nChangedEdges_;
778 label edgeI = changedEdges_[changedEdgeI];
780 if (!changedEdge_[edgeI])
784 <<
" not marked as having been changed" <<
nl 785 <<
"This might be caused by multiple occurences of the same" 790 const Type& neighbourWallInfo = allEdgeInfo_[edgeI];
793 const edge&
e = mesh_.edges()[edgeI];
797 Type& currentWallInfo = allPointInfo_[e[eI]];
799 if (!currentWallInfo.equal(neighbourWallInfo, td_))
812 changedEdge_[edgeI] =
false;
818 if (nCyclicPatches_ > 0)
821 handleCyclicPatches();
835 label totNChanged = nChangedPoints_;
844 template<
class Type,
class TrackingData>
851 label changedPointi = 0;
852 changedPointi < nChangedPoints_;
856 label pointi = changedPoints_[changedPointi];
858 if (!changedPoint_[pointi])
861 <<
"Point " << pointi
862 <<
" not marked as having been changed" <<
nl 863 <<
"This might be caused by multiple occurences of the same" 867 const Type& neighbourWallInfo = allPointInfo_[pointi];
871 const labelList& edgeLabels = pointEdges[pointi];
872 forAll(edgeLabels, edgeLabelI)
874 label edgeI = edgeLabels[edgeLabelI];
876 Type& currentWallInfo = allEdgeInfo_[edgeI];
878 if (!currentWallInfo.equal(neighbourWallInfo, td_))
891 changedPoint_[pointi] =
false;
903 label totNChanged = nChangedEdges_;
912 template<
class Type,
class TrackingData>
918 if (nCyclicPatches_ > 0)
921 handleCyclicPatches();
933 while (iter < maxIter)
935 while (iter < maxIter)
939 Info<< typeName <<
": Iteration " << iter <<
endl;
942 label nEdges = pointToEdge();
946 Info<< typeName <<
": Total changed edges : " 959 Info<< typeName <<
": Total changed points : " 961 << typeName <<
": Total evaluations : " 963 << typeName <<
": Remaining unvisited points: " 965 << typeName <<
": Remaining unvisited edges : " 984 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 & neighbPoints() const
Return neighbour point labels. WIP.
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 word & name() const
Return name.
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)
const double e
Elementary charge.
#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.
void size(const label)
Override size to be inconsistent with allocated storage.
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.
~PointEdgeWave()
Destructor.
void setPointInfo(const labelList &changedPoints, const List< Type > &changedPointsInfo)
Copy initial data into allPointInfo_.
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.
virtual const tensorField & forwardT() const
Return face transformation tensor.
Neighbour processor patch.
Input inter-processor communications stream operating on external buffer.
virtual bool parallel() const
Are the cyclic planes parallel.
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 neigbour 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 T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
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.
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)
Mesh consisting of general polyhedral cells.
label getUnsetPoints() const
const cyclicPolyPatch & neighbPatch() 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 &)