17 #include "Epetra_ConfigDefs.h"
19 #include <Epetra_MpiComm.h>
21 #include <Epetra_SerialComm.h>
23 #include <Epetra_MultiVector.h>
29 int main(
int narg,
char *arg[])
31 Tpetra::ScopeGuard scope(&narg, &arg);
32 const Teuchos::RCP<const Teuchos::Comm<int> > comm = Tpetra::getDefaultComm();
37 const int num_parts = 5;
40 int rank = comm->getRank();
43 Teuchos::ParameterList params(
"test params");
44 params.set(
"algorithm",
"multijagged");
45 params.set(
"num_global_parts", num_parts);
48 std::vector<gid_t> global_ids(N);
49 std::iota(global_ids.begin(), global_ids.end(), rank * N);
52 Epetra_MpiComm epetra_comm(MPI_COMM_WORLD);
54 Epetra_SerialComm epetra_comm;
57 Epetra_BlockMap map(-1, N, 1, 0, epetra_comm);
59 typedef Epetra_MultiVector mv_t;
60 Teuchos::RCP<mv_t> mv = Teuchos::rcp(
new mv_t(map, dim));
62 std::vector<int> stride;
63 std::vector<const double *>
weights;
64 Teuchos::RCP<const mv_t> cmv = Teuchos::rcp_const_cast<
const mv_t>(mv);
68 Teuchos::RCP<inputAdapter_t> ia =
69 Teuchos::rcp(
new inputAdapter_t(cmv, weights, stride));
71 Teuchos::RCP<Zoltan2::PartitioningProblem<inputAdapter_t>> problem =
77 Teuchos::RCP<quality_t> metricObject = Teuchos::rcp(
new quality_t(
78 ia.get(), ¶ms, comm, &problem->getSolution()));
81 if (comm->getRank() == 0) {
82 metricObject->printMetrics(std::cout);
83 double imb = metricObject->getObjectCountImbalance();
85 std::cout <<
"balance satisfied " << imb << std::endl;
87 std::cout <<
"balance failed " << imb << std::endl;
92 if(rank == 0 && err == 0) {
93 std::cout <<
"PASS" << std::endl;
Zoltan2::EvaluatePartition< matrixAdapter_t > quality_t
int main(int narg, char **arg)
Defines the PartitioningSolution class.
Defines the XpetraMultiVectorAdapter.
An adapter for Xpetra::MultiVector.
PartitioningProblem sets up partitioning problems for the user.
Defines the PartitioningProblem class.
A class that computes and returns quality metrics.