Go to the documentation of this file.
33 #define OMPI_SKIP_MPICXX
61 word method(
"recursive");
67 METIS_SetDefaultOptions(options.begin());
71 Field<floatScalar> processorWeights;
81 scalar minWeights =
gMin(cWeights);
82 if (cWeights.size() > 0)
87 <<
"Illegal minimum weight " << minWeights
91 if (cWeights.size() != numCells)
94 <<
"Number of cell weights " << cWeights.size()
95 <<
" does not equal number of cells " << numCells
99 cellWeights.setSize(cWeights.size());
102 cellWeights[i] = int(cWeights[i]/minWeights);
110 const dictionary& metisCoeffs =
114 if (metisCoeffs.readIfPresent(
"method", method))
116 if (method !=
"recursive" && method !=
"k-way")
119 <<
"Method " << method <<
" in metisCoeffs in dictionary : "
121 <<
" should be 'recursive' or 'k-way'"
125 Info<<
"metisDecomp : Using Metis method " << method
129 if (metisCoeffs.readIfPresent(
"options", options))
131 if (options.size() != METIS_NOPTIONS)
134 <<
"Number of options in metisCoeffs in dictionary : "
136 <<
" should be " << METIS_NOPTIONS
140 Info<<
"metisDecomp : Using Metis options " << options
144 if (metisCoeffs.readIfPresent(
"processorWeights", processorWeights))
146 processorWeights /=
sum(processorWeights);
151 <<
"Number of processor weights "
152 << processorWeights.size()
190 finalDecomp.setSize(numCells);
195 if (method ==
"recursive")
197 METIS_PartGraphRecursive
207 processorWeights.begin(),
226 processorWeights.begin(),
242 decompositionMethod(decompositionDict)
250 const polyMesh&
mesh,
258 <<
"Can use this decomposition method only for the whole mesh"
260 <<
"and supply one coordinate (cellCentre) for every cell." <<
endl
261 <<
"The number of coordinates " <<
points.size() <<
endl
262 <<
"The number of cells in the mesh " <<
mesh.nCells()
266 CompactListList<label> cellCells;
278 decompose(cellCells.m(), cellCells.offsets(), pointWeights, decomp);
286 const polyMesh&
mesh,
295 <<
"Size of cell-to-coarse map " << agglom.size()
296 <<
" differs from number of cells in mesh " <<
mesh.
nCells()
304 CompactListList<label> cellCells;
305 calcCellCells(
mesh, agglom, agglomPoints.
size(),
false, cellCells);
309 decompose(cellCells.m(), cellCells.offsets(), agglomWeights, finalDecomp);
313 labelList fineDistribution(agglom.size());
315 forAll(fineDistribution, i)
317 fineDistribution[i] = finalDecomp[agglom[i]];
331 if (cellCentres.size() != globalCellCells.size())
334 <<
"Inconsistent number of cells (" << globalCellCells.size()
335 <<
") and number of cell centres (" << cellCentres.size()
344 CompactListList<label> cellCells(globalCellCells);
348 decompose(cellCells.m(), cellCells.offsets(), cellWeights, decomp);
vectorField pointField
pointField is a vectorField.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
static void calcCellCells(const polyMesh &mesh, const labelList &agglom, const label nLocalCoarse, const bool global, CompactListList< label > &cellCells)
Helper: determine (local or global) cellCells from mesh.
List< label > labelList
A List of labels.
#define forAll(list, i)
Loop across all elements in list.
const fileName & name() const
Return the dictionary name.
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
Ostream & endl(Ostream &os)
Add newline and flush stream.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
const dictionary & decompositionDict_
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.
errorManipArg< error, int > exit(error &err, const int errNo=1)
metisDecomp(const metisDecomp &)
List< labelList > labelListList
A List of labelList.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
volScalarField scalarField(fieldObject, mesh)
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
label decompose(const List< label > &adjncy, const List< label > &xadj, const scalarField &cellWeights, List< label > &finalDecomp)
Call Metis with options from dictionary.
Type gMin(const FieldField< Field, Type > &f)
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
defineTypeNameAndDebug(combustionModel, 0)
#define WarningInFunction
Report a warning using Foam::Warning.