10 #ifndef _ZOLTAN2_SORTEDDEGREE_HPP_
11 #define _ZOLTAN2_SORTEDDEGREE_HPP_
27 template <
typename Adapter>
32 const RCP<const typename Adapter::base_adapter_t> adapter;
33 const RCP<Teuchos::ParameterList> pl;
34 const RCP<const Teuchos::Comm<int> > comm;
35 RCP<const Environment> env;
46 const RCP<const typename Adapter::base_adapter_t> &adapter__,
47 const RCP<Teuchos::ParameterList> &pl__,
48 const RCP<
const Teuchos::Comm<int> > &comm__,
49 RCP<const Environment> &env__,
51 ) : adapter(adapter__), pl(pl__), comm(comm__), env(env__), graphFlags(graphFlags__)
57 throw std::logic_error(
58 "AlgSortedDegree does not yet support global ordering.");
67 lno_t *perm = solution->getPermutationView();
70 std::cerr <<
"perm is NULL" << std::endl;
76 const size_t nVtx = model->getLocalNumVertices();
77 ArrayView<const gno_t> edgeIds;
78 ArrayView<const offset_t> offsets;
79 ArrayView<StridedData<lno_t, scalar_t> > wgts;
80 model->getEdgeList(edgeIds, offsets, wgts);
84 Teuchos::Array<std::pair<lno_t, offset_t> > degrees(nVtx);
87 degrees[i].second = offsets[i+1] - offsets[i];
93 zort.
sort(degrees, inc);
97 perm[i] = degrees[i].first;
100 solution->setHavePerm(
true);
std::bitset< NUM_MODEL_FLAGS > modelFlag_t
map_t::global_ordinal_type gno_t
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.
map_t::local_ordinal_type lno_t
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)
AlgSortedDegree(const RCP< const typename Adapter::base_adapter_t > &adapter__, const RCP< Teuchos::ParameterList > &pl__, const RCP< const Teuchos::Comm< int > > &comm__, RCP< const Environment > &env__, const modelFlag_t &graphFlags__)