10 #ifndef IFPACK2_ZOLTAN2_PARTITIONER_DEF_HPP
11 #define IFPACK2_ZOLTAN2_PARTITIONER_DEF_HPP
13 #if defined(HAVE_IFPACK2_ZOLTAN2)
14 #include "Ifpack2_ConfigDefs.hpp"
15 #include "Ifpack2_Zoltan2Partitioner_decl.hpp"
21 template <
class GraphType>
22 Zoltan2Partitioner<GraphType>::
24 : OverlappingPartitioner<GraphType>(graph)
25 , zoltan2AlgoName_(
"phg") {}
27 template <
class GraphType>
28 Zoltan2Partitioner<GraphType>::~Zoltan2Partitioner() {}
30 template <
class GraphType>
31 void Zoltan2Partitioner<GraphType>::
34 zoltan2AlgoName_ = List.
get<std::string>(
"zoltan2: algorithm", zoltan2AlgoName_);
37 template <
class GraphType>
38 void Zoltan2Partitioner<GraphType>::computePartitions() {
40 Zoltan2GraphAdapterType zoltan2_graph(this->Graph_);
44 zoltan2_params.
set(
"partitioning_approach",
"partition");
45 zoltan2_params.
set(
"num_local_parts", this->NumLocalParts_);
46 if (zoltan2AlgoName_ ==
"parmetis") {
47 zoltan2_params.
set(
"algorithm",
"parmetis");
48 zoltan2_params.
set(
"symmetrize_input",
"transpose");
49 zoltan2_params.
set(
"partitioning_objective",
"minimize_cut_edge_weight");
51 zoltan2_params.
set(
"algorithm", zoltan2AlgoName_);
55 Zoltan2::PartitioningProblem<Zoltan2GraphAdapterType>
56 problem(&zoltan2_graph, &zoltan2_params, this->Graph_->getComm());
60 auto parts = problem.getSolution().getPartListView();
61 for (
size_t i = 0; i < this->Graph_->getLocalNumRows(); ++i) {
62 this->Partition_[i] = parts[i];
68 #define IFPACK2_ZOLTAN2PARTITIONER_INSTANT(LO, GO, N) \
69 template class Ifpack2::Zoltan2Partitioner<Tpetra::CrsGraph<LO, GO, N> >; \
70 template class Ifpack2::Zoltan2Partitioner<Tpetra::RowGraph<LO, GO, N> >;
72 #endif // HAVE_IFPACK2_ZOLTAN2
73 #endif // IFPACK2_ZOLTAN2PARTITIONER_DEF_HPP
T & get(const std::string &name, T def_value)
ParameterList & set(std::string const &name, T &&value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)