50 #ifndef _ZOLTAN2_ORDERINGPROBLEM_HPP_ 51 #define _ZOLTAN2_ORDERINGPROBLEM_HPP_ 59 #ifdef HAVE_ZOLTAN2_OVIS 65 using Teuchos::rcp_dynamic_cast;
89 template<
typename Adapter>
95 typedef typename Adapter::gno_t
gno_t;
96 typedef typename Adapter::lno_t
lno_t;
97 typedef typename Adapter::user_t
user_t;
100 #ifdef HAVE_ZOLTAN2_MPI 101 typedef Teuchos::OpaqueWrapper<MPI_Comm> mpiWrapper_t;
109 #ifdef HAVE_ZOLTAN2_MPI 116 createOrderingProblem();
125 createOrderingProblem();
132 RCP<Teuchos::StringValidator> order_method_Validator =
133 Teuchos::rcp(
new Teuchos::StringValidator(
134 Teuchos::tuple<std::string>(
"rcm",
"minimum_degree",
"natural",
135 "random",
"sorted_degree",
"scotch",
"nd" )));
136 pl.set(
"order_method",
"rcm",
"order algorithm",
137 order_method_Validator);
139 RCP<Teuchos::StringValidator> order_package_Validator = Teuchos::rcp(
140 new Teuchos::StringValidator(
141 Teuchos::tuple<std::string>(
"amd",
"package2",
"package3" )));
142 pl.set(
"order_package",
"amd",
"package to use in ordering",
143 order_package_Validator);
162 void solve(
bool updateInputData=
true);
171 if (!(solution_->havePerm()))
172 solution_->computePerm();
173 if (!(solution_->haveInverse()))
174 solution_->computeInverse();
175 return solution_.getRawPtr();
179 void createOrderingProblem();
181 RCP<OrderingSolution<lno_t, gno_t> > solution_;
186 template <
typename Adapter>
191 size_t nVtx = this->baseModel_->getLocalNumObjects();
201 this->solution_->setHavePerm(
false);
202 this->solution_->setHaveInverse(
false);
208 std::string method = this->params_->template get<std::string>(
"order_method",
"rcm");
213 if (method.compare(
"rcm") == 0)
216 this->params_, this->comm_);
217 alg.
order(this->solution_);
219 else if (method.compare(
"natural") == 0)
222 this->params_, this->comm_);
223 alg.
order(this->solution_);
225 else if (method.compare(
"random") == 0)
228 this->params_, this->comm_);
229 alg.
order(this->solution_);
231 else if (method.compare(
"sorted_degree") == 0)
234 this->params_, this->comm_);
235 alg.
order(this->solution_);
237 else if (method.compare(
"minimum_degree") == 0)
239 std::string pkg = this->params_->template get<std::string>(
"order_package",
"amd");
240 if (pkg.compare(
"amd") == 0)
243 this->params_, this->comm_);
244 alg.
order(this->solution_);
247 else if (method.compare(
"scotch") == 0)
251 this->baseInputAdapter_);
252 alg.
order(this->solution_);
255 #ifdef INCLUDE_ZOLTAN2_EXPERIMENTAL_WOLF 256 else if (method == std::string(
"nd"))
259 this->coordinateModel_,this->baseInputAdapter_);
261 alg.
order(this->solution_);
282 template <
typename Adapter>
286 using Teuchos::ParameterList;
292 #ifdef HAVE_ZOLTAN2_OVIS 293 ovis_enabled(this->comm_->getRank());
302 std::string method = this->params_->template get<std::string>(
"order_method",
"rcm");
304 if ((method == std::string(
"rcm")) ||
305 (method == std::string(
"sorted_degree")) ||
306 (method == std::string(
"minimum_degree"))) {
310 #ifdef INCLUDE_ZOLTAN2_EXPERIMENTAL_WOLF 311 if ((method == std::string(
"nd")))
320 std::bitset<NUM_MODEL_FLAGS> graphFlags;
321 std::bitset<NUM_MODEL_FLAGS> idFlags;
332 this->graphModel_ = rcp(
new GraphModel<base_adapter_t>(
333 this->baseInputAdapter_, this->envConst_, this->comm_, graphFlags));
335 this->baseModel_ = rcp_implicit_cast<
const Model<base_adapter_t> >(
343 this->identifierModel_ = rcp(
new IdentifierModel<base_adapter_t>(
344 this->baseInputAdapter_, this->envConst_, this->comm_, idFlags));
346 this->baseModel_ = rcp_implicit_cast<
const Model<base_adapter_t> >(
347 this->identifierModel_);
354 <<
" Model type " << modelType <<
" not yet supported." OrderingSolution< lno_t, gno_t > * getSolution()
Get the solution to the problem.
Zoltan2::BaseAdapter< userTypes_t > base_adapter_t
ModelType
An identifier for the general type of model.
virtual ~OrderingProblem()
Destructor.
#define Z2_FORWARD_EXCEPTIONS
Forward an exception back through call stack.
Defines the OrderingSolution class.
int order(const RCP< OrderingSolution< lno_t, gno_t > > &solution)
Ordering method.
OrderingProblem sets up ordering problems for the user.
algorithm requires no self edges
int order(const RCP< OrderingSolution< lno_t, gno_t > > &solution)
Ordering method.
OrderingProblem(Adapter *A, ParameterList *p)
Constructor that uses a default communicator.
Problem base class from which other classes (PartitioningProblem, ColoringProblem, OrderingProblem, MatchingProblem, etc.) derive.
void solve(bool updateInputData=true)
Direct the problem to create a solution.
Adapter::scalar_t scalar_t
Defines the Problem base class.
Adapter::base_adapter_t base_adapter_t
virtual int order(const RCP< OrderingSolution< lno_t, gno_t > > &solution)
Ordering method.
int order(const RCP< OrderingSolution< typename Adapter::lno_t, typename Adapter::gno_t > > &solution)
Ordering method.
int order(const RCP< OrderingSolution< lno_t, gno_t > > &solution)
Ordering method.
Defines the GraphModel interface.
The class containing ordering solutions.
static void getValidParameters(ParameterList &pl)
Set up validators specific to this Problem.
model represents graph within only one rank
int order(const RCP< OrderingSolution< lno_t, gno_t > > &solution)
Ordering method.
#define __func__zoltan2__
int order(const RCP< OrderingSolution< lno_t, gno_t > > &solution_)
Ordering method.