11#include <Epetra_config.h>
33 if (comm.
MyPID () == 0) {
39#ifdef EPETRA_NO_32BIT_GLOBAL_INDICES
68 Epetra_Map contigMap (numGlobalEntries, indexBase, comm);
87 (void) x.
Norm2 (&theNorm);
88 out <<
"Norm of x (all entries are 42.0): " << theNorm << endl;
95 (void) x.
Norm2 (&theNorm);
96 out <<
"Norm of x (random numbers): " << theNorm << endl;
103 const int localLength = x.
MyLength ();
108 for (
int localIndex = 0; localIndex < localLength; ++localIndex) {
109 if (x[localIndex] < 0.5) {
115 (void) comm.
SumAll (&localCount, &globalCount, 1);
119 out <<
"x has " << globalCount <<
" entr"
120 << (globalCount != 1 ?
"ies" :
"y")
121 <<
" less than 0.5." << endl;
130 const int localLength = x.
MyLength ();
131 for (
int localIndex = 0; localIndex < localLength; ++localIndex) {
133 x[localIndex] +=
static_cast<double> (localIndex);
138 (void) x.
Norm2 (&theNorm);
139 out <<
"Norm of x (modified random numbers): " << theNorm << endl;
153 MPI_Init (&argc, &argv);
159 if (comm.
MyPID () == 0) {
160 cout <<
"Total number of processes: " << comm.
NumProc () << endl;
167 if (comm.
MyPID () == 0) {
168 cout <<
"End Result: TEST PASSED" << endl;
174 (void) MPI_Finalize ();
std::string Epetra_Version()
Epetra_Comm: The Epetra Communication Abstract Base Class.
virtual int NumProc() const =0
Returns total number of processes.
virtual int MyPID() const =0
Return my process ID.
virtual int SumAll(double *PartialSums, double *GlobalSums, int Count) const =0
Epetra_Comm Global Sum function.
Epetra_Map: A class for partitioning vectors and matrices.
Epetra_MpiComm: The Epetra MPI Communication Class.
int NumProc() const
Returns total number of processes.
int MyPID() const
Return my process ID.
int MyLength() const
Returns the local vector length on the calling processor of vectors in the multi-vector.
int Random()
Set multi-vector values to random numbers.
int Norm2(double *Result) const
Compute 2-norm of each vector in multi-vector.
int PutScalar(double ScalarConstant)
Initialize all values in a multi-vector with constant value.
Epetra_SerialComm: The Epetra Serial Communication Class.
Epetra_Vector: A class for constructing and using dense vectors on a parallel computer.
int main(int argc, char *argv[])
void exampleRoutine(const Epetra_Comm &comm, std::ostream &out)
long long global_ordinal_type