46 cf[fineToCoarse[i]] +=
ff[i];
55 const Field<Type>&
ff,
56 const label fineLevelIndex,
60 const labelList& fineToCoarse = restrictAddressing_[fineLevelIndex];
62 if (!procAgglom &&
ff.size() != fineToCoarse.size())
65 <<
"field does not correspond to level " << fineLevelIndex
66 <<
" sizes: field = " <<
ff.size()
67 <<
" level = " << fineToCoarse.size()
71 restrictField(cf,
ff, fineToCoarse);
73 const label coarseLevelIndex = fineLevelIndex+1;
75 if (procAgglom && hasProcMesh(coarseLevelIndex))
77 const label coarseComm =
80 const List<label>& procIDs = agglomProcIDs(coarseLevelIndex);
81 const labelList& offsets = cellOffsets(coarseLevelIndex);
100 const Field<Type>&
ff,
101 const label fineLevelIndex
104 const labelList& fineToCoarse = faceRestrictAddressing_[fineLevelIndex];
106 if (
ff.size() != fineToCoarse.size())
109 <<
"field does not correspond to level " << fineLevelIndex
110 <<
" sizes: field = " <<
ff.size()
111 <<
" level = " << fineToCoarse.size()
117 forAll(fineToCoarse, ffacei)
119 label cFace = fineToCoarse[ffacei];
123 cf[cFace] +=
ff[ffacei];
133 const Field<Type>& cf,
134 const label levelIndex,
135 const bool procAgglom
138 const labelList& fineToCoarse = restrictAddressing_[levelIndex];
140 const label coarseLevelIndex = levelIndex+1;
142 if (procAgglom && hasProcMesh(coarseLevelIndex))
144 const label coarseComm =
147 const List<label>& procIDs = agglomProcIDs(coarseLevelIndex);
148 const labelList& offsets = cellOffsets(coarseLevelIndex);
150 const label localSize = nCells_[levelIndex];
152 Field<Type> allCf(localSize);
166 ff[i] = allCf[fineToCoarse[i]];
173 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" : (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)