45 template<
class Type,
class TrackingData>
59 if (!
x.valid(td_) &&
y.valid(td_))
71 template<
class Type,
class TrackingData>
74 const polyPatch&
patch,
81 forAll(patchPointLabels, i)
83 label patchPointi = patchPointLabels[i];
85 const point& pt =
patch.points()[meshPoints[patchPointi]];
87 pointInfo[i].leaveDomain(
patch, patchPointi, pt, td_);
93 template<
class Type,
class TrackingData>
96 const polyPatch&
patch,
103 forAll(patchPointLabels, i)
105 label patchPointi = patchPointLabels[i];
107 const point& pt =
patch.points()[meshPoints[patchPointi]];
109 pointInfo[i].enterDomain(
patch, patchPointi, pt, td_);
115 template<
class Type,
class TrackingData>
118 const polyPatch&
patch,
120 List<Type>& pointInfo
123 if (rotTensor.size() == 1)
125 const tensor&
T = rotTensor[0];
129 pointInfo[i].transform(
T, td_);
135 <<
"Non-uniform transformation on patch " <<
patch.name()
136 <<
" of type " <<
patch.type()
137 <<
" not supported for point fields" 142 pointInfo[i].transform(rotTensor[i], td_);
153 template<
class Type,
class TrackingData>
157 const label neighbourEdgeI,
158 const Type& neighbourInfo,
164 bool wasValid = pointInfo.valid(td_);
167 pointInfo.updatePoint
179 if (changedPoint_.set(pointi))
181 changedPoints_.push_back(pointi);
185 if (!wasValid && pointInfo.valid(td_))
199 template<
class Type,
class TrackingData>
203 const Type& neighbourInfo,
209 bool wasValid = pointInfo.valid(td_);
212 pointInfo.updatePoint
223 if (changedPoint_.set(pointi))
225 changedPoints_.push_back(pointi);
229 if (!wasValid && pointInfo.valid(td_))
243 template<
class Type,
class TrackingData>
247 const label neighbourPointi,
248 const Type& neighbourInfo,
254 bool wasValid = edgeInfo.valid(td_);
269 if (changedEdge_.set(edgei))
271 changedEdges_.push_back(edgei);
275 if (!wasValid && edgeInfo.valid(td_))
285 template<
class Type,
class TrackingData>
286 template<
class PatchType>
291 for (
const polyPatch&
p : mesh_.boundaryMesh())
293 if (isA<PatchType>(
p))
303 template<
class Type,
class TrackingData>
314 forAll(mesh_.globalData().processorPatches(), i)
316 label patchi = mesh_.globalData().processorPatches()[i];
318 refCast<const processorPolyPatch>(mesh_.boundaryMesh()[patchi]);
329 forAll(neighbPoints, thisPointi)
331 label meshPointi = procPatch.
meshPoints()[thisPointi];
332 if (changedPoint_.test(meshPointi))
334 patchInfo.
append(allPointInfo_[meshPointi]);
335 thisPoints.
append(thisPointi);
336 nbrPoints.
append(neighbPoints[thisPointi]);
341 leaveDomain(procPatch, thisPoints, patchInfo);
351 toNeighbour << nbrPoints << patchInfo;
355 pBufs.finishedSends();
361 forAll(mesh_.globalData().processorPatches(), i)
363 label patchi = mesh_.globalData().processorPatches()[i];
364 const processorPolyPatch& procPatch =
365 refCast<const processorPolyPatch>(mesh_.boundaryMesh()[patchi]);
367 List<Type> patchInfo;
371 UIPstream fromNeighbour(procPatch.neighbProcNo(), pBufs);
372 fromNeighbour >> patchPoints >> patchInfo;
383 if (!procPatch.parallel())
385 transform(procPatch, procPatch.forwardT(), patchInfo);
389 enterDomain(procPatch, patchPoints, patchInfo);
392 const labelList& meshPoints = procPatch.meshPoints();
395 label meshPointi = meshPoints[patchPoints[i]];
397 if (!allPointInfo_[meshPointi].
equal(patchInfo[i], td_))
403 allPointInfo_[meshPointi]
416 template<
class Type,
class TrackingData>
421 DynamicList<Type> nbrInfo;
422 DynamicList<label> nbrPoints;
423 DynamicList<label> thisPoints;
425 for (
const polyPatch&
patch : mesh_.boundaryMesh())
427 const cyclicPolyPatch* cpp = isA<cyclicPolyPatch>(
patch);
431 const auto& cycPatch = *cpp;
432 const auto& nbrPatch = cycPatch.neighbPatch();
435 nbrInfo.reserve(cycPatch.nPoints());
437 nbrPoints.reserve(cycPatch.nPoints());
439 thisPoints.reserve(cycPatch.nPoints());
443 const edgeList& pairs = cycPatch.coupledPoints();
444 const labelList& meshPoints = nbrPatch.meshPoints();
448 label thisPointi = pairs[pairI][0];
449 label nbrPointi = pairs[pairI][1];
450 label meshPointi = meshPoints[nbrPointi];
452 if (changedPoint_.test(meshPointi))
454 nbrInfo.append(allPointInfo_[meshPointi]);
455 nbrPoints.append(nbrPointi);
456 thisPoints.append(thisPointi);
461 leaveDomain(nbrPatch, nbrPoints, nbrInfo);
467 if (!cycPatch.parallel())
470 transform(cycPatch, cycPatch.forwardT(), nbrInfo);
481 enterDomain(cycPatch, thisPoints, nbrInfo);
484 const labelList& meshPoints = cycPatch.meshPoints();
487 label meshPointi = meshPoints[thisPoints[i]];
489 if (!allPointInfo_[meshPointi].
equal(nbrInfo[i], td_))
495 allPointInfo_[meshPointi]
506 template<
class Type,
class TrackingData>
510 const globalMeshData& gmd = mesh_.globalData();
512 const labelList& meshPoints = cpp.meshPoints();
514 const mapDistribute& slavesMap = gmd.globalPointSlavesMap();
517 List<Type> elems(slavesMap.constructSize());
518 forAll(meshPoints, pointi)
520 elems[pointi] = allPointInfo_[meshPoints[pointi]];
525 slavesMap.distribute(elems,
false);
528 combineEqOp<Type, TrackingData> cop(td_);
532 Type& elem = elems[pointi];
534 const labelList& slavePoints = slaves[pointi];
539 cop(elem, elems[slavePoints[j]]);
545 elems[slavePoints[j]] = elem;
550 slavesMap.reverseDistribute(elems.size(), elems,
false);
553 forAll(meshPoints, pointi)
555 if (elems[pointi].valid(td_))
557 label meshPointi = meshPoints[pointi];
559 Type& elem = allPointInfo_[meshPointi];
561 bool wasValid = elem.valid(td_);
566 if (!elem.equal(elems[pointi], td_))
569 elem = elems[pointi];
572 if (!wasValid && elem.valid(td_))
578 if (changedPoint_.set(meshPointi))
580 changedPoints_.push_back(meshPointi);
595 template<
class Type,
class TrackingData>
611 allPointInfo_(allPointInfo),
612 allEdgeInfo_(allEdgeInfo),
620 <<
"size of pointInfo work array is not equal to the number" 621 <<
" of points in the mesh" <<
endl 622 <<
" pointInfo :" << allPointInfo_.
size() <<
endl 629 <<
"size of edgeInfo work array is not equal to the number" 630 <<
" of edges in the mesh" <<
endl 631 <<
" edgeInfo :" << allEdgeInfo_.
size() <<
endl 642 Info<< typeName <<
": Seed points : " 649 if ((maxIter > 0) && (iter >= maxIter))
652 <<
"Maximum number of iterations reached. Increase maxIter." <<
endl 653 <<
" maxIter:" << maxIter <<
nl 661 template<
class Type,
class TrackingData>
672 allPointInfo_(allPointInfo),
673 allEdgeInfo_(allEdgeInfo),
683 template<
class Type,
class TrackingData>
690 forAll(changedPoints, changedPointi)
692 const label pointi = changedPoints[changedPointi];
694 const bool wasValid = allPointInfo_[pointi].valid(td_);
697 allPointInfo_[pointi] = changedPointsInfo[changedPointi];
700 if (!wasValid && allPointInfo_[pointi].valid(td_))
707 if (changedPoint_.set(pointi))
714 handleCollocatedPoints();
719 template<
class Type,
class TrackingData>
722 for (
const label edgei : changedEdges_)
724 if (!changedEdge_.test(edgei))
728 <<
" not marked as having been changed" <<
nl 729 <<
"This might be caused by multiple occurrences of the same" 734 const Type& neighbourWallInfo = allEdgeInfo_[edgei];
737 const edge&
e = mesh_.edges()[edgei];
741 Type& currentWallInfo = allPointInfo_[
e[eI]];
743 if (!currentWallInfo.equal(neighbourWallInfo, td_))
756 changedEdge_.unset(edgei);
760 changedEdges_.clear();
762 if (nCyclicPatches_ > 0)
765 handleCyclicPatches();
784 template<
class Type,
class TrackingData>
789 for (
const label pointi : changedPoints_)
791 if (!changedPoint_.test(pointi))
794 <<
"Point " << pointi
795 <<
" not marked as having been changed" <<
nl 796 <<
"This might be caused by multiple occurrences of the same" 800 const Type& neighbourWallInfo = allPointInfo_[pointi];
804 for (
const label edgei : pointEdges[pointi])
806 Type& currentWallInfo = allEdgeInfo_[edgei];
808 if (!currentWallInfo.equal(neighbourWallInfo, td_))
821 changedPoint_.unset(pointi);
825 changedPoints_.clear();
838 template<
class Type,
class TrackingData>
844 if (nCyclicPatches_ > 0)
847 handleCyclicPatches();
859 while (iter < maxIter)
861 while (iter < maxIter)
865 Info<< typeName <<
": Iteration " << iter <<
endl;
868 label nEdges = pointToEdge();
872 Info<< typeName <<
": Total changed edges : " 885 Info<< typeName <<
": Total changed points : " 887 << typeName <<
": Total evaluations : " 889 << typeName <<
": Remaining unvisited points: " 891 << typeName <<
": Remaining unvisited edges : " 907 label
nPoints = handleCollocatedPoints();
910 Info<< typeName <<
": Collocated point sync : "
List< labelList > labelListList
A List of labelList.
label nPoints() const
Number of points supporting patch faces.
void size(const label n)
Older name for setAddressableSize.
Reduction class. If x and y are not equal assign value.
const labelList & neighbPoints() const
Return neighbour point labels. WIP.
errorManipArg< error, int > exit(error &err, const int errNo=1)
label nPoints() const noexcept
Number of mesh points.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
label pointToEdge()
Propagate from point to edge. Returns total number of edges.
const polyMesh & mesh_
Reference to mesh.
label iterate(const label maxIter)
Iterate until no changes or maxIter reached. Returns actual.
constexpr char nl
The newline '\n' character (0x0a)
Ostream & endl(Ostream &os)
Add newline and flush stream.
static bool & parRun() noexcept
Test if this a parallel run.
label edgeToPoint()
Propagate from edge to point. Returns total number of points.
void setPointInfo(const labelList &changedPoints, const List< Type > &changedPointsInfo)
Copy initial data into allPointInfo_.
PrimitivePatch< IndirectList< face >, const pointField & > indirectPrimitivePatch
A PrimitivePatch with an IndirectList for the faces, const reference for the point field...
combineEqOp(TrackingData &td)
void push_back(const T &val)
Append an element at the end of the list.
T returnReduce(const T &value, const BinaryOp &bop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Perform reduction on a copy, using specified binary operation.
const labelList & meshPoints() const
Return labelList of mesh points in patch.
Neighbour processor patch.
#define forAll(list, i)
Loop across all elements in list.
const dimensionedScalar e
Elementary charge.
List< edge > edgeList
A List of edges.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
label nChangedEdges() const noexcept
Current number of changed edges.
void append(const T &val)
Copy append an element to the end of this list.
int neighbProcNo() const
Return neighbour processor number.
errorManip< error > abort(error &err)
label nEdges() const
Number of mesh edges.
void reserve(const label len)
Reserve allocation space for at least this size, allocating new space if required and retaining old c...
int debug
Static debugging option.
void operator()(Type &x, const Type &y) const
void clear() noexcept
Clear the addressed list, i.e. set the size to zero.
Buffers for inter-processor communications streams (UOPstream, UIPstream).
Field< tensor > tensorField
Specialisation of Field<T> for tensor.
vector point
Point is a vector.
const std::string patch
OpenFOAM patch number as a std::string.
messageStream Info
Information stream (stdout output on master, null elsewhere)
Mesh consisting of general polyhedral cells.
List< label > labelList
A List of labels.
A patch is a list of labels that address the faces in the global face list.
Wave propagation of information through grid. Every iteration information goes through one layer of e...
dimensionSet transform(const dimensionSet &ds)
Return the argument; transformations do not change the dimensions.
label nChangedPoints() const noexcept
Current number of changed points.