45 #ifndef _ZOLTAN2_SORTEDDEGREE_HPP_
46 #define _ZOLTAN2_SORTEDDEGREE_HPP_
62 template <
typename Adapter>
67 const RCP<GraphModel<Adapter> > model;
68 const RCP<Teuchos::ParameterList> pl;
69 const RCP<const Teuchos::Comm<int> > comm;
73 typedef typename Adapter::lno_t
lno_t;
74 typedef typename Adapter::gno_t
gno_t;
80 const RCP<Teuchos::ParameterList> &pl__,
81 const RCP<
const Teuchos::Comm<int> > &comm__
82 ) : model(model__), pl(pl__), comm(comm__)
88 throw std::logic_error(
89 "AlgSortedDegree does not yet support global ordering.");
98 lno_t *perm = solution->getPermutationView();
101 std::cerr <<
"perm is NULL" << std::endl;
106 const size_t nVtx = model->getLocalNumVertices();
107 ArrayView<const gno_t> edgeIds;
108 ArrayView<const offset_t> offsets;
109 ArrayView<StridedData<lno_t, scalar_t> > wgts;
110 model->getEdgeList(edgeIds, offsets, wgts);
114 Teuchos::Array<std::pair<lno_t, offset_t> > degrees(nVtx);
116 degrees[i].first = i;
117 degrees[i].second = offsets[i+1] - offsets[i];
123 zort.
sort(degrees, inc);
127 perm[i] = degrees[i].first;
130 solution->setHavePerm(
true);
AlgSortedDegree(const RCP< GraphModel< Adapter > > &model__, const RCP< Teuchos::ParameterList > &pl__, const RCP< const Teuchos::Comm< int > > &comm__)
Defines the OrderingSolution class.
Adapter::offset_t offset_t
int localOrder(const RCP< LocalOrderingSolution< lno_t > > &solution)
Ordering method.
int globalOrder(const RCP< GlobalOrderingSolution< gno_t > > &)
Ordering method.
Algorithm defines the base class for all algorithms.
Sort vector of pairs (key, value) by value.
GraphModel defines the interface required for graph models.
Adapter::scalar_t scalar_t
Defines the GraphModel interface.
void sort(Teuchos::Array< std::pair< key_t, value_t > > &listofPairs, bool inc=true)