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), zoltan2AlgoName_ (
"phg")
28 template<
class GraphType>
29 Zoltan2Partitioner<GraphType>::~Zoltan2Partitioner() {}
32 template<
class GraphType>
34 Zoltan2Partitioner<GraphType>::
37 zoltan2AlgoName_ = List.
get<std::string>(
"zoltan2: algorithm", zoltan2AlgoName_);
40 template<
class GraphType>
41 void Zoltan2Partitioner<GraphType>::computePartitions()
44 Zoltan2GraphAdapterType zoltan2_graph(this->Graph_);
48 zoltan2_params.
set(
"partitioning_approach",
"partition");
49 zoltan2_params.
set(
"num_local_parts", this->NumLocalParts_);
50 if (zoltan2AlgoName_ ==
"parmetis") {
51 zoltan2_params.
set(
"algorithm",
"parmetis");
52 zoltan2_params.
set(
"symmetrize_input",
"transpose");
53 zoltan2_params.
set(
"partitioning_objective",
"minimize_cut_edge_weight");
55 zoltan2_params.
set(
"algorithm", zoltan2AlgoName_);
59 Zoltan2::PartitioningProblem<Zoltan2GraphAdapterType>
60 problem(&zoltan2_graph, &zoltan2_params, this->Graph_->getComm());
64 auto parts = problem.getSolution().getPartListView();
65 for (
size_t i = 0; i < this->Graph_->getLocalNumRows (); ++i) {
66 this->Partition_[i] = parts[i];
73 #define IFPACK2_ZOLTAN2PARTITIONER_INSTANT(LO,GO,N) \
74 template class Ifpack2::Zoltan2Partitioner<Tpetra::CrsGraph< LO, GO, N > >; \
75 template class Ifpack2::Zoltan2Partitioner<Tpetra::RowGraph< LO, GO, N > >;
77 #endif // HAVE_IFPACK2_ZOLTAN2
78 #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)