47 #ifndef __TPETRA_DISTRIBUTION_HPP
48 #define __TPETRA_DISTRIBUTION_HPP
59 #include "Teuchos_Comm.hpp"
64 enum DistributionType {
77 template <
typename gno_t,
typename scalar_t>
81 Distribution(
size_t nrows_,
82 const Teuchos::RCP<
const Teuchos::Comm<int> > &comm_,
83 const Teuchos::ParameterList ¶ms) :
84 comm(comm_), me(comm_->getRank()), np(comm_->getSize()),
87 virtual ~Distribution() {};
90 virtual enum DistributionType DistType() = 0;
93 virtual bool Mine(gno_t i, gno_t j) = 0;
94 virtual bool Mine(gno_t i, gno_t j,
int p) = 0;
97 virtual bool VecMine(gno_t i) = 0;
100 using NZindex_t = std::pair<gno_t, gno_t>;
101 struct compareNzIndex {
102 bool operator() (
const NZindex_t &lhs,
const NZindex_t &rhs)
const
103 {
if (lhs.first < rhs.first)
return true;
104 if ((lhs.first == rhs.first) && (lhs.second < rhs.second))
return true;
109 using LocalNZmap_t = std::map<NZindex_t, scalar_t, compareNzIndex>;
118 virtual void Redistribute(LocalNZmap_t &localNZ) { };
122 const Teuchos::RCP<const Teuchos::Comm<int> > comm;
127 int HashToProc(gno_t i) {
136 #include "Tpetra_Distribution2D.hpp"
137 #include "Tpetra_Distribution1D.hpp"
138 #include "Tpetra_DistributionMM.hpp"
139 #include "Tpetra_DistributionLowerTriangularBlock.hpp"