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()
74 cf.resize_nocopy(nCells_[fineLevelIndex]);
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];
137 const Field<Type>& cf,
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];
156 Field<Type> allCf(localSize);
170 ff[i] = allCf[fineToCoarse[i]];
177 ff[i] = cf[fineToCoarse[i]];
188 const Field<Type>& cf,
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]];
void restrictField(Field< Type > &cf, const Field< Type > &ff, const label fineLevelIndex, const bool procAgglom) const
Restrict (integrate by summation) cell field.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
void restrictFaceField(Field< Type > &cf, const Field< Type > &ff, const label fineLevelIndex) const
Restrict (integrate by summation) face field.
static int & msgType() noexcept
Message tag of standard messages.
static label parent(int communicator)
The parent communicator.
#define forAll(list, i)
Loop across all elements in list.
Generic templated field type.
void prolongField(Field< Type > &ff, const Field< Type > &cf, const label coarseLevelIndex, const bool procAgglom) const
Prolong (interpolate by injection) cell field.
errorManip< error > abort(error &err)
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]).
"nonBlocking" (immediate) : (MPI_Isend, MPI_Irecv)
List< label > labelList
A List of labels.
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.
const FieldField< fvPatchField, Type > & ff(const FieldField< fvPatchField, Type > &bf)
static constexpr const zero Zero
Global zero (0)