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;
79 const RCP<Teuchos::ParameterList> &pl__,
80 const RCP<
const Teuchos::Comm<int> > &comm__
81 ) : model(model__), pl(pl__), comm(comm__)
91 lno_t *perm = solution->getPermutationView();
94 std::cerr <<
"perm is NULL" << std::endl;
99 const size_t nVtx = model->getLocalNumVertices();
100 ArrayView<const gno_t> edgeIds;
101 ArrayView<const lno_t> offsets;
102 ArrayView<StridedData<lno_t, scalar_t> > wgts;
103 model->getEdgeList(edgeIds, offsets, wgts);
106 Teuchos::Array<std::pair<lno_t, size_t> > degrees(nVtx);
108 degrees[i].first = i;
109 degrees[i].second = offsets[i+1] - offsets[i];
115 zort.
sort(degrees, inc);
119 perm[i] = degrees[i].first;
122 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.
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)