#include "Didasko_ConfigDefs.h"
#if defined(HAVE_DIDASKO_EPETRA)
#include "Epetra_ConfigDefs.h"
#ifdef HAVE_MPI
#include "mpi.h"
#include "Epetra_MpiComm.h"
#else
#include "Epetra_SerialComm.h"
#endif
#include "Epetra_Vector.h"
#include "Epetra_Map.h"
#include "Epetra_CrsMatrix.h"
int main(int argc, char *argv[])
{
#ifdef HAVE_MPI
MPI_Init(&argc, &argv);
#else
#endif
int MyPID = Comm.
MyPID();
if( NumProc != 2 ) {
#ifdef HAVE_MPI
MPI_Finalize();
#endif
return(EXIT_SUCCESS);
}
int NumElementsA = 0, NumElementsB = 0;
switch( MyPID ) {
case 0:
NumElementsA = 2;
NumElementsB = 4;
break;
case 1:
NumElementsA = 2;
NumElementsB = 0;
break;
}
int * MyGlobalElementsA = MapA.MyGlobalElements();
for( int i=0 ; i<NumElementsA ; ++i ) {
double one = 2.0;
int indices = MyGlobalElementsA[i];
Q.InsertGlobalValues(MyGlobalElementsA[i], 1, &one, &indices );
}
Q.FillComplete(MapB,MapB);
VecA.PutScalar(1.0); VecA2.PutScalar(1.0);
VecB.PutScalar(1.0); VecB2.PutScalar(1.0);
Q.Multiply(false,VecB,VecB2);
cout << VecB2;
#ifdef HAVE_MPI
MPI_Finalize();
#endif
return(EXIT_SUCCESS);
}
#else
#include <stdlib.h>
#include <stdio.h>
int main(int argc, char *argv[])
{
puts("Please configure Didasko with:\n"
"--enable-epetra");
return 0;
}
#endif