43 #ifndef IFPACK2_USER_PARTITIONER_DEF_HPP
44 #define IFPACK2_USER_PARTITIONER_DEF_HPP
46 #include <Ifpack2_ConfigDefs.hpp>
48 #include <Ifpack2_OverlappingPartitioner.hpp>
53 template<
class GraphType>
57 userProvidedParts_(false),
58 userProvidedMap_(false)
61 template<
class GraphType>
64 template<
class GraphType>
69 userProvidedParts_ = List.
isParameter(
"partitioner: parts");
70 userProvidedMap_ = List.
isParameter(
"partitioner: map");
71 if (userProvidedParts_ && userProvidedMap_) {
73 "you may specify only one of \"partitioner: parts\" and \"partitioner: map\","
76 if (userProvidedMap_) {
77 map_ = List.
get (
"partitioner: map", map_);
79 map_.is_null (), std::runtime_error,
"Ifpack2::UserPartitioner::"
80 "setPartitionParameters: map_ is null.");
82 if (userProvidedParts_) {
85 this->Parts_ = List.
get<parts_type>(
"partitioner: parts");
86 List.
remove(
"partitioner: parts");
92 template<
class GraphType>
95 if (userProvidedParts_) {
96 this->NumLocalParts_ = this->Parts_.size();
98 this->Partition_.resize(0);
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];
115 #endif // IFPACK2_USERPARTITIONER_DEF_HPP
T & get(const std::string &name, T def_value)
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
UserPartitioner(const Teuchos::RCP< const row_graph_type > &graph)
Constructor.
Definition: Ifpack2_Details_UserPartitioner_def.hpp:55
void computePartitions()
Compute the partitions.
Definition: Ifpack2_Details_UserPartitioner_def.hpp:93
Declaration of a user-defined partitioner in which the user can define a partition of the graph...
bool isParameter(const std::string &name) const
bool remove(std::string const &name, bool throwIfNotExists=true)
virtual ~UserPartitioner()
Destructor.
Definition: Ifpack2_Details_UserPartitioner_def.hpp:62
Create overlapping partitions of a local graph.
Definition: Ifpack2_OverlappingPartitioner_decl.hpp:78
void setPartitionParameters(Teuchos::ParameterList &List)
Sets all the parameters for the partitioner. The only valid parameters are:
Definition: Ifpack2_Details_UserPartitioner_def.hpp:67