14#ifndef _ZOLTAN2_COLORINGPROBLEM_HPP_
15#define _ZOLTAN2_COLORINGPROBLEM_HPP_
51template<
typename Adapter>
57 typedef typename Adapter::gno_t
gno_t;
58 typedef typename Adapter::lno_t
lno_t;
59 typedef typename Adapter::user_t
user_t;
62#ifdef HAVE_ZOLTAN2_MPI
63 typedef Teuchos::OpaqueWrapper<MPI_Comm> mpiWrapper_t;
73 const Teuchos::RCP<
const Teuchos::Comm<int> > &comm) :
77 createColoringProblem();
80#ifdef HAVE_ZOLTAN2_MPI
85 rcp<const Comm<int> >(new
Teuchos::MpiComm<int>(
86 Teuchos::opaqueWrapper(mpicomm))))
100 RCP<Teuchos::StringValidator> color_method_Validator = Teuchos::rcp(
101 new Teuchos::StringValidator(
102 Teuchos::tuple<std::string>(
"SerialGreedy",
"D1",
"D1-2GL",
"D2",
"PD2" )));
103 pl.set(
"color_method",
"SerialGreedy",
"coloring algorithm",
104 color_method_Validator);
127 void solve(
bool updateInputData=
true);
135 return solution_.getRawPtr();
139 void createColoringProblem();
141 RCP<ColoringSolution<Adapter> > solution_;
142 size_t localNumObjects_;
147template <
typename Adapter>
161 std::string method = this->params_->template get<std::string>(
"color_method",
"SerialGreedy");
166 if (method.compare(
"SerialGreedy") == 0)
173 this->env_, this->comm_, graphFlags);
174 alg.
color(this->solution_);
176 else if (method.compare(
"D1") == 0)
179 this->env_, this->comm_);
180 alg.
color(this->solution_);
182 else if (method.compare(
"D1-2GL") == 0)
185 this->env_, this->comm_);
186 alg.
color(this->solution_);
187 }
else if(method.compare(
"D2") == 0)
190 this->env_, this->comm_);
191 alg.
color(this->solution_);
192 }
else if (method.compare(
"PD2") == 0)
195 this->env_, this->comm_);
196 alg.
color(this->solution_);
215template <
typename Adapter>
219 using Teuchos::ParameterList;
231 const auto adapterType = this->baseInputAdapter_->adapterType();
244 localNumObjects_ = this->baseInputAdapter_->getLocalNumIDs();
250 const auto ia =
dynamic_cast<const GraphAdapter<user_t> *
>(&(*(this->baseInputAdapter_)));
251 localNumObjects_ = ia->getLocalNumVertices();
257 const auto ia =
dynamic_cast<const MeshAdapter<user_t> *
>(&(*(this->baseInputAdapter_)));
258 localNumObjects_ = ia->getLocalNumOf(ia->getPrimaryEntityType());
274 <<
" 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.
Problem base class from which other classes (PartitioningProblem, ColoringProblem,...
Created by mbenlioglu on Aug 31, 2020.
std::bitset< NUM_MODEL_FLAGS > modelFlag_t
ModelType
An identifier for the general type of model.
@ GraphAdapterType
graph data
@ MatrixAdapterType
matrix data
@ MeshAdapterType
mesh data
@ REMOVE_SELF_EDGES
algorithm requires no self edges
@ BUILD_LOCAL_GRAPH
model represents graph within only one rank