51#ifndef _ZOLTAN2_MATCHINGPROBLEM_HPP_
52#define _ZOLTAN2_MATCHINGPROBLEM_HPP_
57#include <Zoltan2_MatchingAlgorithms.hpp>
65using Teuchos::rcp_dynamic_cast;
90template<
typename Adapter>
91class MatchingProblem :
public Problem<Adapter>
95 typedef typename Adapter::scalar_t scalar_t;
96 typedef typename Adapter::gno_t
gno_t;
97 typedef typename Adapter::lno_t
lno_t;
98 typedef typename Adapter::user_t
user_t;
101#ifdef HAVE_ZOLTAN2_MPI
102 typedef Teuchos::OpaqueWrapper<MPI_Comm> mpiWrapper_t;
107 virtual ~MatchingProblem() {};
110#ifdef HAVE_ZOLTAN2_MPI
113 MatchingProblem(Adapter *A, ParameterList *p, MPI_Comm comm)
114 : Problem<Adapter>(A, p, comm)
117 createMatchingProblem();
123 MatchingProblem(Adapter *A, ParameterList *p) : Problem<Adapter>(A, p)
126 createMatchingProblem();
145 void solve(
bool updateInputData=
true);
151 MatchingSolution<Adapter> *getSolution() {
153 return solution_.getRawPtr();
157 void createMatchingProblem();
159 RCP<MatchingSolution<Adapter> > solution_;
165template <
typename Adapter>
166void MatchingProblem<Adapter>::solve(
bool newData)
170 size_t nVtx = this->baseModel_->getLocalNumObjects();
174 this->solution_ = rcp(
new MatchingSolution<Adapter>(nVtx));
181 std::string method = this->params_->template get<std::string>(
"color_method",
"SerialGreedy");
186 if (method.compare(
"SerialGreedy") == 0)
189 this->env_, this->comm_);
190 alg.color(this->solution_);
193 else if (method.compare(
"speculative") == 0)
195 AlgGM<base_adapter_t> alg(this->graphModel_, this->comm_);
196 alg.color(this->solution_, this->params_);
217template <
typename Adapter>
218void MatchingProblem<Adapter>::createMatchingProblem()
221 using Teuchos::ParameterList;
236 std::bitset<NUM_MODEL_FLAGS> graphFlags;
237 std::bitset<NUM_MODEL_FLAGS> idFlags;
245 this->baseInputAdapter_, this->envConst_, this->comm_, graphFlags));
247 this->baseModel_ = rcp_implicit_cast<const Model<base_adapter_t> >(
256 std::cout <<
__func__zoltan2__ <<
" Model type " << modelType <<
" not yet supported."
Zoltan2::BasicUserTypes< zscalar_t, zlno_t, zgno_t > user_t
#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.
GraphModel defines the interface required for graph models.
Problem base class from which other classes (PartitioningProblem, ColoringProblem,...
map_t::local_ordinal_type lno_t
map_t::global_ordinal_type gno_t
Zoltan2::BaseAdapter< userTypes_t > base_adapter_t
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