50 #ifndef _ZOLTAN2_ALGAMD_HPP_ 51 #define _ZOLTAN2_ALGAMD_HPP_ 58 #ifdef HAVE_ZOLTAN2_AMD 64 #ifdef HAVE_ZOLTAN2_AMD 65 template <
typename Ordinal>
69 Ordinal order(Ordinal n,
const Ordinal *Ap,
const Ordinal *Ai,
70 Ordinal *perm,
double *control,
double *info);
77 int order(
int n,
const int *Ap,
const int *Ai,
int *perm,
78 double *control,
double *info)
80 return (amd_order(n, Ap, Ai, perm, control, info));
88 long order(
long n,
const long *Ap,
const long *Ai,
long *perm,
89 double *control,
double *info)
91 return (amd_l_order(n, Ap, Ai, perm, control, info));
101 template <
typename Adapter>
106 const RCP<GraphModel<Adapter> > model;
107 const RCP<Teuchos::ParameterList> pl;
108 const RCP<const Teuchos::Comm<int> > comm;
114 const RCP<Teuchos::ParameterList> &pl__,
115 const RCP<
const Teuchos::Comm<int> > &comm__
116 ) : model(model__), pl(pl__), comm(comm__)
120 typename Adapter::gno_t> > &solution)
122 #ifndef HAVE_ZOLTAN2_AMD 123 throw std::runtime_error(
124 "BUILD ERROR: AMD requested but not compiled into Zoltan2.\n" 125 "Please set CMake flag Zoltan2_ENABLE_AMD:BOOL=ON.");
127 typedef typename Adapter::gno_t
gno_t;
128 typedef typename Adapter::lno_t
lno_t;
129 typedef typename Adapter::scalar_t
scalar_t;
133 const size_t nVtx = model->getLocalNumVertices();
136 ArrayView<const gno_t> edgeIds;
137 ArrayView<const lno_t> offsets;
138 ArrayView<StridedData<lno_t, scalar_t> > wgts;
141 model->getEdgeList(edgeIds, offsets, wgts);
143 AMDTraits<lno_t> AMDobj;
144 double Control[AMD_CONTROL];
145 double Info[AMD_INFO];
147 amd_defaults(Control);
148 amd_control(Control);
151 perm = (
lno_t *) (solution->getPermutationRCP().getRawPtr());
153 lno_t result = AMDobj.order(nVtx, offsets.getRawPtr(),
154 edgeIds.getRawPtr(), perm, Control, Info);
156 if (result != AMD_OK && result != AMD_OK_BUT_JUMBLED)
159 solution->setHavePerm(
true);
Defines the OrderingSolution class.
AlgAMD(const RCP< GraphModel< Adapter > > &model__, const RCP< Teuchos::ParameterList > &pl__, const RCP< const Teuchos::Comm< int > > &comm__)
Adapter::scalar_t scalar_t
Algorithm defines the base class for all algorithms.
int order(const RCP< OrderingSolution< typename Adapter::lno_t, typename Adapter::gno_t > > &solution)
Ordering method.
GraphModel defines the interface required for graph models.
Defines the GraphModel interface.
The class containing ordering solutions.