50 #ifndef ZOLTAN2_EVALUATE_FACTORY_HPP
51 #define ZOLTAN2_EVALUATE_FACTORY_HPP
59 using namespace Zoltan2_TestingFramework;
60 using namespace Zoltan2;
62 namespace Zoltan2_TestingFramework {
77 RCP<AdapterFactory> adapterFactory,
78 ParameterList *params,
79 RCP<ProblemFactory> problemFactory) {
81 adapterType = adapterFactory->getMainAdapterType();
82 problem_name = problemName;
84 if (problem_name ==
"partitioning") {
85 #define PARTITIONING_PROBLEM(adapterClass) rcp_dynamic_cast< \
86 PartitioningProblem<adapterClass>> (problemFactory->getProblem())
88 #define EVALUATE_PARTITION(adapterClass) \
89 const adapterClass * pAdapterClassUpCast = dynamic_cast< \
90 const adapterClass *>(adapterFactory->getMainAdapter()); \
91 if(!pAdapterClassUpCast) throw std::logic_error( \
92 "Bad adapter class cast!" ); \
93 evaluate = rcp(new EvaluatePartition<adapterClass>( \
94 pAdapterClassUpCast, params, \
95 problemFactory->getProblem()->getComm(), \
96 (&PARTITIONING_PROBLEM(adapterClass)->getSolution())));
100 else if(problem_name ==
"ordering") {
101 #define ORDERING_PROBLEM(adapterClass) rcp_dynamic_cast< \
102 OrderingProblem<adapterClass>> (problemFactory->getProblem())
104 #define LOCAL_ORDERING(adapterClass) \
105 const adapterClass * pAdapterClassUpCast = dynamic_cast< \
106 const adapterClass *>(adapterFactory->getMainAdapter()); \
107 if(!pAdapterClassUpCast) throw std::logic_error( \
108 "Bad adapter class cast!"); \
109 evaluate = rcp(new EvaluateLocalOrdering<adapterClass>( \
110 pAdapterClassUpCast, params, \
111 problemFactory->getProblem()->getComm(), \
112 ORDERING_PROBLEM(adapterClass)->getLocalOrderingSolution()));
115 #define GLOBAL_ORDERING(adapterClass) \
116 const adapterClass * pAdapterClassUpCast = dynamic_cast< \
117 const adapterClass *>(adapterFactory->getMainAdapter()); \
118 if(!pAdapterClassUpCast) throw std::logic_error( \
119 "Bad adapter class cast!" ); \
120 evaluate = rcp(new EvaluateGlobalOrdering<adapterClass>( \
121 pAdapterClassUpCast, \
122 params, ORDERING_PROBLEM(adapterClass)->getComm(), \
123 ORDERING_PROBLEM(adapterClass)->getGlobalOrderingSolution()));
127 else if(problem_name ==
"coloring") {
134 if(evaluate == Teuchos::null) {
135 throw std::logic_error(
"EvaluateFactory failed to create!");
144 std::string problem_name;
146 RCP<EvaluateBaseClassRoot> evaluate;
149 #endif // ZOLTAN2_EVALUATE_FACTORY_HPP
keep typedefs that commonly appear in many places localized
ProblemFactory class contains 1 static factory method.
#define Z2_TEST_UPCAST(adptr, TEMPLATE_ACTION)
Defines the EvaluatePartition class.
#define LOCAL_ORDERING(adapterClass)
EAdapterType getAdapterType() const
EvaluateFactory(const std::string &problemName, RCP< AdapterFactory > adapterFactory, ParameterList *params, RCP< ProblemFactory > problemFactory)
Zoltan2::EvaluateBaseClass factory method
Defines the Zoltan2_EvaluateOrdering.hpp class.
Defines the OrderingProblem class.
const std::string & getProblemName() const
#define EVALUATE_PARTITION(adapterClass)
RCP< EvaluateBaseClassRoot > getEvaluateClass()