32 #define OMPI_SKIP_MPICXX 50 const List<label>& adjncy,
51 const List<label>& xadj,
54 List<label>& finalDecomp
60 word method(
"recursive");
62 label numCells = xadj.size()-1;
65 List<label> options(METIS_NOPTIONS);
66 METIS_SetDefaultOptions(options.begin());
70 Field<real_t> processorWeights;
73 List<label> cellWeights;
76 List<label> faceWeights;
80 scalar minWeights =
gMin(cWeights);
81 if (cWeights.size() > 0)
86 <<
"Illegal minimum weight " << minWeights
90 if (cWeights.size() != numCells)
93 <<
"Number of cell weights " << cWeights.size()
94 <<
" does not equal number of cells " << numCells
99 cellWeights.setSize(cWeights.size());
102 cellWeights[i] = int(cWeights[i]/minWeights);
108 if (decompositionDict_.found(
"metisCoeffs"))
110 const dictionary& metisCoeffs =
111 decompositionDict_.subDict(
"metisCoeffs");
115 if (metisCoeffs.readIfPresent(
"method", method))
117 if (method !=
"recursive" && method !=
"k-way")
120 <<
"Method " << method <<
" in metisCoeffs in dictionary : " 121 << decompositionDict_.name()
122 <<
" should be 'recursive' or 'k-way'" 126 Info<<
"metisDecomp : Using Metis method " << method
130 if (metisCoeffs.readIfPresent(
"options", options))
132 if (options.size() != METIS_NOPTIONS)
135 <<
"Number of options in metisCoeffs in dictionary : " 136 << decompositionDict_.name()
137 <<
" should be " << METIS_NOPTIONS
141 Info<<
"metisDecomp : Using Metis options " << options
145 if (metisCoeffs.readIfPresent(
"processorWeights", processorWeights))
147 processorWeights /=
sum(processorWeights);
149 if (processorWeights.size() != nProcessors_)
152 <<
"Number of processor weights " 153 << processorWeights.size()
154 <<
" does not equal number of domains " << nProcessors_
161 label nProcs = nProcessors_;
164 finalDecomp.setSize(numCells);
169 if (method ==
"recursive")
171 METIS_PartGraphRecursive
175 const_cast<List<label>&
>(xadj).begin(),
176 const_cast<List<label>&
>(adjncy).begin(),
181 processorWeights.begin(),
194 const_cast<List<label>&
>(xadj).begin(),
195 const_cast<List<label>&
>(adjncy).begin(),
200 processorWeights.begin(),
216 decompositionMethod(decompositionDict)
224 const polyMesh&
mesh,
232 <<
"Can use this decomposition method only for the whole mesh" 234 <<
"and supply one coordinate (cellCentre) for every cell." <<
endl 236 <<
"The number of cells in the mesh " <<
mesh.
nCells()
240 CompactListList<label> cellCells;
252 decompose(cellCells.m(), cellCells.offsets(), pointWeights, decomp);
260 const polyMesh&
mesh,
269 <<
"Size of cell-to-coarse map " << agglom.size()
270 <<
" differs from number of cells in mesh " <<
mesh.
nCells()
278 CompactListList<label> cellCells;
279 calcCellCells(
mesh, agglom, agglomPoints.
size(),
false, cellCells);
283 decompose(cellCells.m(), cellCells.offsets(), agglomWeights, finalDecomp);
287 labelList fineDistribution(agglom.size());
289 forAll(fineDistribution, i)
291 fineDistribution[i] = finalDecomp[agglom[i]];
294 return fineDistribution;
305 if (cellCentres.size() != globalCellCells.size())
308 <<
"Inconsistent number of cells (" << globalCellCells.size()
309 <<
") and number of cell centres (" << cellCentres.size()
318 CompactListList<label> cellCells(globalCellCells);
322 decompose(cellCells.m(), cellCells.offsets(), cellWeights, decomp);
List< labelList > labelListList
A List of labelList.
#define forAll(list, i)
Loop across all elements in list.
FvWallInfoData< WallInfo, label > label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
errorManipArg< error, int > exit(error &err, const int errNo=1)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Type gMin(const FieldField< Field, Type > &f)
void size(const label)
Override size to be inconsistent with allocated storage.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Holds information (coordinate and normal) regarding nearest wall point.
labelList identity(const label len)
Create identity map (map[i] == i) of given length.
label size() const
Return number of elements in table.
Macros for easy insertion into run-time selection tables.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
vectorField pointField
pointField is a vectorField.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
List< label > labelList
A List of labels.
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
defineTypeNameAndDebug(combustionModel, 0)
#define WarningInFunction
Report a warning using Foam::Warning.
metisDecomp(const dictionary &)
Construct given the decomposition dictionary.