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()
72 restrictField(cf,
ff, fineToCoarse);
74 const label coarseLevelIndex = fineLevelIndex+1;
76 if (procAgglom && hasProcMesh(coarseLevelIndex))
78 const label coarseComm =
81 const List<label>& procIDs = agglomProcIDs(coarseLevelIndex);
82 const labelList& offsets = cellOffsets(coarseLevelIndex);
101 const Field<Type>&
ff,
102 const label fineLevelIndex
105 const labelList& fineToCoarse = faceRestrictAddressing_[fineLevelIndex];
107 if (
ff.size() != fineToCoarse.size())
110 <<
"field does not correspond to level " << fineLevelIndex
111 <<
" sizes: field = " <<
ff.size()
112 <<
" level = " << fineToCoarse.size()
118 forAll(fineToCoarse, ffacei)
120 label cFace = fineToCoarse[ffacei];
124 cf[cFace] +=
ff[ffacei];
134 const Field<Type>& cf,
135 const label levelIndex,
136 const bool procAgglom
139 const labelList& fineToCoarse = restrictAddressing_[levelIndex];
141 const label coarseLevelIndex = levelIndex+1;
143 if (procAgglom && hasProcMesh(coarseLevelIndex))
145 const label coarseComm =
148 const List<label>& procIDs = agglomProcIDs(coarseLevelIndex);
149 const labelList& offsets = cellOffsets(coarseLevelIndex);
151 const label localSize = nCells_[levelIndex];
153 Field<Type> allCf(localSize);
167 ff[i] = allCf[fineToCoarse[i]];
174 ff[i] = cf[fineToCoarse[i]];
185 const Field<Type>& cf,
186 const label levelIndex
189 const labelList& fineToCoarse = restrictAddressing_[levelIndex];
191 const label coarseLevelIndex = levelIndex+1;
193 if (hasProcMesh(coarseLevelIndex))
195 const label coarseComm =
198 const List<label>& procIDs = agglomProcIDs(coarseLevelIndex);
199 const labelList& offsets = cellOffsets(coarseLevelIndex);
201 const label localSize = nCells_[levelIndex];
202 allCf.resize_nocopy(localSize);
217 ff[i] = allCf[fineToCoarse[i]];
225 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.
#define forAll(list, i)
Loop across all elements in list.
static label parent(const label communicator)
The parent communicator.
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)
"nonBlocking" (immediate) : (MPI_Isend, MPI_Irecv)
static void gather(const labelUList &offsets, const label comm, const ProcIDsContainer &procIDs, const UList< Type > &fld, List< Type > &allFld, const int tag=UPstream::msgType(), const UPstream::commsTypes=UPstream::commsTypes::nonBlocking)
Collect data in processor order on master (== procIDs[0]).
List< label > labelList
A List of labels.
const FieldField< fvPatchField, Type > & ff(const FieldField< fvPatchField, Type > &bf)
static void scatter(const labelUList &offsets, const label comm, const ProcIDsContainer &procIDs, const UList< Type > &allFld, UList< Type > &fld, const int tag=UPstream::msgType(), const UPstream::commsTypes=UPstream::commsTypes::nonBlocking)
Distribute data in processor order.
static constexpr const zero Zero
Global zero (0)