11 #include <Epetra_config.h>
35 if (comm.
MyPID () == 0) {
41 #ifdef EPETRA_NO_32BIT_GLOBAL_INDICES
50 #endif // EPETRA_NO_32BIT_GLOBAL_INDICES
74 const global_ordinal_type numGlobalEntries = comm.
NumProc () * 5;
80 const global_ordinal_type indexBase = 0;
87 Epetra_Map contigMap (numGlobalEntries, indexBase, comm);
91 throw std::logic_error (
"The supposedly contiguous Map isn't contiguous.");
104 const int numGblIndsPerProc = 5;
105 global_ordinal_type* gblIndList =
new global_ordinal_type [numGblIndsPerProc];
107 const int numProcs = comm.
NumProc ();
108 const int myRank = comm.
MyPID ();
109 for (
int k = 0; k < numGblIndsPerProc; ++k) {
110 gblIndList[k] = myRank + k*numProcs;
113 Epetra_Map cyclicMap (numGlobalEntries, numGblIndsPerProc,
114 gblIndList, indexBase, comm);
118 if (gblIndList != NULL) {
119 delete [] gblIndList;
126 throw std::logic_error (
"The cyclic Map claims to be contiguous.");
137 throw std::logic_error (
"contigMap should not be the same as cyclicMap.");
169 const double alpha = 3.14159;
170 const double beta = 2.71828;
171 const double gamma = -10.0;
178 (void) x.
Update (alpha, z, beta);
182 y.
Update (alpha, x, beta, z, gamma);
189 double theNorm = 0.0;
190 (void) y.
Norm2 (&theNorm);
193 out <<
"Norm of y: " << theNorm << endl;
206 MPI_Init (&argc, &argv);
212 if (comm.
MyPID () == 0) {
213 cout <<
"Total number of processes: " << comm.
NumProc () << endl;
220 if (comm.
MyPID () == 0) {
221 cout <<
"End Result: TEST PASSED" << endl;
227 (void) MPI_Finalize ();
Epetra_Map: A class for partitioning vectors and matrices.
int Random()
Set multi-vector values to random numbers.
bool SameAs(const Epetra_BlockMap &Map) const
Returns true if this and Map are identical maps.
int PutScalar(double ScalarConstant)
Initialize all values in a multi-vector with constant value.
Epetra_Vector: A class for constructing and using dense vectors on a parallel computer.
int MyPID() const
Return my process ID.
Epetra_MpiComm: The Epetra MPI Communication Class.
std::string Epetra_Version()
virtual int MyPID() const =0
Return my process ID.
Epetra_Comm: The Epetra Communication Abstract Base Class.
long long global_ordinal_type
int NumProc() const
Returns total number of processes (always returns 1 for SerialComm).
Epetra_SerialComm: The Epetra Serial Communication Class.
bool LinearMap() const
Returns true if the global ID space is contiguously divided (but not necessarily uniformly) across al...
int Update(double ScalarA, const Epetra_MultiVector &A, double ScalarThis)
Update multi-vector values with scaled values of A, this = ScalarThis*this + ScalarA*A.
virtual int NumProc() const =0
Returns total number of processes.
int Norm2(double *Result) const
Compute 2-norm of each vector in multi-vector.
int main(int argc, char *argv[])
void exampleRoutine(const Epetra_Comm &comm, std::ostream &out)