56 int main(
int argc,
char *argv[])
59 MPI_Init(&argc,&argv);
64 if (Comm.
NumProc()!=3) cout <<
"Must be run on 3 MPI processes." << endl;
67 if (Comm.
MyPID()==0) cout <<
"Press any key to continue..."<< endl;
68 if (Comm.
MyPID()==0) cin >> tmp;
70 int NumMyElements = 2;
71 Epetra_Map SourceMap(-1, NumMyElements, 0, Comm);
78 SourceX[0] = (double) SourceMap.
GID(0);
79 SourceX[1] = (double) SourceMap.
GID(1);
85 int TargetOneNumMyElements;
86 if (Comm.
MyPID()==0) TargetOneNumMyElements = NumGlobalElements;
87 else TargetOneNumMyElements = 0;
89 Epetra_Map TargetOneMap(-1, TargetOneNumMyElements, 0, Comm);
97 cout << TargetOneX << endl;
99 int * GlobalElementList =
new int[2];
100 GlobalElementList[0] = 5 - SourceMap.
GID(0);
101 GlobalElementList[1] = 5 - SourceMap.
GID(1);
103 Epetra_Map TargetTwoMap(-1, 2, GlobalElementList, 0, Comm);
111 cout << TargetTwoX << endl;
121 cout << TargetThreeX << endl;
127 TargetFourX.
Import(TargetThreeX, ExporterOne,
Add);
129 cout << TargetFourX << endl;
int NumGlobalElements() const
Number of elements across all processors.
Epetra_Map: A class for partitioning vectors and matrices.
int NumProc() const
Returns total number of processes.
void Barrier() const
Epetra_MpiComm Barrier function.
Epetra_Export: This class builds an export object for efficient exporting of off-processor elements...
Epetra_Vector: A class for constructing and using dense vectors on a parallel computer.
Epetra_MpiComm: The Epetra MPI Communication Class.
Epetra_Import: This class builds an import object for efficient importing of off-processor elements...
int GID(int LID) const
Returns global ID of local ID, return IndexBase-1 if not found on this processor. ...
int main(int argc, char *argv[])
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.
Epetra_LocalMap: A class for replicating vectors and matrices across multiple processors.
int MyPID() const
Return my process ID.