45 #ifndef _ZOLTAN2_ALGRCM_HPP_ 46 #define _ZOLTAN2_ALGRCM_HPP_ 60 template <
typename Adapter>
65 const RCP<Teuchos::ParameterList> &pl,
66 const RCP<Teuchos::Comm<int> > &comm
79 if (comm->getSize() > 1){
80 throw std::runtime_error(
"RCM currently only works in serial.");
84 ArrayView<const gno_t> edgeIds;
85 ArrayView<const lno_t> offsets;
86 ArrayView<StridedData<lno_t, scalar_t> > wgts;
91 ArrayView<const int> procIds;
92 size_t numEdges = model->getEdgeList( edgeIds, procIds, offsets, wgts);
98 const size_t nVtx = model->getLocalNumVertices();
99 ArrayRCP<lno_t> perm = solution->getPermutationRCP();
104 for (
size_t i = 0; i < nVtx; ++i) {
112 for (
size_t i = 0; i < nVtx; ++i) {
124 while (count < nVtx) {
129 perm[
root] = count++;
140 for (lno_t ptr = offsets[v]; ptr < offsets[v+1]; ++ptr){
141 lno_t nbor = edgeIds[ptr];
142 if (static_cast<Tpetra::global_size_t>(perm[nbor]) == INVALID){
144 perm[nbor] = count++;
151 while ((next < nVtx) && (static_cast<Tpetra::global_size_t>(perm[next]) != INVALID)) next++;
159 for (
size_t i=0; i < nVtx/2; ++i) {
162 perm[i] = perm[nVtx-1-i];
163 perm[nVtx-1-i] = temp;
Defines the OrderingSolution class.
int AlgRCM(const RCP< GraphModel< Adapter > > &model, const RCP< OrderingSolution< typename Adapter::gid_t, typename Adapter::lno_t > > &solution, const RCP< Teuchos::ParameterList > &pl, const RCP< Teuchos::Comm< int > > &comm)
GraphModel defines the interface required for graph models.
Defines the GraphModel interface.
The class containing ordering solutions and metrics.