45#ifndef _ZOLTAN2_SORTEDDEGREE_HPP_
46#define _ZOLTAN2_SORTEDDEGREE_HPP_
62template <
typename Adapter>
67 const RCP<const typename Adapter::base_adapter_t> adapter;
68 const RCP<Teuchos::ParameterList> pl;
69 const RCP<const Teuchos::Comm<int> > comm;
70 RCP<const Environment> env;
75 typedef typename Adapter::lno_t
lno_t;
76 typedef typename Adapter::gno_t
gno_t;
81 const RCP<const typename Adapter::base_adapter_t> &adapter__,
82 const RCP<Teuchos::ParameterList> &pl__,
83 const RCP<
const Teuchos::Comm<int> > &comm__,
84 RCP<const Environment> &env__,
86 ) : adapter(adapter__), pl(pl__), comm(comm__), env(env__), graphFlags(graphFlags__)
92 throw std::logic_error(
93 "AlgSortedDegree does not yet support global ordering.");
102 lno_t *perm = solution->getPermutationView();
105 std::cerr <<
"perm is NULL" << std::endl;
111 const size_t nVtx = model->getLocalNumVertices();
112 ArrayView<const gno_t> edgeIds;
113 ArrayView<const offset_t> offsets;
114 ArrayView<StridedData<lno_t, scalar_t> > wgts;
115 model->getEdgeList(edgeIds, offsets, wgts);
119 Teuchos::Array<std::pair<lno_t, offset_t> > degrees(nVtx);
121 degrees[i].first = i;
122 degrees[i].second = offsets[i+1] - offsets[i];
128 zort.
sort(degrees, inc);
132 perm[i] = degrees[i].first;
135 solution->setHavePerm(
true);
Defines the GraphModel interface.
Defines the OrderingSolution class.
Sort vector of pairs (key, value) by value.
Adapter::scalar_t scalar_t
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__)
int globalOrder(const RCP< GlobalOrderingSolution< gno_t > > &)
Ordering method.
Adapter::offset_t offset_t
int localOrder(const RCP< LocalOrderingSolution< lno_t > > &solution)
Ordering method.
Algorithm defines the base class for all algorithms.
GraphModel defines the interface required for graph models.
void sort(Teuchos::Array< std::pair< key_t, value_t > > &listofPairs, bool inc=true)
Created by mbenlioglu on Aug 31, 2020.
std::bitset< NUM_MODEL_FLAGS > modelFlag_t