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_) {
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");
92 template<
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];
115 #endif // IFPACK2_USERPARTITIONER_DEF_HPP