14 #ifndef _ZOLTAN2_COLORINGPROBLEM_HPP_
15 #define _ZOLTAN2_COLORINGPROBLEM_HPP_
51 template<
typename Adapter>
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_;
147 template <
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_);
215 template <
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;
Zoltan2::BaseAdapter< userTypes_t > base_adapter_t
ColoringProblem(Adapter *A, ParameterList *p, const Teuchos::RCP< const Teuchos::Comm< int > > &comm)
Constructor that uses a Teuchos::Comm.
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.
static RCP< Teuchos::BoolParameterEntryValidator > getBoolValidator()
Exists to make setting up validators less cluttered.
void solve(bool updateInputData=true)
Direct the problem to create a solution.
ColoringSolution< Adapter > * getSolution()
Get the solution to the problem.
std::bitset< NUM_MODEL_FLAGS > modelFlag_t
map_t::global_ordinal_type gno_t
Adapter::base_adapter_t base_adapter_t
void color(const RCP< ColoringSolution< Adapter > > &solution)
Coloring method.
algorithm requires no self edges
void color(const RCP< ColoringSolution< Adapter > > &solution)
Coloring method.
void color(const RCP< ColoringSolution< Adapter > > &solution)
Coloring method.
Problem base class from which other classes (PartitioningProblem, ColoringProblem, OrderingProblem, MatchingProblem, etc.) derive.
Defines the Problem base class.
map_t::local_ordinal_type lno_t
static RCP< Teuchos::AnyNumberParameterEntryValidator > getAnyIntValidator()
Exists to make setting up validators less cluttered.
static void getValidParameters(ParameterList &pl)
Set up validators specific to this Problem.
Gathering definitions used in software development.
Defines the ColoringSolution class.
ColoringProblem(Adapter *A, ParameterList *p)
Constructor that uses a default communicator.
Defines the GraphModel interface.
model represents graph within only one rank
#define __func__zoltan2__
virtual ~ColoringProblem()
Destructor.
The class containing coloring solution.
Zoltan2::BasicUserTypes< zscalar_t, zlno_t, zgno_t > user_t