50 #ifndef _ZOLTAN2_ORDERINGPROBLEM_HPP_ 51 #define _ZOLTAN2_ORDERINGPROBLEM_HPP_ 59 #ifdef HAVE_ZOLTAN2_OVIS 65 using Teuchos::rcp_dynamic_cast;
87 template<
typename Adapter>
93 typedef typename Adapter::gid_t
gid_t;
99 #ifdef HAVE_ZOLTAN2_MPI 100 typedef Teuchos::OpaqueWrapper<MPI_Comm> mpiWrapper_t;
108 #ifdef HAVE_ZOLTAN2_MPI 115 createOrderingProblem();
124 createOrderingProblem();
143 void solve(
bool updateInputData=
true);
150 return solution_.getRawPtr();
154 void createOrderingProblem();
156 RCP<OrderingSolution<gid_t, lno_t> > solution_;
158 RCP<Comm<int> > problemComm_;
159 RCP<const Comm<int> > problemCommConst_;
161 #ifdef HAVE_ZOLTAN2_MPI 167 template <
typename Adapter>
172 size_t nVtx = this->baseModel_->getLocalNumObjects();
185 string method = this->params_->template get<string>(
"order_method",
"rcm");
190 if (method.compare(
"rcm") == 0)
192 AlgRCM<base_adapter_t>(this->graphModel_, this->solution_, this->params_,
195 else if (method.compare(
"natural") == 0)
197 AlgNatural<base_adapter_t>(this->identifierModel_, this->solution_, this->params_, problemComm_);
199 else if (method.compare(
"random") == 0)
201 AlgRandom<base_adapter_t>(this->identifierModel_, this->solution_, this->params_, problemComm_);
203 else if (method.compare(
"minimum_degree") == 0)
205 string pkg = this->params_->template get<string>(
"order_package",
"amd");
206 if (pkg.compare(
"amd") == 0)
208 AlgAMD<base_adapter_t>(this->graphModel_, this->solution_, this->params_,
215 #ifdef HAVE_ZOLTAN2_MPI 219 RCP<const mpiWrapper_t > wrappedComm = rcp(
new mpiWrapper_t(mpiComm_));
220 problemComm_ = rcp(
new Teuchos::MpiComm<int>(wrappedComm));
221 problemCommConst_ = rcp_const_cast<
const Comm<int> > (problemComm_);
240 template <
typename Adapter>
244 using Teuchos::ParameterList;
250 #ifdef HAVE_ZOLTAN2_OVIS 251 ovis_enabled(this->comm_->getRank());
256 problemComm_ = this->comm_->duplicate();
257 problemCommConst_ = rcp_const_cast<
const Comm<int> > (problemComm_);
260 #ifdef HAVE_ZOLTAN2_MPI 264 Comm<int> *c = problemComm_.getRawPtr();
265 Teuchos::MpiComm<int> *mc =
dynamic_cast<Teuchos::MpiComm<int> *
>(c);
267 RCP<const mpiWrapper_t> wrappedComm = mc->getRawMpiComm();
268 mpiComm_ = (*wrappedComm.getRawPtr())();
271 mpiComm_ = MPI_COMM_SELF;
282 string method = this->params_->template get<string>(
"order_method",
"rcm");
284 if ((method ==
string(
"rcm")) ||
285 (method ==
string(
"minimum_degree"))) {
291 std::bitset<NUM_MODEL_FLAGS> graphFlags;
292 std::bitset<NUM_MODEL_FLAGS> idFlags;
299 this->baseInputAdapter_, this->envConst_, problemCommConst_, graphFlags));
310 this->baseInputAdapter_, this->envConst_, problemCommConst_, idFlags));
312 this->baseModel_ = rcp_implicit_cast<
const Model<base_adapter_t> >(
313 this->identifierModel_);
319 cout << __func__ <<
" Model type " << modelType <<
" not yet supported." 324 cout << __func__ <<
" Invalid model" << modelType << endl;
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.
Zoltan2::BasicUserTypes< scalar_t, gno_t, lno_t, gno_t > user_t
OrderingProblem sets up ordering problems for the user.
OrderingSolution< gid_t, lno_t > * getSolution()
Get the solution to the problem.
OrderingProblem(Adapter *A, ParameterList *p)
Constructor that uses a default communicator.
Problem base class from which other classes (PartitioningProblem, ColoringProblem, OrderingProblem, MatchingProblem, etc.) derive.
Adapter::scalar_t scalar_t
Defines the Problem base class.
Adapter::base_adapter_t base_adapter_t
GraphModel defines the interface required for graph models.
The base class for all model classes.
algorithm requires no self edges
IdentifierModel defines the interface for all identifier models.
Defines the GraphModel interface.
The class containing ordering solutions and metrics.