43#ifndef IFPACK2_USER_PARTITIONER_DEF_HPP
44#define IFPACK2_USER_PARTITIONER_DEF_HPP
46#include <Ifpack2_ConfigDefs.hpp>
48#include <Ifpack2_OverlappingPartitioner.hpp>
53template<
class GraphType>
57 userProvidedParts_(false),
58 userProvidedMap_(false)
61template<
class GraphType>
64template<
class GraphType>
69 userProvidedParts_ = List.isParameter(
"partitioner: parts");
70 userProvidedMap_ = List.isParameter(
"partitioner: map");
71 if (userProvidedParts_ && userProvidedMap_) {
72 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::runtime_error,
"Ifpack2::UserPartitioner::setPartitionParameters: "
73 "you may specify only one of \"partitioner: parts\" and \"partitioner: map\","
76 if (userProvidedMap_) {
77 map_ = List.get (
"partitioner: map", map_);
78 TEUCHOS_TEST_FOR_EXCEPTION(
79 map_.is_null (), std::runtime_error,
"Ifpack2::UserPartitioner::"
80 "setPartitionParameters: map_ is null.");
82 if (userProvidedParts_) {
83 typedef Teuchos::Array<typename Teuchos::ArrayRCP<typename GraphType::local_ordinal_type>> parts_type;
85 this->Parts_ = List.get<parts_type>(
"partitioner: parts");
86 List.remove(
"partitioner: parts");
92template<
class GraphType>
95 if (userProvidedParts_) {
96 this->NumLocalParts_ = this->Parts_.size();
98 this->Partition_.resize(0);
100 TEUCHOS_TEST_FOR_EXCEPTION(
101 map_.is_null (), std::logic_error,
"Ifpack2::UserPartitioner::"
102 "computePartitions: map_ is null.");
103 const size_t localNumRows = this->Graph_->getNodeNumRows ();
104 for (
size_t ii = 0; ii < localNumRows; ++ii) {
105 this->Partition_[ii] = map_[ii];
Declaration of a user-defined partitioner in which the user can define a partition of the graph....
virtual ~UserPartitioner()
Destructor.
Definition: Ifpack2_Details_UserPartitioner_def.hpp:62
void computePartitions()
Compute the partitions.
Definition: Ifpack2_Details_UserPartitioner_def.hpp:93
void setPartitionParameters(Teuchos::ParameterList &List)
Sets all the parameters for the partitioner. The only valid parameters are:
Definition: Ifpack2_Details_UserPartitioner_def.hpp:67
UserPartitioner(const Teuchos::RCP< const row_graph_type > &graph)
Constructor.
Definition: Ifpack2_Details_UserPartitioner_def.hpp:55
Create overlapping partitions of a local graph.
Definition: Ifpack2_OverlappingPartitioner_decl.hpp:78
Ifpack2 implementation details.
Preconditioners and smoothers for Tpetra sparse matrices.
Definition: Ifpack2_AdditiveSchwarz_decl.hpp:73