35#ifndef MPICH_SKIP_MPICXX
36#define MPICH_SKIP_MPICXX
38#ifndef OMPI_SKIP_MPICXX
39#define OMPI_SKIP_MPICXX
84 word method(
"recursive");
92 METIS_SetDefaultOptions(options.data());
104 bool hasWeights = !cWeights.
empty();
107 const scalar minWeights = hasWeights ?
min(cWeights) : scalar(1);
113 <<
"Illegal minimum weight " << minWeights
117 else if (hasWeights && (cWeights.
size() != numCells))
120 <<
"Number of weights (" << cWeights.size()
121 <<
") != number of cells (" << numCells <<
")"
131 cellWeights[i] = idx_t(cWeights[i]/minWeights);
143 if (coeffDict.readIfPresent(
"method", method))
145 if (method !=
"recursive" && method !=
"k-way")
148 <<
"Method " << method <<
" in metisCoeffs in dictionary : "
150 <<
" should be 'recursive' or 'k-way'"
154 Info<<
"metisDecomp : Using Metis method " << method
158 if (coeffDict.readIfPresent(
"options", options))
160 if (options.size() != METIS_NOPTIONS)
163 <<
"Number of options in metisCoeffs in dictionary : "
165 <<
" should be " << METIS_NOPTIONS
169 Info<<
"metisDecomp : Using Metis options " << options
173 if (coeffDict.readIfPresent(
"processorWeights", procWeights))
178 <<
"processorWeights (" << procWeights.
size()
179 <<
") != number of domains (" <<
nDomains_ <<
")" <<
nl
183 procWeights /=
sum(procWeights);
191 ConstPrecisionAdaptor<idx_t, label, List> xadj_param(xadj);
192 ConstPrecisionAdaptor<idx_t, label, List> adjncy_param(adjncy);
196 PrecisionAdaptor<idx_t, label, List> decomp_param(decomp,
false);
199 labelList adjncy_dummy, xadj_dummy, decomp_dummy;
202 adjncy_dummy.resize(1, 0);
203 adjncy_param.set(adjncy_dummy);
205 xadj_dummy.resize(2, 0);
206 xadj_param.set(xadj_dummy);
208 decomp_dummy.resize(1, 0);
209 decomp_param.clear();
210 decomp_param.set(decomp_dummy);
221 if (method ==
"recursive")
223 METIS_PartGraphRecursive
227 xadj_param.constCast().data(),
228 adjncy_param.constCast().data(),
237 decomp_param.ref().data()
246 xadj_param.constCast().data(),
247 adjncy_param.constCast().data(),
256 decomp_param.ref().data()
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
A const Field/List wrapper with possible data conversion.
void set(const Container< InputType > &input)
Set adaptor for different input, copying input if required.
Generic templated field type that is much like a Foam::List except that it is expected to hold numeri...
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void resize_nocopy(const label len)
Adjust allocated size of list without necessarily.
void resize(const label len)
Adjust allocated size of list.
A non-const Field/List wrapper with possible data conversion.
void set(Container< InputType > &input, const bool doCopy=true)
Set adaptor for different input, copying input as required.
bool empty() const noexcept
True if List is empty (ie, size() is zero).
T * data() noexcept
Return pointer to the underlying array serving as data storage.
void size(const label n)
Older name for setAddressableSize.
Abstract base class for domain decomposition.
selectionType
Selection type when handling the coefficients dictionary.
label nDomains_
Number of domains for the decomposition.
const dictionary & decompDict_
Top-level decomposition dictionary (eg, decomposeParDict).
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
const dictionary * findDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary pointer if present (and it is a dictionary) otherwise return nullptr...
bool readIfPresent(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX) const
Find an entry if present, and assign to T val. FatalIOError if it is found and the number of tokens i...
Metis domain decomposition.
virtual label decomposeSerial(const labelList &adjncy, const labelList &xadj, const List< scalar > &cellWeights, labelList &decomp) const
Decompose non-parallel.
metisDecomp(const metisDecomp &)=delete
No copy construct.
Domain decomposition using METIS-like data structures.
metisLikeDecomp(const metisLikeDecomp &)=delete
No copy construct.
T & constCast() const
Return non-const reference to the object or to the contents of a (non-null) managed pointer,...
void clear() const noexcept
If object pointer points to valid object: delete object and set pointer to nullptr.
T & ref() const
Return non-const reference to the contents of a non-null managed pointer.
A class for handling words, derived from Foam::string.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
Foam::word regionName(args.getOrDefault< word >("region", Foam::polyMesh::defaultRegion))
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
#define WarningInFunction
Report a warning using Foam::Warning.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
List< label > labelList
A List of labels.
messageStream Info
Information stream (stdout output on master, null elsewhere).
const word GlobalIOList< Tuple2< scalar, vector > >::typeName("scalarVectorTable")
Ostream & endl(Ostream &os)
Add newline and flush stream.
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &f1, const label comm)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
errorManipArg< error, int > exit(error &err, const int errNo=1)
constexpr char nl
The newline '\n' character (0x0a).
#define forAll(list, i)
Loop across all elements in list.