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();
144 void solve(
bool updateInputData=
true);
153 if (!(solution_->havePerm()))
154 solution_->computePerm();
155 if (!(solution_->haveInverse()))
156 solution_->computeInverse();
157 return solution_.getRawPtr();
161 void createOrderingProblem();
163 RCP<OrderingSolution<lno_t, gno_t> > solution_;
165 RCP<Comm<int> > problemComm_;
166 RCP<const Comm<int> > problemCommConst_;
168 #ifdef HAVE_ZOLTAN2_MPI 174 template <
typename Adapter>
179 size_t nVtx = this->
baseModel_->getLocalNumObjects();
189 this->solution_->setHavePerm(
false);
190 this->solution_->setHaveInverse(
false);
196 std::string method = this->
params_->template get<std::string>(
"order_method",
"rcm");
201 if (method.compare(
"rcm") == 0)
205 alg.
order(this->solution_);
207 else if (method.compare(
"natural") == 0)
211 alg.
order(this->solution_);
213 else if (method.compare(
"random") == 0)
217 alg.
order(this->solution_);
219 else if (method.compare(
"sorted_degree") == 0)
223 alg.
order(this->solution_);
225 else if (method.compare(
"minimum_degree") == 0)
227 std::string pkg = this->
params_->template get<std::string>(
"order_package",
"amd");
228 if (pkg.compare(
"amd") == 0)
232 alg.
order(this->solution_);
236 #ifdef INCLUDE_ZOLTAN2_EXPERIMENTAL_WOLF 237 else if (method == std::string(
"nd"))
241 alg.
order(this->solution_);
262 template <
typename Adapter>
266 using Teuchos::ParameterList;
272 #ifdef HAVE_ZOLTAN2_OVIS 273 ovis_enabled(this->
comm_->getRank());
278 problemComm_ = this->
comm_->duplicate();
279 problemCommConst_ = rcp_const_cast<
const Comm<int> > (problemComm_);
282 #ifdef HAVE_ZOLTAN2_MPI 286 Comm<int> *c = problemComm_.getRawPtr();
287 Teuchos::MpiComm<int> *mc =
dynamic_cast<Teuchos::MpiComm<int> *
>(c);
289 RCP<const mpiWrapper_t> wrappedComm = mc->getRawMpiComm();
290 mpiComm_ = (*wrappedComm.getRawPtr())();
293 mpiComm_ = MPI_COMM_SELF;
304 std::string method = this->
params_->template get<std::string>(
"order_method",
"rcm");
306 if ((method == std::string(
"rcm")) ||
307 (method == std::string(
"sorted_degree")) ||
308 (method == std::string(
"minimum_degree"))) {
314 std::bitset<NUM_MODEL_FLAGS> graphFlags;
315 std::bitset<NUM_MODEL_FLAGS> idFlags;
340 this->
baseModel_ = rcp_implicit_cast<
const Model<base_adapter_t> >(
348 <<
" Model type " << modelType <<
" not yet supported." RCP< GraphModel< base_adapter_t > > graphModel_
OrderingSolution< lno_t, gno_t > * getSolution()
Get the solution to the problem.
RCP< const base_adapter_t > baseInputAdapter_
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.
RCP< const Comm< int > > comm_
RCP< IdentifierModel< base_adapter_t > > identifierModel_
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
RCP< CoordinateModel< base_adapter_t > > coordinateModel_
int order(const RCP< OrderingSolution< typename Adapter::lno_t, typename Adapter::gno_t > > &solution)
Ordering method.
GraphModel defines the interface required for graph models.
The base class for all model classes.
RCP< ParameterList > params_
int order(const RCP< OrderingSolution< lno_t, gno_t > > &solution)
Ordering method.
IdentifierModel defines the interface for all identifier models.
Defines the GraphModel interface.
The class containing ordering solutions.
RCP< const Model< base_adapter_t > > baseModel_
model represents graph within only one rank
int order(const RCP< OrderingSolution< lno_t, gno_t > > &solution)
Ordering method.
RCP< const Environment > envConst_
#define __func__zoltan2__
int order(const RCP< OrderingSolution< lno_t, gno_t > > &solution_)
Ordering method.