47 cf[fineToCoarse[i]] += ff[i];
56 const Field<Type>& ff,
57 const label fineLevelIndex,
61 const labelList& fineToCoarse = restrictAddressing_[fineLevelIndex];
63 if (!procAgglom && ff.size() != fineToCoarse.size())
66 <<
"field does not correspond to level " << fineLevelIndex
67 <<
" sizes: field = " << ff.size()
68 <<
" level = " << fineToCoarse.size()
75 restrictField(cf, ff, fineToCoarse);
77 const label coarseLevelIndex = fineLevelIndex+1;
79 if (procAgglom && hasProcMesh(coarseLevelIndex))
81 const label coarseComm =
84 const auto& procIDs = agglomProcIDs(coarseLevelIndex);
85 const auto& offsets = cellOffsets(coarseLevelIndex);
104 const Field<Type>& ff,
105 const label fineLevelIndex
108 const labelList& fineToCoarse = faceRestrictAddressing_[fineLevelIndex];
110 if (ff.size() != fineToCoarse.size())
113 <<
"field does not correspond to level " << fineLevelIndex
114 <<
" sizes: field = " << ff.size()
115 <<
" level = " << fineToCoarse.size()
121 forAll(fineToCoarse, ffacei)
123 label cFace = fineToCoarse[ffacei];
127 cf[cFace] += ff[ffacei];
138 const label levelIndex,
139 const bool procAgglom
142 const labelList& fineToCoarse = restrictAddressing_[levelIndex];
144 const label coarseLevelIndex = levelIndex+1;
146 if (procAgglom && hasProcMesh(coarseLevelIndex))
148 const label coarseComm =
151 const auto& procIDs = agglomProcIDs(coarseLevelIndex);
152 const auto& offsets = cellOffsets(coarseLevelIndex);
154 const label localSize = nCells_[levelIndex];
170 ff[i] = allCf[fineToCoarse[i]];
177 ff[i] = cf[fineToCoarse[i]];
189 const label levelIndex
192 const labelList& fineToCoarse = restrictAddressing_[levelIndex];
194 const label coarseLevelIndex = levelIndex+1;
196 if (hasProcMesh(coarseLevelIndex))
198 const label coarseComm =
201 const auto& procIDs = agglomProcIDs(coarseLevelIndex);
202 const auto& offsets = cellOffsets(coarseLevelIndex);
204 const label localSize = nCells_[levelIndex];
205 allCf.resize_nocopy(localSize);
220 ff[i] = allCf[fineToCoarse[i]];
228 ff[i] = cf[fineToCoarse[i]];
Generic templated field type that is much like a Foam::List except that it is expected to hold numeri...
void restrictField(Field< Type > &cf, const Field< Type > &ff, const label fineLevelIndex, const bool procAgglom) const
Restrict (integrate by summation) cell field.
void prolongField(Field< Type > &ff, const Field< Type > &cf, const label coarseLevelIndex, const bool procAgglom) const
Prolong (interpolate by injection) cell field.
const labelList & cellOffsets(const label fineLeveli) const
Mapping from processor to procMesh cells.
labelList nCells_
The number of cells in each level.
bool hasProcMesh(const label fineLeveli) const
Check that level has combined mesh.
labelList procCommunicator_
Communicator for given level.
void restrictFaceField(Field< Type > &cf, const Field< Type > &ff, const label fineLevelIndex) const
Restrict (integrate by summation) face field.
const labelList & agglomProcIDs(const label fineLeveli) const
Set of processors to agglomerate. Element 0 is the master processor. (local, same only on those proce...
PtrList< labelField > restrictAddressing_
Cell restriction addressing array.
PtrList< labelList > faceRestrictAddressing_
Face restriction addressing array.
void resize_nocopy(const label len)
Adjust allocated size of list without necessarily.
void size(const label n)
Older name for setAddressableSize.
static label parent(int communicator)
The parent communicator.
@ nonBlocking
"nonBlocking" (immediate) : (MPI_Isend, MPI_Irecv)
static int & msgType() noexcept
Message tag of standard messages.
static void scatter(const labelUList &offsets, const label comm, const ProcIDsContainer &procIDs, const UList< Type > &allFld, UList< Type > &fld, const int tag=UPstream::msgType(), UPstream::commsTypes commsType=UPstream::commsTypes::nonBlocking)
Distribute data in processor order.
static void gatherInplace(const labelUList &offsets, const label comm, const ProcIDsContainer &procIDs, List< Type > &fld, const int tag=UPstream::msgType(), UPstream::commsTypes commsType=UPstream::commsTypes::nonBlocking)
Inplace collect in processor order on master (== procIDs[0]).
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const FieldField< fvPatchField, Type > & ff(const FieldField< fvPatchField, Type > &bf)
List< label > labelList
A List of labels.
errorManip< error > abort(error &err)
static constexpr const zero Zero
Global zero (0).
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
#define forAll(list, i)
Loop across all elements in list.