43 class PrimitivePatchType,
51 const label neighbourFacei,
52 const Type& neighbourInfo,
58 bool wasValid = edgeInfo.valid(td_);
74 if (changedEdge_.set(edgei))
76 changedEdges_.push_back(edgei);
80 if (!wasValid && edgeInfo.valid(td_))
96 class PrimitivePatchType,
104 const label neighbourEdgeI,
105 const Type& neighbourInfo,
111 bool wasValid = faceInfo.valid(td_);
127 if (changedFace_.set(facei))
129 changedFaces_.push_back(facei);
133 if (!wasValid && faceInfo.valid(td_))
144 class PrimitivePatchType,
151 const globalMeshData& globalData = mesh_.globalData();
152 const mapDistribute& map = globalData.globalEdgeSlavesMap();
153 const bitSet& cppOrientation = globalData.globalEdgeOrientation();
159 List<Type> cppEdgeData(map.constructSize());
163 label patchEdgeI = patchEdges_[i];
164 label coupledEdgeI = coupledEdges_[i];
166 if (changedEdge_.test(patchEdgeI))
168 const Type& data = allEdgeInfo_[patchEdgeI];
173 bool sameOrientation =
175 sameEdgeOrientation_[i]
176 == cppOrientation[coupledEdgeI]
179 cppEdgeData[coupledEdgeI].updateEdge
198 globalData.globalEdgeSlaves(),
199 globalData.globalEdgeTransformedSlaves(),
201 globalData.globalTransforms(),
202 updateOp<PrimitivePatchType, Type, TrackingData>
209 transformOp<PrimitivePatchType, Type, TrackingData>
224 label patchEdgeI = patchEdges_[i];
225 label coupledEdgeI = coupledEdges_[i];
227 const Type& data = cppEdgeData[coupledEdgeI];
231 bool sameOrientation =
233 sameEdgeOrientation_[i]
234 == cppOrientation[coupledEdgeI]
237 allEdgeInfo_[patchEdgeI].updateEdge
247 if (changedEdge_.set(patchEdgeI))
249 changedEdges_.push_back(patchEdgeI);
262 class PrimitivePatchType,
270 const PrimitivePatchType&
patch,
283 allEdgeInfo_(allEdgeInfo),
284 allFaceInfo_(allFaceInfo),
301 if (allEdgeInfo_.
size() != patch_.nEdges())
304 <<
"size of edgeInfo work array is not equal to the number" 305 <<
" of edges in the patch" <<
nl 306 <<
" edgeInfo :" << allEdgeInfo_.
size() <<
nl 307 <<
" patch.nEdges:" << patch_.nEdges() <<
endl 310 if (allFaceInfo_.
size() != patch_.size())
313 <<
"size of edgeInfo work array is not equal to the number" 314 <<
" of faces in the patch" <<
nl 315 <<
" faceInfo :" << allFaceInfo_.
size() <<
nl 316 <<
" patch.size:" << patch_.size() <<
endl 332 if ((maxIter > 0) && (iter >= maxIter))
335 <<
"Maximum number of iterations reached. Increase maxIter." <<
nl 336 <<
" maxIter:" << maxIter <<
nl 346 class PrimitivePatchType,
354 const PrimitivePatchType&
patch,
362 allEdgeInfo_(allEdgeInfo),
363 allFaceInfo_(allFaceInfo),
386 class PrimitivePatchType,
397 forAll(changedEdges, changedEdgeI)
399 label edgeI = changedEdges[changedEdgeI];
401 bool wasValid = allEdgeInfo_[edgeI].valid(td_);
404 allEdgeInfo_[edgeI] = changedEdgesInfo[changedEdgeI];
407 if (!wasValid && allEdgeInfo_[edgeI].valid(td_))
414 if (changedEdge_.set(edgeI))
425 class PrimitivePatchType,
432 changedEdges_.clear();
433 changedEdge_ =
false;
435 for (
const label facei : changedFaces_)
437 if (!changedFace_.test(facei))
441 <<
" not marked as having been changed" <<
nl 442 <<
"This might be caused by multiple occurrences of the same" 446 const Type& neighbourWallInfo = allFaceInfo_[facei];
449 const labelList& fEdges = patch_.faceEdges()[facei];
453 label edgeI = fEdges[fEdgeI];
455 Type& currentWallInfo = allEdgeInfo_[edgeI];
457 if (!currentWallInfo.equal(neighbourWallInfo, td_))
476 Pout<<
"Changed edges : " << nChangedEdges() <<
endl;
486 class PrimitivePatchType,
493 changedFaces_.clear();
494 changedFace_ =
false;
498 for (
const label edgei : changedEdges_)
500 if (!changedEdge_.test(edgei))
504 <<
" not marked as having been changed" <<
nl 505 <<
"This might be caused by multiple occurrences of the same" 509 const Type& neighbourWallInfo = allEdgeInfo_[edgei];
513 for (
const label facei : edgeFaces[edgei])
515 Type& currentWallInfo = allFaceInfo_[facei];
517 if (!currentWallInfo.equal(neighbourWallInfo, td_))
532 Pout<<
"Changed faces : " << nChangedFaces() <<
endl;
542 class PrimitivePatchType,
559 while (iter < maxIter)
563 Pout<<
"Iteration " << iter <<
endl;
566 label nFaces = edgeToFace();
570 Pout<<
"Total changed faces : " << nFaces <<
endl;
578 label nEdges = faceToEdge();
582 Pout<<
"Total changed edges : " << nEdges <<
nl 583 <<
"Total evaluations : " << nEvals_ <<
nl 584 <<
"Remaining unvisited edges : " << nUnvisitedEdges_ <<
nl 585 <<
"Remaining unvisited faces : " << nUnvisitedFaces_ <<
nl const polyMesh & mesh_
Reference to mesh.
void size(const label n)
Older name for setAddressableSize.
errorManipArg< error, int > exit(error &err, const int errNo=1)
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.
Wave propagation of information along patch. Every iteration information goes through one layer of fa...
constexpr char nl
The newline '\n' character (0x0a)
label faceToEdge()
Propagate from face to edge.
label edgeToFace()
Propagate from edge to face.
Ostream & endl(Ostream &os)
Add newline and flush stream.
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.
#define forAll(list, i)
Loop across all elements in list.
label nChangedFaces() const noexcept
Current number of changed faces.
const globalMeshData & globalData() const
Return parallel info.
errorManip< error > abort(error &err)
label iterate(const label maxIter)
Iterate until no changes or maxIter reached.
int debug
Static debugging option.
void setEdgeInfo(const labelList &changedEdges, const List< Type > &changedEdgesInfo)
Copy initial data into allEdgeInfo_.
const indirectPrimitivePatch & coupledPatch() const
Return patch of all coupled faces.
const std::string patch
OpenFOAM patch number as a std::string.
label nChangedEdges() const noexcept
Current number of changed edges.
Mesh consisting of general polyhedral cells.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.