10 #ifndef _ZOLTAN2_ALGFORTESTINGONLY_HPP_
11 #define _ZOLTAN2_ALGFORTESTINGONLY_HPP_
25 template <
typename Adapter>
30 const RCP<const Environment> env;
31 const RCP<const Comm<int> > comm;
32 const RCP<const typename Adapter::base_adapter_t> adapter;
37 const RCP<const Environment> &env__,
38 const RCP<
const Comm<int> > &problemComm__,
39 const RCP<const typename Adapter::base_adapter_t> &adapter__):
40 env(env__), comm(problemComm__), adapter(adapter__)
48 RCP<Teuchos::EnhancedNumberValidator<int>> forTestingOnlyFlag_Validator =
49 Teuchos::rcp(
new Teuchos::EnhancedNumberValidator<int>(0, 1000, 1, 0) );
50 pl.set(
"forTestingOnlyFlag", 0,
"Used only for testing; look at "
51 "Zoltan2_AlgForTestingOnly for interpretations",
52 forTestingOnlyFlag_Validator);
57 size_t nObj = adapter->getLocalNumIDs();
58 ArrayRCP<part_t> partList(
new part_t[nObj], 0, nObj,
true);
59 size_t nGlobalParts = solution->getTargetGlobalNumberOfParts();
61 const Teuchos::ParameterEntry *pe =
62 env->getParameters().getEntryPtr(
"forTestingOnlyFlag");
63 int forTestingOnlyFlag = pe->getValue<
int>(&forTestingOnlyFlag);
65 switch (forTestingOnlyFlag) {
69 if (comm->getRank() == 0) {
70 for (
size_t i = 0; i < nObj; i++) partList[i] = 0;
73 for (
size_t i = 0; i < nObj; i++)
74 if (i % 2) partList[i] = nGlobalParts - 1;
81 if (comm->getRank() == 0) {
82 for (
size_t i = 0; i < nObj; i++) partList[i] = 0;
85 for (
size_t i = 0; i < nObj; i++)
86 if (i % 2) partList[i] = 0;
87 else partList[i] = nGlobalParts - 1;
91 throw std::runtime_error(
"invalid forTestingOnlyFlag value");
94 std::cout << comm->getRank() <<
" forTestingOnly " << forTestingOnlyFlag
96 for (
size_t i = 0; i < nObj; i++)
97 std::cout << partList[i] <<
" ";
98 std::cout << std::endl;
100 solution->setParts(partList);
static void getValidParameters(ParameterList &pl)
Set up validators specific to this algorithm.
Defines the PartitioningSolution class.
SparseMatrixAdapter_t::part_t part_t
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__)