50#ifndef _ZOLTAN2_COLORINGPROBLEM_HPP_
51#define _ZOLTAN2_COLORINGPROBLEM_HPP_
87template<
typename Adapter>
93 typedef typename Adapter::gno_t
gno_t;
94 typedef typename Adapter::lno_t
lno_t;
95 typedef typename Adapter::user_t
user_t;
98#ifdef HAVE_ZOLTAN2_MPI
99 typedef Teuchos::OpaqueWrapper<MPI_Comm> mpiWrapper_t;
109 const Teuchos::RCP<
const Teuchos::Comm<int> > &comm) :
113 createColoringProblem();
116#ifdef HAVE_ZOLTAN2_MPI
121 rcp<const Comm<int> >(new
Teuchos::MpiComm<int>(
122 Teuchos::opaqueWrapper(mpicomm))))
136 RCP<Teuchos::StringValidator> color_method_Validator = Teuchos::rcp(
137 new Teuchos::StringValidator(
138 Teuchos::tuple<std::string>(
"SerialGreedy",
"D1",
"D1-2GL",
"D2",
"PD2" )));
139 pl.set(
"color_method",
"SerialGreedy",
"coloring algorithm",
140 color_method_Validator);
163 void solve(
bool updateInputData=
true);
171 return solution_.getRawPtr();
175 void createColoringProblem();
177 RCP<ColoringSolution<Adapter> > solution_;
182template <
typename Adapter>
187 size_t nVtx = this->baseModel_->getLocalNumObjects();
198 std::string method = this->params_->template get<std::string>(
"color_method",
"SerialGreedy");
203 if (method.compare(
"SerialGreedy") == 0)
206 this->env_, this->comm_);
207 alg.
color(this->solution_);
209 else if (method.compare(
"D1") == 0)
212 this->env_, this->comm_);
213 alg.
color(this->solution_);
215 else if (method.compare(
"D1-2GL") == 0)
218 this->env_, this->comm_);
219 alg.
color(this->solution_);
220 }
else if(method.compare(
"D2") == 0)
223 this->env_, this->comm_);
224 alg.
color(this->solution_);
225 }
else if (method.compare(
"PD2") == 0)
228 this->env_, this->comm_);
229 alg.
color(this->solution_);
248template <
typename Adapter>
252 using Teuchos::ParameterList;
267 std::bitset<NUM_MODEL_FLAGS> graphFlags;
276 this->baseInputAdapter_, this->envConst_, this->comm_, graphFlags));
278 this->baseModel_ = rcp_implicit_cast<const Model<base_adapter_t> >(
288 <<
" not yet supported." << std::endl;
Defines the ColoringSolution class.
#define Z2_FORWARD_EXCEPTIONS
Forward an exception back through call stack.
#define __func__zoltan2__
Defines the GraphModel interface.
Defines the Problem base class.
Gathering definitions used in software development.
void color(const RCP< ColoringSolution< Adapter > > &solution)
Coloring method.
void color(const RCP< ColoringSolution< Adapter > > &solution)
Coloring method.
void color(const RCP< ColoringSolution< Adapter > > &solution)
Coloring method.
ColoringProblem sets up coloring problems for the user.
Adapter::scalar_t scalar_t
Adapter::base_adapter_t base_adapter_t
void solve(bool updateInputData=true)
Direct the problem to create a solution.
ColoringProblem(Adapter *A, ParameterList *p, const Teuchos::RCP< const Teuchos::Comm< int > > &comm)
Constructor that uses a Teuchos::Comm.
virtual ~ColoringProblem()
Destructor.
static void getValidParameters(ParameterList &pl)
Set up validators specific to this Problem.
ColoringSolution< Adapter > * getSolution()
Get the solution to the problem.
ColoringProblem(Adapter *A, ParameterList *p)
Constructor that uses a default communicator.
The class containing coloring solution.
static RCP< Teuchos::BoolParameterEntryValidator > getBoolValidator()
Exists to make setting up validators less cluttered.
static RCP< Teuchos::AnyNumberParameterEntryValidator > getAnyIntValidator()
Exists to make setting up validators less cluttered.
GraphModel defines the interface required for graph models.
Problem base class from which other classes (PartitioningProblem, ColoringProblem,...
Created by mbenlioglu on Aug 31, 2020.
ModelType
An identifier for the general type of model.
@ REMOVE_SELF_EDGES
algorithm requires no self edges
@ BUILD_LOCAL_GRAPH
model represents graph within only one rank