60 int main(
int argc, 
char *argv[]) {
 
   61 #ifdef HAVE_ZOLTAN2_MPI 
   62   MPI_Init(&argc, &argv);
 
   64   MPI_Comm_size(MPI_COMM_WORLD, &nprocs);
 
   65   MPI_Comm_rank(MPI_COMM_WORLD, &rank);
 
   72   typedef Tpetra::Map<> Map_t;
 
   73   typedef Map_t::local_ordinal_type localId_t;
 
   74   typedef Map_t::global_ordinal_type globalId_t;
 
   75   typedef Tpetra::Details::DefaultTypes::scalar_type scalar_t;
 
   80   int localCount = 40*(rank+1);
 
   81   int totalCount = 20*nprocs*(nprocs+1);
 
   82   int targetCount = totalCount / nprocs;
 
   83   globalId_t *globalIds = 
new globalId_t[localCount];
 
   86     for (
int i=0, num=40; i < nprocs ; i++, num+=40) {
 
   87       std::cout << 
"Rank " << i << 
" generates " << num << 
" ids." << std::endl;
 
   91   globalId_t offset = 0;
 
   92   for (
int i=1; i <= rank; i++) {
 
   96   for (
int i=0; i < localCount; i++) {
 
   97     globalIds[i] = offset++;
 
  109   std::vector<const scalar_t *> noWeights;
 
  110   std::vector<int> noStrides;
 
  112   inputAdapter_t ia(localCount, globalIds, noWeights, noStrides);
 
  117   Teuchos::ParameterList params(
"test params");
 
  118   params.set(
"debug_level", 
"basic_status");
 
  119   params.set(
"debug_procs", 
"0");
 
  120   params.set(
"error_check_level", 
"debug_mode_assertions");
 
  122   params.set(
"algorithm", 
"block");
 
  123   params.set(
"imbalance_tolerance", 1.1);
 
  124   params.set(
"num_global_parts", nprocs);
 
  141   const globalId_t *ids = NULL;
 
  143   std::vector<int> partCounts(nprocs, 0), globalPartCounts(nprocs, 0);
 
  145   for (
size_t i = 0; i < ia.getLocalNumIDs(); i++) {
 
  146     int pp = problem->
getSolution().getPartListView()[i];
 
  147     std::cout << rank << 
" LID " << i << 
" GID " << ids[i]
 
  148               << 
" PART " << pp << std::endl;
 
  152 #ifdef HAVE_ZOLTAN2_MPI 
  153   MPI_Allreduce(&(partCounts[0]), &(globalPartCounts[0]), nprocs,
 
  154                 MPI_INT, MPI_SUM, MPI_COMM_WORLD);
 
  156   for (
int i = 0; i < nprocs; i++) globalPartCounts[i] = partCounts[i];
 
  161     for (
int i = 0; i < nprocs; i++) {
 
  162       if (globalPartCounts[i] != targetCount) {
 
  163         std::cout << 
"FAIL: part " << i << 
" has " << globalPartCounts[i]
 
  164                   << 
" != " << targetCount << 
"; " << ++ierr << 
" errors" 
  169       std::cout << 
"PASS" << std::endl;
 
  175 #ifdef HAVE_ZOLTAN2_MPI 
int main(int narg, char *arg[])
 
A simple class that can be the User template argument for an InputAdapter. 
 
Defines the PartitioningSolution class. 
 
This class represents a collection of global Identifiers and their associated weights, if any. 
 
Defines the BasicIdentifierAdapter class. 
 
const PartitioningSolution< Adapter > & getSolution()
Get the solution to the problem. 
 
PartitioningProblem sets up partitioning problems for the user. 
 
Defines the PartitioningProblem class. 
 
void solve(bool updateInputData=true)
Direct the problem to create a solution.