50 #ifndef _ZOLTAN2_COLORINGPROBLEM_HPP_ 51 #define _ZOLTAN2_COLORINGPROBLEM_HPP_ 64 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 createColoringProblem();
125 createColoringProblem();
144 void solve(
bool updateInputData=
true);
152 return solution_.getRawPtr();
156 void createColoringProblem();
158 RCP<ColoringSolution<Adapter> > solution_;
160 RCP<Comm<int> > problemComm_;
161 RCP<const Comm<int> > problemCommConst_;
163 #ifdef HAVE_ZOLTAN2_MPI 170 template <
typename Adapter>
175 size_t nVtx = this->
baseModel_->getLocalNumObjects();
186 std::string method = this->
params_->template get<std::string>(
"color_method",
"SerialGreedy");
191 if (method.compare(
"SerialGreedy") == 0)
194 this->
env_, problemComm_);
195 alg.
color(this->solution_);
198 else if (method.compare(
"speculative") == 0)
200 AlgGM<base_adapter_t> alg(this->
graphModel_, problemComm_);
201 alg.color(this->solution_, this->
params_);
221 template <
typename Adapter>
225 using Teuchos::ParameterList;
233 problemComm_ = this->
comm_->duplicate();
234 problemCommConst_ = rcp_const_cast<
const Comm<int> > (problemComm_);
237 #ifdef HAVE_ZOLTAN2_MPI 241 Comm<int> *c = problemComm_.getRawPtr();
242 Teuchos::MpiComm<int> *mc =
dynamic_cast<Teuchos::MpiComm<int> *
>(c);
244 RCP<const mpiWrapper_t> wrappedComm = mc->getRawMpiComm();
245 mpiComm_ = (*wrappedComm.getRawPtr())();
248 mpiComm_ = MPI_COMM_SELF;
260 std::bitset<NUM_MODEL_FLAGS> graphFlags;
261 std::bitset<NUM_MODEL_FLAGS> idFlags;
281 <<
" not yet supported." << std::endl;
RCP< GraphModel< base_adapter_t > > graphModel_
RCP< const base_adapter_t > baseInputAdapter_
ColoringProblem sets up coloring problems for the user.
Adapter::scalar_t scalar_t
ModelType
An identifier for the general type of model.
#define Z2_FORWARD_EXCEPTIONS
Forward an exception back through call stack.
void solve(bool updateInputData=true)
Direct the problem to create a solution.
ColoringSolution< Adapter > * getSolution()
Get the solution to the problem.
Adapter::base_adapter_t base_adapter_t
RCP< const Comm< int > > comm_
void color(const RCP< ColoringSolution< Adapter > > &solution)
Coloring method.
algorithm requires no self edges
Problem base class from which other classes (PartitioningProblem, ColoringProblem, OrderingProblem, MatchingProblem, etc.) derive.
Defines the Problem base class.
GraphModel defines the interface required for graph models.
Gathering definitions used in software development.
The base class for all model classes.
RCP< ParameterList > params_
Defines the ColoringSolution class.
ColoringProblem(Adapter *A, ParameterList *p)
Constructor that uses a default communicator.
Defines the GraphModel interface.
RCP< const Model< base_adapter_t > > baseModel_
model represents graph within only one rank
RCP< const Environment > envConst_
#define __func__zoltan2__
virtual ~ColoringProblem()
Destructor.
The class containing coloring solution.