45 #ifndef _ZOLTAN2_ALGFORTESTINGONLY_HPP_ 46 #define _ZOLTAN2_ALGFORTESTINGONLY_HPP_ 60 template <
typename Adapter>
64 typedef typename Adapter::part_t part_t;
65 const RCP<const Environment> env;
66 const RCP<const Comm<int> > comm;
67 const RCP<const typename Adapter::base_adapter_t> adapter;
72 const RCP<const Environment> &env__,
73 const RCP<
const Comm<int> > &problemComm__,
74 const RCP<const typename Adapter::base_adapter_t> &adapter__):
75 env(env__), comm(problemComm__), adapter(adapter__)
81 size_t nObj = adapter->getLocalNumIDs();
82 ArrayRCP<part_t> partList(
new part_t[nObj], 0, nObj,
true);
83 size_t nGlobalParts = solution->getTargetGlobalNumberOfParts();
85 const Teuchos::ParameterEntry *pe =
86 env->getParameters().getEntryPtr(
"forTestingOnlyFlag");
87 int forTestingOnlyFlag = pe->getValue<
int>(&forTestingOnlyFlag);
89 switch (forTestingOnlyFlag) {
93 if (comm->getRank() == 0) {
94 for (
size_t i = 0; i < nObj; i++) partList[i] = 0;
97 for (
size_t i = 0; i < nObj; i++)
98 if (i % 2) partList[i] = nGlobalParts - 1;
105 if (comm->getRank() == 0) {
106 for (
size_t i = 0; i < nObj; i++) partList[i] = 0;
109 for (
size_t i = 0; i < nObj; i++)
110 if (i % 2) partList[i] = 0;
111 else partList[i] = nGlobalParts - 1;
115 throw std::runtime_error(
"invalid forTestingOnlyFlag value");
118 std::cout << comm->getRank() <<
" forTestingOnly " << forTestingOnlyFlag
120 for (
size_t i = 0; i < nObj; i++)
121 std::cout << partList[i] <<
" ";
122 std::cout << std::endl;
124 solution->setParts(partList);
Defines the PartitioningSolution class.
A PartitioningSolution is a solution to a partitioning problem.
void partition(const RCP< PartitioningSolution< Adapter > > &solution)
Partitioning method.
Algorithm defines the base class for all algorithms.
AlgForTestingOnly(const RCP< const Environment > &env__, const RCP< const Comm< int > > &problemComm__, const RCP< const typename Adapter::base_adapter_t > &adapter__)