43 label nPairLevels = 0;
44 label nCreatedLevels = 0;
48 label nCoarseCells = -1;
62 nCells_[nCreatedLevels] = nCoarseCells;
92 delete faceWeightsPtr;
95 faceWeightsPtr = aggFaceWeightsPtr;
98 if (nPairLevels % mergeLevels_)
116 delete faceWeightsPtr;
130 const label nFineCells = fineMatrixAddressing.
size();
137 labelList cellFaceOffsets(nFineCells + 1);
145 nNbrs[upperAddr[facei]]++;
150 nNbrs[lowerAddr[facei]]++;
153 cellFaceOffsets[0] = 0;
156 cellFaceOffsets[celli+1] = cellFaceOffsets[celli] + nNbrs[celli];
166 cellFaceOffsets[upperAddr[facei]] + nNbrs[upperAddr[facei]]
169 nNbrs[upperAddr[facei]]++;
176 cellFaceOffsets[lowerAddr[facei]] + nNbrs[lowerAddr[facei]]
179 nNbrs[lowerAddr[facei]]++;
192 for (
label cellfi=0; cellfi<nFineCells; cellfi++)
195 celli = forward_ ? cellfi : nFineCells - cellfi - 1;
197 if (coarseCellMap[celli] < 0)
199 label matchFaceNo = -1;
200 scalar maxFaceWeight = -great;
205 label faceOs=cellFaceOffsets[celli];
206 faceOs<cellFaceOffsets[celli+1];
210 label facei = cellFaces[faceOs];
216 coarseCellMap[upperAddr[facei]] < 0
217 && coarseCellMap[lowerAddr[facei]] < 0
227 if (matchFaceNo >= 0)
230 coarseCellMap[upperAddr[matchFaceNo]] = nCoarseCells;
231 coarseCellMap[lowerAddr[matchFaceNo]] = nCoarseCells;
238 label clusterMatchFaceNo = -1;
239 scalar clusterMaxFaceCoeff = -great;
243 label faceOs=cellFaceOffsets[celli];
244 faceOs<cellFaceOffsets[celli+1];
248 label facei = cellFaces[faceOs];
252 clusterMatchFaceNo = facei;
257 if (clusterMatchFaceNo >= 0)
260 coarseCellMap[celli] =
max
262 coarseCellMap[upperAddr[clusterMatchFaceNo]],
263 coarseCellMap[lowerAddr[clusterMatchFaceNo]]
272 for (
label cellfi=0; cellfi<nFineCells; cellfi++)
275 celli = forward_ ? cellfi : nFineCells - cellfi - 1;
277 if (coarseCellMap[celli] < 0)
279 coarseCellMap[celli] = nCoarseCells;
288 forAll(coarseCellMap, celli)
290 coarseCellMap[celli] = nCoarseCells - coarseCellMap[celli];
298 forward_ = !forward_;
300 return tcoarseCellMap;
#define forAll(list, i)
Loop across all elements in list.
void agglomerateLduAddressing(const label fineLevelIndex)
Assemble coarse mesh addressing.
const label maxLevels_
Max number of levels.
void compactLevels(const label nCreatedLevels)
Shrink the number of levels to that specified.
PtrList< lduPrimitiveMesh > meshLevels_
Hierarchy of mesh addressing.
bool continueAgglomerating(const label nCells, const label nCoarseCells) const
Check the need for further agglomeration.
labelList nCells_
The number of cells in each level.
void restrictFaceField(Field< Type > &cf, const Field< Type > &ff, const label fineLevelIndex) const
Restrict (integrate by summation) face field.
void combineLevels(const label curLevel)
Combine a level with the previous one.
PtrList< labelField > restrictAddressing_
Cell restriction addressing array.
const lduMesh & meshLevel(const label leveli) const
Return LDU mesh of given level.
label size() const
Return the number of elements in the UList.
The class contains the addressing required by the lduMatrix: upper, lower and losort.
label size() const
Return number of equations.
virtual const labelUList & upperAddr() const =0
Return upper addressing.
virtual const labelUList & lowerAddr() const =0
Return lower addressing.
Abstract base class for meshes which provide LDU addressing for the construction of lduMatrix and LDU...
void agglomerate(const lduMesh &mesh, const scalarField &faceWeights)
Agglomerate all levels starting from the given face weights.
A class for managing temporary objects.
T & ref() const
Return non-const reference or generate a fatal error.
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
tmp< scalarField > faceWeights(const polyMesh &mesh, const vectorField &fCtrs, const vectorField &fAreas, const vectorField &cellCtrs)
Generate interpolation factors field.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Field< label > labelField
Specialisation of Field<T> for label.
dimensioned< Type > max(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)