47#ifndef _ZOLTAN2_SPHYNXPROBLEM_HPP_
48#define _ZOLTAN2_SPHYNXPROBLEM_HPP_
75 RCP<Teuchos::StringValidator> sphynx_preconditionner_type_method_Validator =
76 Teuchos::rcp(
new Teuchos::StringValidator(Teuchos::tuple<std::string>(
"muelu",
"jacobi",
"polynomial")));
78 pl.set(
"sphynx_preconditioner_type",
"polynomial",
"Sphynx preconditioner type", sphynx_preconditionner_type_method_Validator);
81 RCP<Teuchos::StringValidator> sphynx_initial_guess_method_Validator =
82 Teuchos::rcp(
new Teuchos::StringValidator(Teuchos::tuple<std::string>(
"random",
"constants")));
84 pl.set(
"sphynx_initial_guess",
"random",
"Sphynx initial guess", sphynx_initial_guess_method_Validator);
86 RCP<Teuchos::StringValidator> sphynx_problem_type_method_Validator =
87 Teuchos::rcp(
new Teuchos::StringValidator(Teuchos::tuple<std::string>(
"combinatorial",
"normalized",
"generalized")));
89 pl.set(
"sphynx_problem_type",
"combinatorial",
"Sphynx problem type", sphynx_problem_type_method_Validator);
91 RCP<Teuchos::EnhancedNumberValidator<int>> sphynx_verbosity_validator =
92 Teuchos::rcp(
new Teuchos::EnhancedNumberValidator<int>(0, 1) );
93 pl.set(
"sphynx_verbosity", 0,
"Sphynx verbosity.", sphynx_verbosity_validator);
101 const Teuchos::ParameterList &plSome,
102 const Teuchos::ParameterList &plAll,
103 Teuchos::ParameterList &plVal)
105 ParameterList::ConstIterator next = plSome.begin();
107 while (next != plSome.end()){
109 const std::string &name = next->first;
110 const ParameterEntry &entrySome = plSome.getEntry(name);
111 const ParameterEntry &entryAll = plAll.getEntry(name);
113 if (entrySome.isList()){
118 plVal.setEntry(name, entryAll);
125 template <
typename Adapter>
141 Teuchos::ParameterList *p,
142 RCP<Teuchos::ParameterList> sphynxParams,
143 const RCP<
const Teuchos::Comm<int> > &comm):
147 ParameterList validParams;
149 ParameterList allParameters;
156 sphynxParams_->validateParametersAndSetDefaults(validParams, 0);
157 this->
env_->convertStringToInt(*sphynxParams_.get());
160 const Teuchos::ParameterEntry *pe = this->
params_->getEntryPtr(
"num_global_parts");
162 nparts = pe->getValue<
int>(&nparts);
165 throw std::runtime_error(
"\nUser did not set num_global_parts"
166 "in the parameter list!n");
169#ifdef HAVE_ZOLTAN2_MPI
171 SphynxProblem(Adapter *A, ParameterList *p, RCP<Teuchos::ParameterList> sphynxParams, MPI_Comm mpicomm):
173 rcp<const Comm<int> >(new
Teuchos::MpiComm<int>(
174 Teuchos::opaqueWrapper(mpicomm))))
179 SphynxProblem(Adapter *A, ParameterList *p, RCP<Teuchos::ParameterList> sphynxParams):
191 void processAlgorithmName(
const std::string& algorithm,
const std::string& defString,
const std::string& model,
192 Environment &env,
bool& removeSelfEdges,
bool& isGraphType,
bool& needConsecutiveGlobalIds)
override;
208 Teuchos::RCP<Teuchos::ParameterList> envParams_;
209 RCP<ParameterList> sphynxParams_;
218 template <
typename Adapter>
220 const std::string &algorithm,
const std::string &defString,
221 const std::string &model,
Environment &env,
bool &removeSelfEdges,
222 bool &isGraphType,
bool &needConsecutiveGlobalIds)
224 this->algName_ = std::string(
"sphynx");
227 template <
typename Adapter>
231 if (this->algName_ == std::string(
"sphynx")) {
236 this->inputAdapter_));
239 throw std::logic_error(
"partitioning algorithm not supported");
#define Z2_FORWARD_EXCEPTIONS
Forward an exception back through call stack.
Defines the PartitioningProblem class.
Defines the PartitioningSolution class.
The user parameters, debug, timing and memory profiling output objects, and error checking methods.
static RCP< Teuchos::BoolParameterEntryValidator > getBoolValidator()
Exists to make setting up validators less cluttered.
PartitioningProblem sets up partitioning problems for the user.
RCP< PartitioningSolution< Adapter > > solution_
A PartitioningSolution is a solution to a partitioning problem.
RCP< ParameterList > params_
typename Adapter::part_t part_t
SphynxProblem(Adapter *A, Teuchos::ParameterList *p, RCP< Teuchos::ParameterList > sphynxParams, const RCP< const Teuchos::Comm< int > > &comm)
void createAlgorithm() override
SphynxProblem(Adapter *A, ParameterList *p, RCP< Teuchos::ParameterList > sphynxParams)
const PartitioningSolution< Adapter > & getSolution()
void processAlgorithmName(const std::string &algorithm, const std::string &defString, const std::string &model, Environment &env, bool &removeSelfEdges, bool &isGraphType, bool &needConsecutiveGlobalIds) override
Adapter::base_adapter_t base_adapter_t
typename Adapter::scalar_t weight_t
Created by mbenlioglu on Aug 31, 2020.
static void getSphynxValidParameters(ParameterList &pl)
Set up validators specific to this algorithm.
static void setSphynxValidatorsInList(const Teuchos::ParameterList &plSome, const Teuchos::ParameterList &plAll, Teuchos::ParameterList &plVal)