40 template<
class Type,
class TrackingData>
43 template<
class Type,
class TrackingData>
46 template<
class Type,
class TrackingData>
52 template<
class Type,
class TrackingData>
56 const label neighbourFacei,
57 const Type& neighbourInfo,
85 if (!changedCell_[celli])
87 changedCell_[celli] =
true;
88 changedCells_.append(celli);
101 template<
class Type,
class TrackingData>
105 const label neighbourCelli,
106 const Type& neighbourInfo,
119 bool wasValid = faceInfo.valid(td_);
134 if (!changedFace_[facei])
136 changedFace_[facei] =
true;
137 changedFaces_.append(facei);
141 if (!wasValid && faceInfo.valid(td_))
150 template<
class Type,
class TrackingData>
154 const Type& neighbourInfo,
167 bool wasValid = faceInfo.valid(td_);
181 if (!changedFace_[facei])
183 changedFace_[facei] =
true;
184 changedFaces_.append(facei);
188 if (!wasValid && faceInfo.valid(td_))
197 template<
class Type,
class TrackingData>
206 refCast<const cyclicPolyPatch>(patch).
nbrPatch();
215 !allFaceInfo_[i1].sameGeometry
225 <<
" faceInfo:" << allFaceInfo_[i1]
226 <<
" otherfaceInfo:" << allFaceInfo_[i2]
230 if (changedFace_[i1] != changedFace_[i2])
233 <<
" faceInfo:" << allFaceInfo_[i1]
234 <<
" otherfaceInfo:" << allFaceInfo_[i2]
235 <<
" changedFace:" << changedFace_[i1]
236 <<
" otherchangedFace:" << changedFace_[i2]
243 template<
class Type,
class TrackingData>
244 template<
class PatchType>
249 if (isA<PatchType>(mesh_.boundaryMesh()[
patchi]))
258 template<
class Type,
class TrackingData>
265 forAll(changedFaces, changedFacei)
267 label facei = changedFaces[changedFacei];
269 bool wasValid = allFaceInfo_[facei].valid(td_);
272 allFaceInfo_[facei] = changedFacesInfo[changedFacei];
275 if (!wasValid && allFaceInfo_[facei].
valid(td_))
282 changedFace_[facei] =
true;
283 changedFaces_.
append(facei);
288 template<
class Type,
class TrackingData>
299 for (
label changedFacei = 0; changedFacei < nFaces; changedFacei++)
301 const Type& neighbourWallInfo = changedFacesInfo[changedFacei];
302 label patchFacei = changedFaces[changedFacei];
306 Type& currentWallInfo = allFaceInfo_[meshFacei];
308 if (!currentWallInfo.equal(neighbourWallInfo, td_))
322 template<
class Type,
class TrackingData>
326 const label startFacei,
335 label nChangedPatchFaces = 0;
337 for (
label i = 0; i < nFaces; i++)
343 if (changedFace_[meshFacei])
345 changedPatchFaces[nChangedPatchFaces] = patchFacei;
346 changedPatchFacesInfo[nChangedPatchFaces] = allFaceInfo_[meshFacei];
347 nChangedPatchFaces++;
350 return nChangedPatchFaces;
354 template<
class Type,
class TrackingData>
364 for (
label i = 0; i < nFaces; i++)
366 faceInfo[i].transform(patch, faceLabels[i],
transform, td_);
371 template<
class Type,
class TrackingData>
390 refCast<const processorPolyPatch>(mesh_.boundaryMesh()[
patchi]);
398 nSendFaces = getChangedPatchFaces
411 <<
" Sending:" << nSendFaces
431 refCast<const processorPolyPatch>(mesh_.boundaryMesh()[
patchi]);
440 fromNeighbour >> receiveFaces >> receiveFacesInfo;
447 <<
" Receiving:" << receiveFaces.
size()
473 template<
class Type,
class TrackingData>
482 if (isA<cyclicPolyPatch>(patch))
485 refCast<const cyclicPolyPatch>(patch);
494 nReceiveFaces = getChangedPatchFaces
506 <<
" Changed : " << nReceiveFaces
531 checkCyclic(cycPatch);
538 template<
class Type,
class TrackingData>
549 forAll(explicitConnections_, connI)
551 const labelPair& baffle = explicitConnections_[connI];
553 label f0 = baffle[0];
554 if (changedFace_[f0])
557 f0Info.
append(allFaceInfo_[f0]);
560 label f1 = baffle[1];
561 if (changedFace_[f1])
564 f1Info.
append(allFaceInfo_[f1]);
573 const labelPair& baffle = explicitConnections_[f1Baffle[index]];
575 label f0 = baffle[0];
576 Type& currentWallInfo = allFaceInfo_[f0];
578 if (!currentWallInfo.equal(f1Info[index], td_))
592 const labelPair& baffle = explicitConnections_[f0Baffle[index]];
594 label f1 = baffle[1];
595 Type& currentWallInfo = allFaceInfo_[f1];
597 if (!currentWallInfo.equal(f0Info[index], td_))
613 template<
class Type,
class TrackingData>
623 explicitConnections_(0),
624 allFaceInfo_(allFaceInfo),
625 allCellInfo_(allCellInfo),
627 changedFace_(mesh_.nFaces(), false),
628 changedFaces_(mesh_.nFaces()),
629 changedCell_(mesh_.nCells(), false),
630 changedCells_(mesh_.nCells()),
633 nUnvisitedCells_(mesh_.nCells()),
634 nUnvisitedFaces_(mesh_.nFaces())
643 <<
"face and cell storage not the size of mesh faces, cells:"
654 template<
class Type,
class TrackingData>
667 explicitConnections_(0),
668 allFaceInfo_(allFaceInfo),
669 allCellInfo_(allCellInfo),
671 changedFace_(mesh_.nFaces(), false),
672 changedFaces_(mesh_.nFaces()),
673 changedCell_(mesh_.nCells(), false),
674 changedCells_(mesh_.nCells()),
677 nUnvisitedCells_(mesh_.nCells()),
678 nUnvisitedFaces_(mesh_.nFaces())
687 <<
"face and cell storage not the size of mesh faces, cells:"
702 if ((maxIter > 0) && (iter >= maxIter))
705 <<
"Maximum number of iterations reached. Increase maxIter." <<
endl
706 <<
" maxIter:" << maxIter <<
endl
714 template<
class Type,
class TrackingData>
728 explicitConnections_(explicitConnections),
729 allFaceInfo_(allFaceInfo),
730 allCellInfo_(allCellInfo),
732 changedFace_(mesh_.nFaces(), false),
733 changedFaces_(mesh_.nFaces()),
734 changedCell_(mesh_.nCells(), false),
735 changedCells_(mesh_.nCells()),
738 nUnvisitedCells_(mesh_.nCells()),
739 nUnvisitedFaces_(mesh_.nFaces())
748 <<
"face and cell storage not the size of mesh faces, cells:"
763 if ((maxIter > 0) && (iter >= maxIter))
766 <<
"Maximum number of iterations reached. Increase maxIter." <<
endl
767 <<
" maxIter:" << maxIter <<
endl
777 template<
class Type,
class TrackingData>
780 return nUnvisitedCells_;
784 template<
class Type,
class TrackingData>
787 return nUnvisitedFaces_;
791 template<
class Type,
class TrackingData>
796 const labelList& owner = mesh_.faceOwner();
797 const labelList& neighbour = mesh_.faceNeighbour();
798 label nInternalFaces = mesh_.nInternalFaces();
800 forAll(changedFaces_, changedFacei)
802 label facei = changedFaces_[changedFacei];
803 if (!changedFace_[facei])
807 <<
" not marked as having been changed"
812 const Type& neighbourWallInfo = allFaceInfo_[facei];
817 label celli = owner[facei];
818 Type& currentWallInfo = allCellInfo_[celli];
820 if (!currentWallInfo.equal(neighbourWallInfo, td_))
833 if (facei < nInternalFaces)
835 celli = neighbour[facei];
836 Type& currentWallInfo2 = allCellInfo_[celli];
838 if (!currentWallInfo2.equal(neighbourWallInfo, td_))
852 changedFace_[facei] =
false;
856 changedFaces_.clear();
860 Pout<<
" Changed cells : " << changedCells_.size() <<
endl;
864 label totNChanged = changedCells_.size();
872 template<
class Type,
class TrackingData>
879 forAll(changedCells_, changedCelli)
881 label celli = changedCells_[changedCelli];
882 if (!changedCell_[celli])
885 <<
"Cell " << celli <<
" not marked as having been changed"
889 const Type& neighbourWallInfo = allCellInfo_[celli];
894 forAll(faceLabels, faceLabelI)
896 label facei = faceLabels[faceLabelI];
897 Type& currentWallInfo = allFaceInfo_[facei];
899 if (!currentWallInfo.equal(neighbourWallInfo, td_))
913 changedCell_[celli] =
false;
917 changedCells_.clear();
921 handleExplicitConnections();
923 if (hasCyclicPatches_)
926 handleCyclicPatches();
937 Pout<<
" Changed faces : " << changedFaces_.size() <<
endl;
941 label totNChanged = changedFaces_.size();
950 template<
class Type,
class TrackingData>
953 if (hasCyclicPatches_)
956 handleCyclicPatches();
967 while (iter < maxIter)
971 Info<<
" Iteration " << iter <<
endl;
980 Info<<
" Total changed cells : " << nCells <<
endl;
992 Info<<
" Total changed faces : " << nFaces <<
nl
993 <<
" Total evaluations : " << nEvals_ <<
nl
994 <<
" Remaining unvisited cells: " << nUnvisitedCells_ <<
nl
995 <<
" Remaining unvisited faces: " << nUnvisitedFaces_ <<
endl;
Inter-processor communication reduction functions.
#define forAll(list, i)
Loop across all elements in list.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
Wave propagation of information through grid. Every iteration information goes through one layer of c...
UList< Type > & allCellInfo()
Access allCellInfo.
DynamicList< label > changedCells_
void handleExplicitConnections()
Merge data across explicitly provided local connections (usually.
DynamicList< label > changedFaces_
List of changed faces.
void handleProcPatches()
Merge data from across processor boundaries.
label getUnsetCells() const
Get number of unvisited cells, i.e. cells that were not (yet)
void setFaceInfo(const labelList &changedFaces, const List< Type > &changedFacesInfo)
Set initial changed faces.
bool hasPatch() const
Has cyclic patch?
void transform(const polyPatch &patch, const label nFaces, const labelList &faceLabels, const transformer &transform, List< Type > &faceInfo)
Transform across an interface. Implementation referred to Type.
void mergeFaceInfo(const polyPatch &patch, const label nFaces, const labelList &, const List< Type > &)
Merge received patch data into global data.
UList< Type > & allFaceInfo()
Access allFaceInfo.
label getUnsetFaces() const
Get number of unvisited faces.
void checkCyclic(const polyPatch &pPatch) const
Debugging: check info on both sides of cyclic.
virtual label iterate(const label maxIter)
Iterate until no changes or maxIter reached. Returns actual.
void handleCyclicPatches()
Merge data from across cyclics.
bool updateCell(const label celli, const label neighbourFacei, const Type &neighbourInfo, const scalar tol, Type &cellInfo)
Updates cellInfo with information from neighbour. Updates all.
label getChangedPatchFaces(const polyPatch &patch, const label startFacei, const label nFaces, labelList &changedPatchFaces, List< Type > &changedPatchFacesInfo) const
Extract info for single patch only.
virtual label faceToCell()
Propagate from face to cell. Returns total number of cells.
const polyMesh & mesh_
Reference to mesh.
bool updateFace(const label facei, const label neighbourCelli, const Type &neighbourInfo, const scalar tol, Type &faceInfo)
Updates faceInfo with information from neighbour. Updates all.
virtual label cellToFace()
Propagate from cell to face. Returns total number of faces.
FaceCellWave(const polyMesh &, UList< Type > &allFaceInfo, UList< Type > &allCellInfo, TrackingData &td=defaultTrackingData_)
void append(const T &)
Append an element at the end of the list.
void size(const label)
Override size to be inconsistent with allocated storage.
Buffers for inter-processor communications streams (UOPstream, UIPstream).
void finishedSends(const bool block=true)
Mark all sends as having been done. This will start receives.
A List obtained as a section of another List.
Input inter-processor communications stream operating on external buffer.
label size() const
Return the number of elements in the UList.
Output inter-processor communications stream operating on external buffer.
static bool & parRun()
Is this a parallel run?
Holds information regarding type of cell. Used in inside/outside determination in cellClassification.
bool updateCell(const polyMesh &, const label thisCelli, const label neighbourFacei, const cellInfo &neighbourInfo, const scalar tol, TrackingData &td)
Influence of neighbouring face.
bool valid(TrackingData &td) const
Check whether origin has been changed at all or.
A topoSetSource to select a faceSet from cells.
const cyclicPolyPatch & nbrPatch() const
virtual const transformer & transform() const
Return transformation between the coupled patches.
A topoSetSource to select cells based on usage in faces.
Various mesh related information for a parallel run. Upon construction, constructs all info using par...
const labelList & processorPatches() const
Return list of processor patch labels.
const word & name() const
Return name.
Mesh consisting of general polyhedral cells.
A patch is a list of labels that address the faces in the global face list.
label start() const
Return start label of this patch in the polyMesh face list.
const polyBoundaryMesh & boundaryMesh() const
Return boundaryMesh reference.
Neighbour processor patch.
int neighbProcNo() const
Return neighbour processor number.
virtual const transformer & transform() const
Return null transform between processor patches.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
bool valid(const PtrList< ModelType > &l)
const dimensionedScalar e
Elementary charge.
errorManipArg< error, int > exit(error &err, const int errNo=1)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
errorManip< error > abort(error &err)
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
dimensionSet transform(const dimensionSet &)
prefixOSstream Pout(cout, "Pout")
Basic run-time type information using word as the type's name. Used to enhance the standard RTTI to c...