35 #define MPICH_SKIP_MPICXX
36 #define OMPI_SKIP_MPICXX
73 const List<scalar>& cWeights,
80 word method(
"recursive");
84 idx_t numCells =
max(0, (xadj.size()-1));
87 List<idx_t> options(METIS_NOPTIONS);
88 METIS_SetDefaultOptions(options.data());
92 Field<real_t> procWeights;
95 List<idx_t> cellWeights;
98 List<idx_t> faceWeights;
102 const scalar minWeights =
min(cWeights);
104 if (!cWeights.empty())
109 <<
"Illegal minimum weight " << minWeights
113 if (cWeights.size() != numCells)
116 <<
"Number of cell weights " << cWeights.size()
117 <<
" does not equal number of cells " << numCells
122 cellWeights.setSize(cWeights.size());
125 cellWeights[i] = idx_t(cWeights[i]/minWeights);
133 const dictionary& coeffDict = *coeffsDictPtr;
137 if (coeffDict.readIfPresent(
"method", method))
139 if (method !=
"recursive" && method !=
"k-way")
142 <<
"Method " << method <<
" in metisCoeffs in dictionary : "
144 <<
" should be 'recursive' or 'k-way'"
148 Info<<
"metisDecomp : Using Metis method " << method
152 if (coeffDict.readIfPresent(
"options", options))
154 if (options.size() != METIS_NOPTIONS)
157 <<
"Number of options in metisCoeffs in dictionary : "
159 <<
" should be " << METIS_NOPTIONS
163 Info<<
"metisDecomp : Using Metis options " << options
167 if (coeffDict.readIfPresent(
"processorWeights", procWeights))
172 <<
"processorWeights (" << procWeights.size()
173 <<
") != number of domains (" <<
nDomains_ <<
")" <<
nl
177 procWeights /=
sum(procWeights);
185 ConstPrecisionAdaptor<idx_t, label, List> xadj_param(xadj);
186 ConstPrecisionAdaptor<idx_t, label, List> adjncy_param(adjncy);
189 decomp.resize(numCells);
190 PrecisionAdaptor<idx_t, label, List> decomp_param(decomp,
false);
193 labelList adjncy_dummy, xadj_dummy, decomp_dummy;
196 adjncy_dummy.
resize(1, 0);
197 adjncy_param.set(adjncy_dummy);
199 xadj_dummy.resize(2, 0);
200 xadj_param.set(xadj_dummy);
202 decomp_dummy.resize(1, 0);
203 decomp_param.clear();
204 decomp_param.set(decomp_dummy);
215 if (method ==
"recursive")
217 METIS_PartGraphRecursive
221 xadj_param.constCast().data(),
222 adjncy_param.constCast().data(),
231 decomp_param.ref().data()
240 xadj_param.constCast().data(),
241 adjncy_param.constCast().data(),
250 decomp_param.ref().data()
262 const dictionary& decompDict,
266 metisLikeDecomp(typeName, decompDict,
regionName, selectionType::NULL_DICT)