15 #ifndef __TPETRA_DISTRIBUTION_HPP
16 #define __TPETRA_DISTRIBUTION_HPP
27 #include "Teuchos_Comm.hpp"
32 enum DistributionType {
45 template <
typename gno_t,
typename scalar_t>
49 Distribution(
size_t nrows_,
50 const Teuchos::RCP<
const Teuchos::Comm<int> > &comm_,
51 const Teuchos::ParameterList ¶ms) :
52 comm(comm_), me(comm_->getRank()), np(comm_->getSize()),
55 virtual ~Distribution() {};
58 virtual enum DistributionType DistType() = 0;
61 virtual bool Mine(gno_t i, gno_t j) = 0;
62 virtual bool Mine(gno_t i, gno_t j,
int p) = 0;
65 virtual bool VecMine(gno_t i) = 0;
68 using NZindex_t = std::pair<gno_t, gno_t>;
69 struct compareNzIndex {
70 bool operator() (
const NZindex_t &lhs,
const NZindex_t &rhs)
const
71 {
if (lhs.first < rhs.first)
return true;
72 if ((lhs.first == rhs.first) && (lhs.second < rhs.second))
return true;
77 using LocalNZmap_t = std::map<NZindex_t, scalar_t, compareNzIndex>;
86 virtual void Redistribute(LocalNZmap_t &localNZ) { };
90 const Teuchos::RCP<const Teuchos::Comm<int> > comm;
95 int HashToProc(gno_t i) {
104 #include "Tpetra_Distribution2D.hpp"
105 #include "Tpetra_Distribution1D.hpp"
106 #include "Tpetra_DistributionMM.hpp"
107 #include "Tpetra_DistributionLowerTriangularBlock.hpp"