14 #ifndef ZOLTAN2_EVALUATE_FACTORY_HPP
15 #define ZOLTAN2_EVALUATE_FACTORY_HPP
23 using namespace Zoltan2_TestingFramework;
24 using namespace Zoltan2;
26 namespace Zoltan2_TestingFramework {
41 RCP<AdapterFactory> adapterFactory,
42 ParameterList *params,
43 RCP<ProblemFactory> problemFactory) {
45 adapterType = adapterFactory->getMainAdapterType();
46 problem_name = problemName;
48 if (problem_name ==
"partitioning") {
49 #define PARTITIONING_PROBLEM(adapterClass) rcp_dynamic_cast< \
50 PartitioningProblem<adapterClass>> (problemFactory->getProblem())
52 #define EVALUATE_PARTITION(adapterClass) \
53 const adapterClass * pAdapterClassUpCast = dynamic_cast< \
54 const adapterClass *>(adapterFactory->getMainAdapter()); \
55 if(!pAdapterClassUpCast) throw std::logic_error( \
56 "Bad adapter class cast!" ); \
57 evaluate = rcp(new EvaluatePartition<adapterClass>( \
58 pAdapterClassUpCast, params, \
59 problemFactory->getProblem()->getComm(), \
60 (&PARTITIONING_PROBLEM(adapterClass)->getSolution())));
64 else if(problem_name ==
"ordering") {
65 #define ORDERING_PROBLEM(adapterClass) rcp_dynamic_cast< \
66 OrderingProblem<adapterClass>> (problemFactory->getProblem())
68 #define LOCAL_ORDERING(adapterClass) \
69 const adapterClass * pAdapterClassUpCast = dynamic_cast< \
70 const adapterClass *>(adapterFactory->getMainAdapter()); \
71 if(!pAdapterClassUpCast) throw std::logic_error( \
72 "Bad adapter class cast!"); \
73 evaluate = rcp(new EvaluateLocalOrdering<adapterClass>( \
74 pAdapterClassUpCast, params, \
75 problemFactory->getProblem()->getComm(), \
76 ORDERING_PROBLEM(adapterClass)->getLocalOrderingSolution()));
79 #define GLOBAL_ORDERING(adapterClass) \
80 const adapterClass * pAdapterClassUpCast = dynamic_cast< \
81 const adapterClass *>(adapterFactory->getMainAdapter()); \
82 if(!pAdapterClassUpCast) throw std::logic_error( \
83 "Bad adapter class cast!" ); \
84 evaluate = rcp(new EvaluateGlobalOrdering<adapterClass>( \
85 pAdapterClassUpCast, \
86 params, ORDERING_PROBLEM(adapterClass)->getComm(), \
87 ORDERING_PROBLEM(adapterClass)->getGlobalOrderingSolution()));
91 else if(problem_name ==
"coloring") {
98 if(evaluate == Teuchos::null) {
99 throw std::logic_error(
"EvaluateFactory failed to create!");
108 std::string problem_name;
110 RCP<EvaluateBaseClassRoot> evaluate;
113 #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()