41 template<
class Type,
class TrackingData>
44 template<
class Type,
class TrackingData>
47 template<
class Type,
class TrackingData>
53 template<
class Type,
class TrackingData>
81 if (y.valid(solver_.
data()))
86 meshFacei = patch_.
start() + facei;
114 template<
class Type,
class TrackingData>
118 const label neighbourFacei,
119 const Type& neighbourInfo,
126 bool wasValid = cellInfo.valid(td_);
141 if (!changedCell_[celli])
143 changedCell_[celli] =
true;
144 changedCells_[nChangedCells_++] = celli;
148 if (!wasValid && cellInfo.valid(td_))
162 template<
class Type,
class TrackingData>
166 const label neighbourCelli,
167 const Type& neighbourInfo,
174 bool wasValid = faceInfo.valid(td_);
189 if (!changedFace_[facei])
191 changedFace_[facei] =
true;
192 changedFaces_[nChangedFaces_++] = facei;
196 if (!wasValid && faceInfo.valid(td_))
210 template<
class Type,
class TrackingData>
214 const Type& neighbourInfo,
221 bool wasValid = faceInfo.valid(td_);
235 if (!changedFace_[facei])
237 changedFace_[facei] =
true;
238 changedFaces_[nChangedFaces_++] = facei;
242 if (!wasValid && faceInfo.valid(td_))
252 template<
class Type,
class TrackingData>
259 refCast<const cyclicPolyPatch>(patch).neighbPatch();
268 !allFaceInfo_[i1].sameGeometry
278 <<
" faceInfo:" << allFaceInfo_[i1]
279 <<
" otherfaceInfo:" << allFaceInfo_[i2]
283 if (changedFace_[i1] != changedFace_[i2])
286 <<
" faceInfo:" << allFaceInfo_[i1]
287 <<
" otherfaceInfo:" << allFaceInfo_[i2]
288 <<
" changedFace:" << changedFace_[i1]
289 <<
" otherchangedFace:" << changedFace_[i2]
297 template<
class Type,
class TrackingData>
298 template<
class PatchType>
303 if (isA<PatchType>(mesh_.boundaryMesh()[
patchi]))
313 template<
class Type,
class TrackingData>
320 forAll(changedFaces, changedFacei)
322 label facei = changedFaces[changedFacei];
324 bool wasValid = allFaceInfo_[facei].valid(td_);
327 allFaceInfo_[facei] = changedFacesInfo[changedFacei];
330 if (!wasValid && allFaceInfo_[facei].valid(td_))
337 changedFace_[facei] =
true;
338 changedFaces_[nChangedFaces_++] = facei;
344 template<
class Type,
class TrackingData>
353 for (
label changedFacei = 0; changedFacei < nFaces; changedFacei++)
355 const Type& neighbourWallInfo = changedFacesInfo[changedFacei];
356 label patchFacei = changedFaces[changedFacei];
360 Type& currentWallInfo = allFaceInfo_[meshFacei];
362 if (!currentWallInfo.equal(neighbourWallInfo, td_))
379 template<
class Type,
class TrackingData>
383 const label startFacei,
389 label nChangedPatchFaces = 0;
391 for (
label i = 0; i < nFaces; i++)
393 label patchFacei = i + startFacei;
397 if (changedFace_[meshFacei])
399 changedPatchFaces[nChangedPatchFaces] = patchFacei;
400 changedPatchFacesInfo[nChangedPatchFaces] = allFaceInfo_[meshFacei];
401 nChangedPatchFaces++;
404 return nChangedPatchFaces;
409 template<
class Type,
class TrackingData>
420 for (
label i = 0; i < nFaces; i++)
422 label patchFacei = faceLabels[i];
425 faceInfo[i].leaveDomain(mesh_, patch, patchFacei, fc[meshFacei], td_);
431 template<
class Type,
class TrackingData>
442 for (
label i = 0; i < nFaces; i++)
444 label patchFacei = faceLabels[i];
447 faceInfo[i].enterDomain(mesh_, patch, patchFacei, fc[meshFacei], td_);
453 template<
class Type,
class TrackingData>
461 if (rotTensor.
size() == 1)
463 const tensor&
T = rotTensor[0];
465 for (
label facei = 0; facei < nFaces; facei++)
467 faceInfo[facei].transform(mesh_, T, td_);
472 for (
label facei = 0; facei < nFaces; facei++)
474 faceInfo[facei].transform(mesh_, rotTensor[facei], td_);
481 template<
class Type,
class TrackingData>
485 const label cycOffset,
490 for (
label facei = 0; facei < nFaces; facei++)
492 faces[facei] += cycOffset;
498 template<
class Type,
class TrackingData>
515 refCast<const processorPolyPatch>(mesh_.boundaryMesh()[
patchi]);
523 nSendFaces = getChangedPatchFaces
543 Pout<<
" Processor patch " << patchi <<
' ' << procPatch.
name()
545 <<
" Sending:" << nSendFaces
565 refCast<const processorPolyPatch>(mesh_.boundaryMesh()[
patchi]);
573 fromNeighbour >> receiveFaces >> receiveFacesInfo;
578 Pout<<
" Processor patch " << patchi <<
' ' << procPatch.
name()
580 <<
" Receiving:" << receiveFaces.size()
617 template<
class Type,
class TrackingData>
624 if (isA<cyclicPolyPatch>(patch))
627 refCast<const cyclicPolyPatch>(patch).neighbPatch();
635 nReceiveFaces = getChangedPatchFaces
654 refCast<const cyclicPolyPatch>(patch);
670 <<
" Changed : " << nReceiveFaces
694 checkCyclic(cycPatch);
702 template<
class Type,
class TrackingData>
709 if (isA<cyclicAMIPolyPatch>(patch))
712 refCast<const cyclicAMIPolyPatch>(patch);
718 refCast<const cyclicAMIPolyPatch>(patch).neighbPatch();
735 sendInfo[i].leaveDomain(mesh_, nbrPatch, i, fc[i], td_);
749 cycPatch.
interpolate(sendInfo, cmb, receiveInfo, defVals);
774 receiveInfo[i].enterDomain(mesh_, cycPatch, i, fc[i], td_);
783 Type& currentWallInfo = allFaceInfo_[meshFacei];
787 receiveInfo[i].valid(td_)
788 && !currentWallInfo.equal(receiveInfo[i], td_)
808 template<
class Type,
class TrackingData>
818 allFaceInfo_(allFaceInfo),
819 allCellInfo_(allCellInfo),
821 changedFace_(mesh_.nFaces(),
false),
822 changedFaces_(mesh_.nFaces()),
824 changedCell_(mesh_.nCells(),
false),
825 changedCells_(mesh_.nCells()),
827 hasCyclicPatches_(hasPatch<cyclicPolyPatch>()),
833 nUnvisitedCells_(mesh_.nCells()),
834 nUnvisitedFaces_(mesh_.nFaces())
838 allFaceInfo.
size() != mesh_.nFaces()
839 || allCellInfo.
size() != mesh_.nCells()
843 <<
"face and cell storage not the size of mesh faces, cells:" 845 <<
" allFaceInfo :" << allFaceInfo.
size() <<
endl 846 <<
" mesh_.nFaces():" << mesh_.nFaces() <<
endl 847 <<
" allCellInfo :" << allCellInfo.
size() <<
endl 848 <<
" mesh_.nCells():" << mesh_.nCells()
856 template<
class Type,
class TrackingData>
869 allFaceInfo_(allFaceInfo),
870 allCellInfo_(allCellInfo),
872 changedFace_(mesh_.nFaces(),
false),
873 changedFaces_(mesh_.nFaces()),
875 changedCell_(mesh_.nCells(),
false),
876 changedCells_(mesh_.nCells()),
878 hasCyclicPatches_(hasPatch<cyclicPolyPatch>()),
884 nUnvisitedCells_(mesh_.nCells()),
885 nUnvisitedFaces_(mesh_.nFaces())
889 allFaceInfo.
size() != mesh_.nFaces()
890 || allCellInfo.
size() != mesh_.nCells()
894 <<
"face and cell storage not the size of mesh faces, cells:" 896 <<
" allFaceInfo :" << allFaceInfo.
size() <<
endl 897 <<
" mesh_.nFaces():" << mesh_.nFaces() <<
endl 898 <<
" allCellInfo :" << allCellInfo.
size() <<
endl 899 <<
" mesh_.nCells():" << mesh_.nCells()
904 setFaceInfo(changedFaces, changedFacesInfo);
907 label iter = iterate(maxIter);
909 if ((maxIter > 0) && (iter >= maxIter))
912 <<
"Maximum number of iterations reached. Increase maxIter." <<
endl 913 <<
" maxIter:" << maxIter <<
endl 914 <<
" nChangedCells:" << nChangedCells_ <<
endl 915 <<
" nChangedFaces:" << nChangedFaces_ <<
endl 924 template<
class Type,
class TrackingData>
927 return nUnvisitedCells_;
931 template<
class Type,
class TrackingData>
934 return nUnvisitedFaces_;
940 template<
class Type,
class TrackingData>
943 const labelList& owner = mesh_.faceOwner();
944 const labelList& neighbour = mesh_.faceNeighbour();
945 label nInternalFaces = mesh_.nInternalFaces();
949 label changedFacei = 0;
950 changedFacei < nChangedFaces_;
954 label facei = changedFaces_[changedFacei];
955 if (!changedFace_[facei])
959 <<
" not marked as having been changed" 964 const Type& neighbourWallInfo = allFaceInfo_[facei];
969 label celli = owner[facei];
970 Type& currentWallInfo = allCellInfo_[celli];
972 if (!currentWallInfo.equal(neighbourWallInfo, td_))
985 if (facei < nInternalFaces)
987 celli = neighbour[facei];
988 Type& currentWallInfo2 = allCellInfo_[celli];
990 if (!currentWallInfo2.equal(neighbourWallInfo, td_))
1004 changedFace_[facei] =
false;
1012 Pout<<
" Changed cells : " << nChangedCells_ <<
endl;
1016 label totNChanged = nChangedCells_;
1025 template<
class Type,
class TrackingData>
1032 label changedCelli = 0;
1033 changedCelli < nChangedCells_;
1037 label celli = changedCells_[changedCelli];
1038 if (!changedCell_[celli])
1041 <<
"Cell " << celli <<
" not marked as having been changed" 1045 const Type& neighbourWallInfo = allCellInfo_[celli];
1049 const labelList& faceLabels = cells[celli];
1050 forAll(faceLabels, faceLabelI)
1052 label facei = faceLabels[faceLabelI];
1053 Type& currentWallInfo = allFaceInfo_[facei];
1055 if (!currentWallInfo.equal(neighbourWallInfo, td_))
1069 changedCell_[celli] =
false;
1075 if (hasCyclicPatches_)
1078 handleCyclicPatches();
1081 if (hasCyclicAMIPatches_)
1083 handleAMICyclicPatches();
1089 handleProcPatches();
1094 Pout<<
" Changed faces : " << nChangedFaces_ <<
endl;
1098 label totNChanged = nChangedFaces_;
1107 template<
class Type,
class TrackingData>
1110 if (hasCyclicPatches_)
1113 handleCyclicPatches();
1116 if (hasCyclicAMIPatches_)
1118 handleAMICyclicPatches();
1124 handleProcPatches();
1129 while (iter < maxIter)
1133 Info<<
" Iteration " << iter <<
endl;
1142 Info<<
" Total changed cells : " << nCells <<
endl;
1154 Info<<
" Total changed faces : " << nFaces <<
nl 1155 <<
" Total evaluations : " << nEvals_ <<
nl 1156 <<
" Remaining unvisited cells: " << nUnvisitedCells_ <<
nl 1157 <<
" Remaining unvisited faces: " << nUnvisitedFaces_ <<
endl;
const TrackingData & data() const
Additional data to be passed into container.
#define forAll(list, i)
Loop across all elements in list.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Inter-processor communication reduction functions.
void finishedSends(const bool block=true)
Mark all sends as having been done. This will start receives.
label iterate(const label maxIter)
Iterate until no changes or maxIter reached. Returns actual.
errorManipArg< error, int > exit(error &err, const int errNo=1)
void setFaceInfo(const labelList &changedFaces, const List< Type > &changedFacesInfo)
Set initial changed faces.
label cellToFace()
Propagate from cell to face. Returns total number of faces.
label getUnsetCells() const
Get number of unvisited cells, i.e. cells that were not (yet)
const List< T >::subList patchSlice(const UList< T > &l) const
Slice list to patch.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Various mesh related information for a parallel run. Upon construction, constructs all info using par...
int neighbProcNo() const
Return neigbour processor number.
void size(const label)
Override size to be inconsistent with allocated storage.
static scalar propagationTol()
Access to tolerance.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Wave propagation of information through grid. Every iteration information goes through one layer of c...
bool applyLowWeightCorrection() const
Return true if applying the low weight correction.
const labelList & processorPatches() const
Return list of processor patch labels.
Holds information regarding type of cell. Used in inside/outside determination in cellClassification...
Pre-declare related SubField type.
Neighbour processor patch.
A topoSetSource to select a faceSet from cells.
Input inter-processor communications stream operating on external buffer.
const UIndirectList< T > patchInternalList(const UList< T > &internalValues) const
Extract face cell data.
virtual bool separated() const
Are the planes separated.
A List obtained as a section of another List.
const dimensionedScalar e
Elementary charge.
label start() const
Return start label of this patch in the polyMesh face list.
A topoSetSource to select cells based on usage in faces.
virtual bool owner() const
Does this side own the patch?
virtual bool parallel() const
Are the cyclic planes parallel.
Cyclic patch for Arbitrary Mesh Interface (AMI)
const word & name() const
Return name.
errorManip< error > abort(error &err)
Output inter-processor communications stream operating on external buffer.
prefixOSstream Pout(cout,"Pout")
Buffers for inter-processor communications streams (UOPstream, UIPstream).
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
tmp< Field< Type > > interpolate(const Field< Type > &fld, const UList< Type > &defaultValues=UList< Type >()) const
Interpolate field.
label size() const
Return the number of elements in the UList.
static bool & parRun()
Is this a parallel run?
combine(FaceCellWave< Type, TrackingData > &solver, const cyclicAMIPolyPatch &patch)
virtual const tensorField & forwardT() const
Return face transformation tensor.
label getUnsetFaces() const
Get number of unvisited faces.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
Mesh consisting of general polyhedral cells.
const vectorField::subField faceCentres() const
Return face centres.
A patch is a list of labels that address the faces in the global face list.
Combine operator for AMIInterpolation.
const polyBoundaryMesh & boundaryMesh() const
Return boundaryMesh reference.
const polyMesh & mesh() const
Access mesh.
virtual const cyclicAMIPolyPatch & neighbPatch() const
Return a reference to the neighbour patch.
dimensionSet transform(const dimensionSet &)
label faceToCell()
Propagate from face to cell. Returns total number of cells.