41 MPI_Comm_size(MPI_COMM_WORLD, &n_proc);
47 MPI_Comm_rank(MPI_COMM_WORLD, &my_id);
53 const int entries_per_process = 10;
55 const long long begin_index = ((
long long)my_id)*entries_per_process;
56 const long long end_index = ((
long long)(my_id+1))*entries_per_process;
58 const long long local_begin = std::max(0LL, begin_index-entries_per_process/2);
59 const long long local_end = entries_per_process*n_proc;
62 std::vector<unsigned long long> ghosted_indices;
63 ghosted_indices.reserve(local_end-local_begin);
64 for (
long long i = local_begin; i< local_end; ++i)
65 ghosted_indices.push_back(i);
68 local_end-local_begin,
69 reinterpret_cast<long long*
>(&ghosted_indices[0]),
77 std::vector<unsigned long long> distributed_indices;
78 distributed_indices.reserve(entries_per_process*n_proc);
79 for (
long long i = begin_index; i< end_index; ++i)
80 distributed_indices.push_back(i);
82 (entries_per_process*n_proc,
84 reinterpret_cast<long long*
>(&distributed_indices[0]),
103 int lclErr = (ierr == 0) ? 0 : 1;
108 (void) comm.
MinAll (&lclErr, &gblErr, count);
109 if (comm.
MyPID () == 0 && gblErr != 0) {
111 cout <<
"tests FAILED: Import failed (returned nonzero error code) "
112 "on at least one process." << endl;
116 cout <<
"Distributed:" << endl;
117 for (
long long i=begin_index; i<end_index; ++i)
119 const int trilinos_i = v_distributed.
Map().
LID(i);
120 double value = v_distributed[0][trilinos_i];
121 cout <<
"proc " << my_id <<
" " << i <<
": " << value << endl;
123 cout <<
"tests FAILED: value = " << value << endl;
virtual int MinAll(double *PartialMins, double *GlobalMins, int Count) const =0
Epetra_Comm Global Min function.
int Import(const Epetra_SrcDistObject &A, const Epetra_Import &Importer, Epetra_CombineMode CombineMode, const Epetra_OffsetIndex *Indexor=0)
Imports an Epetra_DistObject using the Epetra_Import object.
int main(int argc, char **argv)