50 #ifndef _ZOLTAN2_COLORINGPROBLEM_HPP_
51 #define _ZOLTAN2_COLORINGPROBLEM_HPP_
87 template<
typename Adapter>
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_;
178 size_t localNumObjects_;
183 template <
typename Adapter>
197 std::string method = this->params_->template get<std::string>(
"color_method",
"SerialGreedy");
202 if (method.compare(
"SerialGreedy") == 0)
209 this->env_, this->comm_, graphFlags);
210 alg.
color(this->solution_);
212 else if (method.compare(
"D1") == 0)
215 this->env_, this->comm_);
216 alg.
color(this->solution_);
218 else if (method.compare(
"D1-2GL") == 0)
221 this->env_, this->comm_);
222 alg.
color(this->solution_);
223 }
else if(method.compare(
"D2") == 0)
226 this->env_, this->comm_);
227 alg.
color(this->solution_);
228 }
else if (method.compare(
"PD2") == 0)
231 this->env_, this->comm_);
232 alg.
color(this->solution_);
251 template <
typename Adapter>
255 using Teuchos::ParameterList;
267 const auto adapterType = this->baseInputAdapter_->adapterType();
280 localNumObjects_ = this->baseInputAdapter_->getLocalNumIDs();
286 const auto ia =
dynamic_cast<const GraphAdapter<user_t> *
>(&(*(this->baseInputAdapter_)));
287 localNumObjects_ = ia->getLocalNumVertices();
293 const auto ia =
dynamic_cast<const MeshAdapter<user_t> *
>(&(*(this->baseInputAdapter_)));
294 localNumObjects_ = ia->getLocalNumOf(ia->getPrimaryEntityType());
310 <<
" 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