46 template<
class Type,
class TrackingData>
76 if (
y.valid(solver_.
data()))
81 meshFacei = patch_.
start() + facei;
92 solver_.propagationTol(),
99 template<
class Type,
class TrackingData>
104 FaceCellWave<Type, TrackingData>& solver_;
106 const cyclicAMIPolyPatch& patch_;
124 const label localFacei,
132 if (
y0.valid(solver_.data()))
134 if (
y1.valid(solver_.data()))
139 patch_.faceCentres()[localFacei],
145 solver_.propagationTol(),
152 label meshFacei = -1;
155 meshFacei = patch_.start() + f0i;
159 meshFacei = patch_.neighbPatch().start() + f0i;
166 solver_.propagationTol(),
171 else if (
y1.valid(solver_.data()))
174 label meshFacei = -1;
177 meshFacei = patch_.start() + f1i;
181 meshFacei = patch_.neighbPatch().start() + f1i;
188 solver_.propagationTol(),
199template<
class Type,
class TrackingData>
203 const label neighbourFacei,
204 const Type& neighbourInfo,
219 const bool propagate =
247template<
class Type,
class TrackingData>
251 const label neighbourCelli,
252 const Type& neighbourInfo,
265 const bool wasValid = faceInfo.valid(
td_);
267 const bool propagate =
286 if (!wasValid && faceInfo.valid(td_))
295template<
class Type,
class TrackingData>
299 const Type& neighbourInfo,
312 const bool wasValid = faceInfo.valid(
td_);
314 const bool propagate =
332 if (!wasValid && faceInfo.valid(td_))
341template<
class Type,
class TrackingData>
354 const label i1 = patch.start() + patchFacei;
355 const label i2 = nbrPatch.
start() + patchFacei;
374 if (changedFace_.test(i1) != changedFace_.test(i2))
377 <<
" faceInfo:" << allFaceInfo_[i1]
387template<
class Type,
class TrackingData>
388template<
class PatchType>
402template<
class Type,
class TrackingData>
421 changedFace_.set(facei);
422 changedFaces_.push_back(facei);
426template<
class Type,
class TrackingData>
433 forAll(changedFaces, changedFacei)
435 const label facei = changedFaces[changedFacei];
455template<
class Type,
class TrackingData>
466 for (label changedFacei = 0; changedFacei < nFaces; ++changedFacei)
468 const Type& newInfo = changedFacesInfo[changedFacei];
469 const label patchFacei = changedFaces[changedFacei];
471 const label meshFacei = patch.start() + patchFacei;
475 if (!currInfo.equal(newInfo,
td_))
489template<
class Type,
class TrackingData>
493 const label startFacei,
504 for (label i = 0; i < nFaces; ++i)
506 const label patchFacei = i + startFacei;
507 const label meshFacei = patch.start() + patchFacei;
511 changedPatchFaces[nChanged] = patchFacei;
512 changedPatchFacesInfo[nChanged] =
allFaceInfo_[meshFacei];
521template<
class Type,
class TrackingData>
534 for (label i = 0; i < nFaces; ++i)
537 const label meshFacei = patch.start() + patchFacei;
539 faceInfo[i].leaveDomain(
mesh_, patch, patchFacei, fc[meshFacei],
td_);
544template<
class Type,
class TrackingData>
557 for (label i = 0; i < nFaces; ++i)
560 const label meshFacei = patch.start() + patchFacei;
562 faceInfo[i].enterDomain(
mesh_, patch, patchFacei, fc[meshFacei],
td_);
567template<
class Type,
class TrackingData>
577 if (rotTensor.
size() == 1)
579 const tensor&
T = rotTensor[0];
581 for (label facei = 0; facei < nFaces; ++facei)
583 faceInfo[facei].transform(
mesh_,
T,
td_);
588 for (label facei = 0; facei < nFaces; ++facei)
590 faceInfo[facei].transform(
mesh_, rotTensor[facei],
td_);
596template<
class Type,
class TrackingData>
600 const label cycOffset,
608 for (label facei = 0; facei < nFaces; ++facei)
610 faces[facei] += cycOffset;
615template<
class Type,
class TrackingData>
635 pBufs_.initRegisterSend();
642 for (
const label patchi : procPatches)
644 const auto& procPatch =
647 const label nbrProci = procPatch.neighbProcNo();
664 sendFaces.
resize(nSendFaces);
665 sendFacesInfo.
resize(nSendFaces);
679 toNbr << sendFaces << sendFacesInfo;
686 Pout<<
" Processor patch " << patchi <<
' ' << procPatch.name()
687 <<
" send:" << sendFaces.
size() <<
" to proc:" << nbrProci
695 pBufs_.finishedNeighbourSends(neighbourProcs);
698 for (
const label patchi : procPatches)
700 const auto& procPatch =
703 const label nbrProci = procPatch.neighbProcNo();
705 if (!
pBufs_.recvDataCount(nbrProci))
716 is >> receiveFaces >> receiveFacesInfo;
719 const label nReceiveFaces = receiveFaces.
size();
723 Pout<<
" Processor patch " << patchi <<
' ' << procPatch.name()
724 <<
" recv:" << receiveFaces.
size() <<
" from proci:"
729 if (!procPatch.parallel())
733 procPatch.forwardT(),
760template<
class Type,
class TrackingData>
771 const auto& cycPatch = *cpp;
797 if (!cycPatch.parallel())
810 Pout<<
" Cyclic patch "
811 << cycPatch.index() <<
' ' << cycPatch.name()
812 <<
" Changed : " << nReceiveFaces
843template<
class Type,
class TrackingData>
860 const auto& cycPatch = *cpp;
876 sendInfo[i].leaveDomain(
mesh_, nbrPatch, i, fc[i],
td_);
890 : cycPatch.neighbPatch().AMI()
893 if (cycPatch.applyLowWeightCorrection())
925 if (!cycPatch.parallel())
935 if (!cycPatch.parallel() || cycPatch.separated())
941 receiveInfo[i].enterDomain(
mesh_, cycPatch, i, fc[i],
td_);
947 const auto areaFraction(patch.areaFraction());
951 if (areaFraction && areaFraction()[i] <= 0.5)
957 const label meshFacei = cycPatch.start()+i;
959 const Type& newInfo = receiveInfo[i];
963 if (newInfo.valid(
td_) && !currInfo.equal(newInfo,
td_))
979template<
class Type,
class TrackingData>
987 const label f0 = baffle.first();
988 const label f1 = baffle.second();
1008 const label tgtFace = updated.first;
1009 const Type& newInfo = updated.second;
1013 if (!currInfo.equal(newInfo,
td_))
1031template<
class Type,
class TrackingData>
1060 FatalErrorInFunction
1061 <<
"face and cell storage not the size of mesh faces, cells:" << nl
1062 <<
" allFaceInfo :" << allFaceInfo.size() << nl
1063 <<
" mesh_.nFaces():" << mesh_.nFaces() << nl
1064 <<
" allCellInfo :" << allCellInfo.size() << nl
1065 <<
" mesh_.nCells():" << mesh_.nCells() << endl
1066 << exit(FatalError);
1071template<
class Type,
class TrackingData>
1079 const label maxIter,
1103 FatalErrorInFunction
1104 <<
"face and cell storage not the size of mesh faces, cells:" << nl
1105 <<
" allFaceInfo :" << allFaceInfo.size() << nl
1106 <<
" mesh_.nFaces():" << mesh_.nFaces() << nl
1107 <<
" allCellInfo :" << allCellInfo.size() << nl
1108 <<
" mesh_.nCells():" << mesh_.nCells() << endl
1109 << exit(FatalError);
1116 const label iter =
iterate(maxIter);
1118 if ((maxIter > 0) && (iter >= maxIter))
1121 <<
"Maximum number of iterations reached. Increase maxIter." <<
nl
1122 <<
" maxIter:" << maxIter <<
nl
1130template<
class Type,
class TrackingData>
1135 const bool handleCyclicAMI,
1140 const label maxIter,
1165 FatalErrorInFunction
1166 <<
"face and cell storage not the size of mesh faces, cells:" << nl
1167 <<
" allFaceInfo :" << allFaceInfo.size() << nl
1168 <<
" mesh_.nFaces():" << mesh_.nFaces() << nl
1169 <<
" allCellInfo :" << allCellInfo.size() << nl
1170 <<
" mesh_.nCells():" << mesh_.nCells() << endl
1171 << exit(FatalError);
1178 const label iter =
iterate(maxIter);
1180 if ((maxIter > 0) && (iter >= maxIter))
1183 <<
"Maximum number of iterations reached. Increase maxIter." <<
nl
1184 <<
" maxIter:" << maxIter <<
nl
1194template<
class Type,
class TrackingData>
1201 const label nInternalFaces =
mesh_.nInternalFaces();
1209 <<
" not marked as having been changed"
1219 const label celli = owner[facei];
1222 if (!currInfo.equal(newInfo,
td_))
1236 if (facei < nInternalFaces)
1238 const label celli = neighbour[facei];
1241 if (!currInfo.equal(newInfo,
td_))
1271template<
class Type,
class TrackingData>
1283 <<
"Cell " << celli <<
" not marked as having been changed"
1296 if (!currInfo.equal(newInfo,
td_))
1347template<
class Type,
class TrackingData>
1372 for (; iter < maxIter; ++iter)
1376 Info<<
" Iteration " << iter <<
endl;
1381 const label nFaces = nCells ?
cellToFace() : 0;
1385 Info<<
" Total evaluations : "
1387 <<
" Changed cells / faces : "
1388 << nCells <<
" / " << nFaces <<
nl
1389 <<
" Pending cells / faces : "
1393 if (!nCells || !nFaces)
Inter-processor communication reduction functions.
labelList faceLabels(nFaceLabels)
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
void resize_nocopy(const label len)
Alter addressable list size, allocating new space if required without necessarily recovering old cont...
void resize(const label len)
Alter addressable list size, allocating new space if required while recovering old content.
label nChangedFaces() const noexcept
Current number of changed faces.
DynamicList< label > changedCells_
List of changed cells.
DynamicList< label > changedFaces_
List of changed faces.
bitSet changedFace_
Track if face has changed.
PstreamBuffers pBufs_
Buffers when updating processor patches.
static scalar propagationTol_
FaceCellWaveBase(const polyMesh &mesh)
Construct with mesh reference and set initial sizes.
static const scalar geomTol_
label nUnvisitedFaces_
Current count of unvisited faces.
label nChangedCells() const noexcept
Current number of changed cells.
label nUnvisitedCells_
Current count of unvisited cells.
bitSet changedCell_
Track if cell has changed.
const polyMesh & mesh() const noexcept
Return access to the mesh.
const polyMesh & mesh_
Reference to mesh.
Wave propagation of information through grid. Every iteration information goes through one layer of c...
void handleExplicitConnections()
Merge data across explicitly provided local connections.
UList< Type > & allCellInfo_
Information for all cells.
UList< Type > & allFaceInfo_
void mergeFaceInfo(const polyPatch &patch, const label nFaces, const labelUList &changedFaces, const UList< Type > &changedFacesInfo)
Merge received patch data into global data.
void handleProcPatches()
Merge data from across processor boundaries.
label nEvals_
Number of evaluations.
DynamicList< taggedInfoType > changedBaffles_
FaceCellWave(const FaceCellWave &)=delete
No copy construct.
bool hasPatch() const
Has cyclic patch?
void leaveDomain(const polyPatch &patch, const label nFaces, const labelUList &faceLabels, UList< Type > &faceInfo) const
Handle leaving domain. Implementation referred to Type.
TrackingData & td_
Additional data to be passed into container.
const TrackingData & data() const noexcept
Additional data to be passed into container.
static void offset(const polyPatch &patch, const label off, const label nFaces, labelUList &faces)
Offset face labels by constant value.
void handleAMICyclicPatches()
Merge data from across AMI cyclics.
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.
void handleCyclicPatches()
Merge data from across cyclics.
void setFaceInfo(const label facei, const Type &faceInfo)
Set single initial changed face.
label getChangedPatchFaces(const polyPatch &patch, const label startFacei, const label nFaces, labelUList &changedPatchFaces, UList< Type > &changedPatchFacesInfo) const
Extract info for single patch only.
void enterDomain(const polyPatch &patch, const label nFaces, const labelUList &faceLabels, UList< Type > &faceInfo) const
Handle leaving domain. Implementation referred to Type.
bool updateCell(const label celli, const label neighbourFacei, const Type &neighbourInfo, const scalar tol, Type &cellInfo)
Updates cellInfo with information from neighbour.
const labelPairList explicitConnections_
Optional boundary faces that information should travel through.
void transform(const tensorField &rotTensor, const label nFaces, UList< Type > &faceInfo)
Apply transformation to Type.
const bool hasCyclicAMIPatches_
Contains cyclicAMI.
virtual label faceToCell()
Propagate from face to cell.
UList< Type > & allFaceInfo() noexcept
Access allFaceInfo.
bool updateFace(const label facei, const label neighbourCelli, const Type &neighbourInfo, const scalar tol, Type &faceInfo)
Updates faceInfo with information from neighbour.
std::pair< label, Type > taggedInfoType
Information tagged with a source or destination id.
virtual label cellToFace()
Propagate from cell to face.
UList< Type > & allCellInfo() noexcept
Access allCellInfo.
const bool hasCyclicPatches_
Contains cyclics.
SubField< vector > subField
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Input inter-processor communications stream using MPI send/recv etc. - operating on external buffer.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
bool empty() const noexcept
True if List is empty (ie, size() is zero).
static const UList< T > & null() noexcept
Return a null UList (reference to a nullObject). Behaves like an empty UList.
void size(const label n)
Older name for setAddressableSize.
Output inter-processor communications stream using MPI send/recv etc. - operating on external buffer.
static bool parRun(const bool on) noexcept
Set as parallel run on/off.
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
Changed or contains original (invalid) value.
combine(FaceCellWave< Type, TrackingData > &solver, const cyclicAMIPolyPatch &patch)
virtual bool separated() const
Are the planes separated.
virtual bool parallel() const
Are the cyclic planes parallel.
Cyclic patch for Arbitrary Mesh Interface (AMI).
virtual bool owner() const
Does this side own the patch?
virtual const cyclicAMIPolyPatch & neighbPatch() const
Return a reference to the neighbour patch.
const cyclicPolyPatch & neighbPatch() const
Various mesh related information for a parallel run. Upon construction, constructs all info using par...
const labelList & processorPatches() const noexcept
Return list of processor patch labels.
const processorTopology & topology() const noexcept
The processor to processor topology.
interpolate(FaceCellWave< Type, TrackingData > &solver, const cyclicAMIPolyPatch &patch)
Mesh consisting of general polyhedral cells.
A patch is a list of labels that address the faces in the global face list.
const vectorField::subField faceCentres() const
Return face centres.
label start() const noexcept
Return start label of this patch in the polyMesh face list.
const List< T >::subList patchSlice(const UList< T > &values) const
This patch slice from the complete list, which has size mesh::nFaces(), using the number of patch fac...
const labelList & procNeighbours() const
The neighbour processor connections (ascending order) associated with the local rank.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
wallPoints::trackData td(isBlockedFace, regionToBlockSize)
Namespace for handling debugging switches.
Type & refCast(U &obj)
A dynamic_cast (for references) to Type reference.
Pair< label > labelPair
A pair of labels.
bool returnReduceOr(const bool value, const int communicator=UPstream::worldComm)
Perform logical (or) MPI Allreduce on a copy. Uses UPstream::reduceOr.
List< label > labelList
A List of labels.
dimensionedScalar y0(const dimensionedScalar &ds)
messageStream Info
Information stream (stdout output on master, null elsewhere).
T returnReduce(const T &value, BinaryOp bop, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Perform reduction on a copy, using specified binary operation.
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensionedScalar y1(const dimensionedScalar &ds)
List< cell > cellList
List of cell.
const Type * isA(const U &obj)
Attempt dynamic_cast to Type.
errorManip< error > abort(error &err)
Field< vector > vectorField
Specialisation of Field<T> for vector.
Field< tensor > tensorField
Specialisation of Field<T> for tensor.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
errorManipArg< error, int > exit(error &err, const int errNo=1)
UList< label > labelUList
A UList of labels.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
constexpr char nl
The newline '\n' character (0x0a).
#define forAll(list, i)
Loop across all elements in list.
Basic run-time type information using word as the type's name. Used to enhance the standard RTTI to c...