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>
323 pBufs_.initRegisterSend();
331 for (
const label patchi : procPatches)
333 const auto& procPatch =
334 refCast<const processorPolyPatch>(mesh_.boundaryMesh()[patchi]);
336 const label nbrProci = procPatch.neighbProcNo();
339 patchInfo.
reserve(procPatch.nPoints());
342 thisPoints.
reserve(procPatch.nPoints());
345 nbrPoints.
reserve(procPatch.nPoints());
348 const labelList& neighbPoints = procPatch.neighbPoints();
349 forAll(neighbPoints, thisPointi)
351 label meshPointi = procPatch.meshPoints()[thisPointi];
352 if (changedPoint_.test(meshPointi))
354 patchInfo.
append(allPointInfo_[meshPointi]);
355 thisPoints.
append(thisPointi);
356 nbrPoints.
append(neighbPoints[thisPointi]);
361 leaveDomain(procPatch, thisPoints, patchInfo);
365 UOPstream toNbr(nbrProci, pBufs_);
366 toNbr << nbrPoints << patchInfo;
369 pBufs_.registerSend(nbrProci, !patchInfo.empty());
382 pBufs_.finishedNeighbourSends(neighbourProcs);
389 for (
const label patchi : procPatches)
391 const auto& procPatch =
392 refCast<const processorPolyPatch>(mesh_.boundaryMesh()[patchi]);
394 const label nbrProci = procPatch.neighbProcNo();
396 if (!pBufs_.recvDataCount(nbrProci))
403 List<Type> patchInfo;
405 UIPstream is(nbrProci, pBufs_);
406 is >> patchPoints >> patchInfo;
417 if (!procPatch.parallel())
419 transform(procPatch, procPatch.forwardT(), patchInfo);
423 enterDomain(procPatch, patchPoints, patchInfo);
426 const labelList& meshPoints = procPatch.meshPoints();
429 label meshPointi = meshPoints[patchPoints[i]];
431 if (!allPointInfo_[meshPointi].
equal(patchInfo[i], td_))
437 allPointInfo_[meshPointi]
450 template<
class Type,
class TrackingData>
455 DynamicList<Type> nbrInfo;
456 DynamicList<label> nbrPoints;
457 DynamicList<label> thisPoints;
459 for (
const polyPatch&
patch : mesh_.boundaryMesh())
461 const cyclicPolyPatch* cpp = isA<cyclicPolyPatch>(
patch);
465 const auto& cycPatch = *cpp;
466 const auto& nbrPatch = cycPatch.neighbPatch();
469 nbrInfo.reserve(cycPatch.nPoints());
471 nbrPoints.reserve(cycPatch.nPoints());
473 thisPoints.reserve(cycPatch.nPoints());
477 const edgeList& pairs = cycPatch.coupledPoints();
478 const labelList& meshPoints = nbrPatch.meshPoints();
482 label thisPointi = pairs[pairI][0];
483 label nbrPointi = pairs[pairI][1];
484 label meshPointi = meshPoints[nbrPointi];
486 if (changedPoint_.test(meshPointi))
488 nbrInfo.append(allPointInfo_[meshPointi]);
489 nbrPoints.append(nbrPointi);
490 thisPoints.append(thisPointi);
495 leaveDomain(nbrPatch, nbrPoints, nbrInfo);
501 if (!cycPatch.parallel())
504 transform(cycPatch, cycPatch.forwardT(), nbrInfo);
515 enterDomain(cycPatch, thisPoints, nbrInfo);
518 const labelList& meshPoints = cycPatch.meshPoints();
521 label meshPointi = meshPoints[thisPoints[i]];
523 if (!allPointInfo_[meshPointi].
equal(nbrInfo[i], td_))
529 allPointInfo_[meshPointi]
540 template<
class Type,
class TrackingData>
544 const globalMeshData& gmd = mesh_.globalData();
546 const labelList& meshPoints = cpp.meshPoints();
548 const mapDistribute& slavesMap = gmd.globalPointSlavesMap();
551 List<Type> elems(slavesMap.constructSize());
552 forAll(meshPoints, pointi)
554 elems[pointi] = allPointInfo_[meshPoints[pointi]];
559 slavesMap.distribute(elems,
false);
562 combineEqOp<Type, TrackingData> cop(td_);
566 Type& elem = elems[pointi];
568 const labelList& slavePoints = slaves[pointi];
573 cop(elem, elems[slavePoints[j]]);
579 elems[slavePoints[j]] = elem;
584 slavesMap.reverseDistribute(elems.size(), elems,
false);
587 forAll(meshPoints, pointi)
589 if (elems[pointi].valid(td_))
591 label meshPointi = meshPoints[pointi];
593 Type& elem = allPointInfo_[meshPointi];
595 bool wasValid = elem.valid(td_);
600 if (!elem.equal(elems[pointi], td_))
603 elem = elems[pointi];
606 if (!wasValid && elem.valid(td_))
612 if (changedPoint_.set(meshPointi))
614 changedPoints_.push_back(meshPointi);
629 template<
class Type,
class TrackingData>
645 allPointInfo_(allPointInfo),
646 allEdgeInfo_(allEdgeInfo),
654 <<
"size of pointInfo work array is not equal to the number" 655 <<
" of points in the mesh" <<
endl 656 <<
" pointInfo :" << allPointInfo_.
size() <<
endl 663 <<
"size of edgeInfo work array is not equal to the number" 664 <<
" of edges in the mesh" <<
endl 665 <<
" edgeInfo :" << allEdgeInfo_.
size() <<
endl 676 Info<< typeName <<
": Seed points : " 683 if ((maxIter > 0) && (iter >= maxIter))
686 <<
"Maximum number of iterations reached. Increase maxIter." <<
endl 687 <<
" maxIter:" << maxIter <<
nl 695 template<
class Type,
class TrackingData>
706 allPointInfo_(allPointInfo),
707 allEdgeInfo_(allEdgeInfo),
717 template<
class Type,
class TrackingData>
724 forAll(changedPoints, changedPointi)
726 const label pointi = changedPoints[changedPointi];
728 const bool wasValid = allPointInfo_[pointi].valid(td_);
731 allPointInfo_[pointi] = changedPointsInfo[changedPointi];
734 if (!wasValid && allPointInfo_[pointi].valid(td_))
741 if (changedPoint_.set(pointi))
748 handleCollocatedPoints();
753 template<
class Type,
class TrackingData>
756 for (
const label edgei : changedEdges_)
758 if (!changedEdge_.test(edgei))
762 <<
" not marked as having been changed" <<
nl 763 <<
"This might be caused by multiple occurrences of the same" 768 const Type& neighbourWallInfo = allEdgeInfo_[edgei];
771 const edge&
e = mesh_.edges()[edgei];
775 Type& currentWallInfo = allPointInfo_[
e[eI]];
777 if (!currentWallInfo.equal(neighbourWallInfo, td_))
790 changedEdge_.unset(edgei);
794 changedEdges_.clear();
796 if (nCyclicPatches_ > 0)
799 handleCyclicPatches();
818 template<
class Type,
class TrackingData>
823 for (
const label pointi : changedPoints_)
825 if (!changedPoint_.test(pointi))
828 <<
"Point " << pointi
829 <<
" not marked as having been changed" <<
nl 830 <<
"This might be caused by multiple occurrences of the same" 834 const Type& neighbourWallInfo = allPointInfo_[pointi];
838 for (
const label edgei : pointEdges[pointi])
840 Type& currentWallInfo = allEdgeInfo_[edgei];
842 if (!currentWallInfo.equal(neighbourWallInfo, td_))
855 changedPoint_.unset(pointi);
859 changedPoints_.clear();
872 template<
class Type,
class TrackingData>
878 if (nCyclicPatches_ > 0)
881 handleCyclicPatches();
893 while (iter < maxIter)
895 while (iter < maxIter)
899 Info<< typeName <<
": Iteration " << iter <<
endl;
902 label nEdges = pointToEdge();
906 Info<< typeName <<
": Total changed edges : " 919 Info<< typeName <<
": Total changed points : " 921 << typeName <<
": Total evaluations : " 923 << typeName <<
": Remaining unvisited points: " 925 << typeName <<
": Remaining unvisited edges : " 941 label
nPoints = handleCollocatedPoints();
944 Info<< typeName <<
": Collocated point sync : "
void size(const label n)
Older name for setAddressableSize.
Reduction class. If x and y are not equal assign value.
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.
List< edge > edgeList
List of edge.
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 polyMesh & mesh_
Reference to mesh.
const labelList & processorPatches() const noexcept
Return list of processor patch labels.
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.
List< labelList > labelListList
List of labelList.
#define forAll(list, i)
Loop across all elements in list.
const dimensionedScalar e
Elementary charge.
An edge is a list of two vertex labels. This can correspond to a directed graph edge or an edge on a ...
void clear()
Clear the list, i.e. set size to zero.
label nChangedEdges() const noexcept
Current number of changed edges.
void append(const T &val)
Copy append an element to the end of this list.
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.
Field< tensor > tensorField
Specialisation of Field<T> for tensor.
const labelList & procNeighbours() const
The neighbour processor connections (ascending order) associated with the local rank.
vector point
Point is a vector.
const processorTopology & topology() const noexcept
The processor to processor topology.
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.