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<Teuchos::Comm<int> > comm;
73 typedef typename Adapter::lno_t
lno_t;
74 typedef typename Adapter::gno_t
gno_t;
79 const RCP<Teuchos::ParameterList> &pl__,
80 const RCP<Teuchos::Comm<int> > &comm__
81 ) : model(model__), pl(pl__), comm(comm__)
92 perm = (lno_t *) (solution->getPermutation());
95 std::cerr <<
"perm is NULL" << std::endl;
100 const size_t nVtx = model->getLocalNumVertices();
101 ArrayView<const gno_t> edgeIds;
102 ArrayView<const lno_t> offsets;
103 ArrayView<StridedData<lno_t, scalar_t> > wgts;
104 model->getEdgeList(edgeIds, offsets, wgts);
107 Teuchos::Array<std::pair<lno_t, size_t> > degrees(nVtx);
108 for (lno_t i=0; i<(
lno_t)nVtx; i++){
109 degrees[i].first = i;
110 degrees[i].second = offsets[i+1] - offsets[i];
116 zort.
sort(degrees, inc);
119 for (lno_t i=0; i<(
lno_t)nVtx; i++){
120 perm[i] = degrees[i].first;
123 solution->setHavePerm(
true);
AlgSortedDegree(const RCP< GraphModel< Adapter > > &model__, const RCP< Teuchos::ParameterList > &pl__, const RCP< Teuchos::Comm< int > > &comm__)
Defines the OrderingSolution class.
Algorithm defines the base class for all algorithms.
Sort vector of pairs (key, value) by value.
GraphModel defines the interface required for graph models.
int order(const RCP< OrderingSolution< lno_t, gno_t > > &solution)
Ordering method.
Adapter::scalar_t scalar_t
Defines the GraphModel interface.
The class containing ordering solutions.
void sort(Teuchos::Array< std::pair< key_t, value_t > > &listofPairs, bool inc=true)