36 template<
class Type,
class TrackingData>
39 template<
class Type,
class TrackingData>
42 template<
class Type,
class TrackingData>
48 template<
class Type,
class TrackingData>
49 template<
class ListList>
65 template<
class Type,
class TrackingData>
66 template<
class ListList,
class Value>
73 ListList ll(
s.size());
76 ll[i] =
typename ListList::value_type(
s[i], value);
84 template<
class Type,
class TrackingData>
91 patchAndFacei.
first() == -1
92 ? internalFaceInfo_[patchAndFacei.
second()]
93 : patchFaceInfo_[patchAndFacei.
first()][patchAndFacei.
second()];
97 template<
class Type,
class TrackingData>
104 patchAndFacei.
first() == -1
105 ? internalFaceInfo_[patchAndFacei.
second()]
106 : patchFaceInfo_[patchAndFacei.
first()][patchAndFacei.
second()];
110 template<
class Type,
class TrackingData>
118 patchAndFacei.
first() == -1
119 ? internalFaceChanged_[patchAndFacei.
second()]
120 : patchFaceChanged_[patchAndFacei.
first()][patchAndFacei.
second()];
124 template<
class Type,
class TrackingData>
125 Foam::PackedBoolList::iteratorBase
132 patchAndFacei.
first() == -1
133 ? internalFaceChanged_[patchAndFacei.
second()]
134 : patchFaceChanged_[patchAndFacei.
first()][patchAndFacei.
second()];
138 template<
class Type,
class TrackingData>
143 const Type& neighbourInfo,
153 neighbourPatchAndFacei,
161 if (!cellChanged_[celli])
163 cellChanged_[celli] =
true;
164 changedCells_.append(celli);
172 template<
class Type,
class TrackingData>
176 const label neighbourCelli,
177 const Type& neighbourInfo,
195 PackedBoolList::iteratorBase changed = faceChanged(patchAndFacei);
200 changedPatchAndFaces_.append(patchAndFacei);
208 template<
class Type,
class TrackingData>
212 const Type& neighbourInfo,
229 PackedBoolList::iteratorBase changed = faceChanged(patchAndFacei);
234 changedPatchAndFaces_.append(patchAndFacei);
242 template<
class Type,
class TrackingData>
249 refCast<const cyclicFvPatch>(patch).
nbrPatch();
253 const Type& info = faceInfo({patch.
index(), patchFacei});
254 const Type& nbrInfo = faceInfo({nbrPatch.
index(), patchFacei});
256 const bool changed = faceChanged({patch.
index(), patchFacei});
257 const bool nbrChanged = faceChanged({nbrPatch.
index(), patchFacei});
259 if (!info.sameGeometry(mesh_, nbrInfo, geomTol_, td_))
262 <<
" faceInfo:" << info
263 <<
" otherfaceInfo:" << nbrInfo
267 if (changed != nbrChanged)
270 <<
" faceInfo:" << info
271 <<
" otherfaceInfo:" << nbrInfo
272 <<
" changedFace:" << changed
273 <<
" otherchangedFace:" << nbrChanged
280 template<
class Type,
class TrackingData>
281 template<
class PatchType>
286 if (isA<PatchType>(mesh_.boundary()[
patchi]))
296 template<
class Type,
class TrackingData>
305 for (
label changedFacei = 0; changedFacei < nFaces; changedFacei ++)
307 const label patchFacei = changedPatchFaces[changedFacei];
309 Type& info = faceInfo({patch.
index(), patchFacei});
310 const Type& neighbourInfo = changedPatchFacesInfo[changedFacei];
312 if (!info.equal(neighbourInfo, td_))
316 {patch.
index(), patchFacei},
326 template<
class Type,
class TrackingData>
342 if (patchFaceChanged_[patch.
index()][patchFacei])
344 changedPatchFaces[i] = patchFacei;
345 changedPatchFacesInfo[i] = faceInfo({patch.
index(), patchFacei});
354 template<
class Type,
class TrackingData>
364 for (
label i = 0; i < nFaces; i++)
366 faceInfo[i].transform(patch, patchFaces[i],
transform, td_);
371 template<
class Type,
class TrackingData>
377 const labelList& procPatches = mesh_.globalData().processorPatches();
386 refCast<const processorFvPatch>(mesh_.boundary()[
patchi]);
406 <<
" Sending:" << nSendFaces
425 refCast<const processorFvPatch>(mesh_.boundary()[
patchi]);
434 fromNeighbour >> receiveFaces >> receiveFacesInfo;
441 <<
" Receiving:" << receiveFaces.
size()
467 template<
class Type,
class TrackingData>
477 if (!isA<cyclicFvPatch>(patch))
continue;
479 const cyclicFvPatch& cycPatch = refCast<const cyclicFvPatch>(patch);
499 <<
" Changed : " << nReceiveFaces
524 checkCyclic(cycPatch);
532 template<
class Type,
class TrackingData>
543 internalFaceInfo_(internalFaceInfo),
544 patchFaceInfo_(patchFaceInfo),
549 mesh_.nInternalFaces(),
565 changedPatchAndFaces_(mesh_.nInternalFaces()),
566 changedCells_(mesh_.nCells()),
577 <<
"Storage does not match the size of the mesh:" <<
endl
591 template<
class Type,
class TrackingData>
614 setFaceInfo(initialChangedPatchAndFaces, initialChangedFacesInfo);
620 if ((maxIter > 0) && (iter >= maxIter))
623 <<
"Maximum number of iterations reached. Increase maxIter." <<
endl
624 <<
" maxIter:" << maxIter <<
endl
634 template<
class Type,
class TrackingData>
641 forAll(changedPatchAndFaces, i)
643 const labelPair& patchAndFacei = changedPatchAndFaces[i];
645 Type& info = faceInfo(patchAndFacei);
646 PackedBoolList::iteratorBase changed = faceChanged(patchAndFacei);
649 info = changedFacesInfo[i];
653 changedPatchAndFaces_.
append(patchAndFacei);
658 template<
class Type,
class TrackingData>
662 const labelList& neighbour = mesh_.neighbour();
664 forAll(changedPatchAndFaces_, changedFacei)
666 const labelPair& patchAndFacei = changedPatchAndFaces_[changedFacei];
670 if (!faceChanged(patchAndFacei))
673 <<
"Patch and face " << patchAndFacei
674 <<
" not marked as having been changed"
678 const Type& info = faceInfo(patchAndFacei);
682 const label ownerCelli =
685 : mesh_.boundary()[
patchi].faceCells()[facei];
687 Type& ownerInfo = cellInfo_[ownerCelli];
689 if (!ownerInfo.equal(info, td_))
705 const label neighbourCelli = neighbour[facei];
707 Type& neighbourInfo = cellInfo_[neighbourCelli];
709 if (!neighbourInfo.equal(info, td_))
723 faceChanged(patchAndFacei) =
false;
727 changedPatchAndFaces_.
clear();
731 Pout<<
" Changed cells : " << changedCells_.size() <<
endl;
738 template<
class Type,
class TrackingData>
743 forAll(changedCells_, changedCelli)
745 const label celli = changedCells_[changedCelli];
747 if (!cellChanged_[celli])
750 <<
"Cell " << celli <<
" not marked as having been changed"
754 const Type& info = cellInfo_[celli];
764 if (polyFacei < mesh_.nInternalFaces())
766 static label noPatchi = -1;
772 const label polyBFacei = polyFacei - mesh_.nInternalFaces();
773 patches.shallowCopy(mesh_.polyBFacePatches()[polyBFacei]);
774 faces.
shallowCopy(mesh_.polyBFacePatchFaces()[polyBFacei]);
780 Type& connectedInfo = faceInfo({
patches[i], faces[i]});
782 if (!connectedInfo.equal(info, td_))
797 cellChanged_[celli] =
false;
801 changedCells_.clear();
803 if (hasCyclicPatches_)
806 handleCyclicPatches();
817 Pout<<
" Changed faces : "
818 << changedPatchAndFaces_.size() <<
endl;
825 template<
class Type,
class TrackingData>
831 if (hasCyclicPatches_)
834 handleCyclicPatches();
845 while (iter < maxIter)
847 if (debug)
Info<<
" Iteration " << iter <<
endl;
851 if (debug)
Info<<
" Total changed cells : " << nCells <<
endl;
860 if (debug)
Info<<
" Total changed faces : " << nFaces <<
nl;
Inter-processor communication reduction functions.
#define forAll(list, i)
Loop across all elements in list.
Wave propagation of information through grid. Every iteration information goes through one layer of c...
DynamicList< labelPair > changedPatchAndFaces_
List of changed patch and faces.
DynamicList< label > changedCells_
List of changed cells.
void setFaceInfo(const List< labelPair > &changedPatchAndFaces, const List< Type > &changedFacesInfo)
Set initial changed faces.
void mergeFaceInfo(const fvPatch &patch, const label nFaces, const labelList &, const List< Type > &)
Merge received patch data into global data.
const fvMesh & mesh_
Reference to mesh.
label getChangedPatchFaces(const fvPatch &patch, labelList &changedPatchFaces, List< Type > &changedPatchFacesInfo) const
Extract info for single patch only.
void handleProcPatches()
Merge data from across processor boundaries.
static labelList listListSizes(const ListList &ll)
...
bool updateFace(const labelPair &patchAndFacei, const label neighbourCelli, const Type &neighbourInfo, const scalar tol, Type &faceInfo)
Updates faceInfo with information from neighbour. Updates all.
bool hasPatch() const
Has cyclic patch?
void checkCyclic(const fvPatch &patch) const
Debugging: check info on both sides of cyclic.
const Type & faceInfo(const labelPair &patchAndFacei) const
...
bool faceChanged(const labelPair &patchAndFacei) const
...
void transform(const fvPatch &patch, const label nFaces, const labelList &patchFaces, const transformer &transform, List< Type > &faceInfo)
Transform across an interface.
virtual label iterate(const label maxIter)
Iterate until no changes or maxIter reached. Returns actual.
void handleCyclicPatches()
Merge data from across cyclics.
FvFaceCellWave(const fvMesh &mesh, List< Type > &internalFaceInfo, List< List< Type >> &patchFaceInfo, List< Type > &cellInfo, TrackingData &td=defaultTrackingData_)
static ListList sizesListList(const labelList &s, const Value &value)
...
bool updateCell(const label celli, const labelPair &neighbourPatchAndFacei, const Type &neighbourInfo, const scalar tol, Type &cellInfo)
Updates cellInfo with information from neighbour. Updates all.
virtual label faceToCell()
Propagate from face to cell. Returns total number of cells.
List< List< Type > > & patchFaceInfo()
Access patchFaceInfo.
virtual label cellToFace()
Propagate from cell to face. Returns total number of faces.
List< Type > & internalFaceInfo()
Access internalFaceInfo.
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.
void clear()
Clear the list, i.e. set size to zero.
const Type & second() const
Return second.
const Type & first() const
Return first.
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.
void shallowCopy(const UList< T > &)
Copy the pointer held by the given 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.
A topoSetSource to select a faceSet from cells.
virtual const transformer & transform() const
Return transformation between the coupled patches.
virtual const cyclicFvPatch & nbrPatch() const
Return processor number.
A topoSetSource to select cells based on usage in faces.
Mesh data needed to do the Finite Volume discretisation.
const fvBoundaryMesh & boundary() const
Return reference to boundary mesh.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
virtual label size() const
Return size.
label index() const
Return the index of this patch in the fvBoundaryMesh.
virtual const word & name() const
Return name.
label nInternalFaces() const
virtual const transformer & transform() const
Return transformation between the coupled patches.
virtual int neighbProcNo() const
Return neighbour processor number.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.name(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
const fvPatchList & patches
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)
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
dimensionSet transform(const dimensionSet &)
prefixOSstream Pout(cout, "Pout")
UList< label > labelUList
faceListList boundary(nPatches)