00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #include <EpetraExt_ConfigDefs.h>
00032 #include "EpetraExt_Version.h"
00033
00034 #include "Epetra_Time.h"
00035 #ifdef EPETRA_MPI
00036 #include "Epetra_MpiComm.h"
00037 #include <mpi.h>
00038 #endif
00039
00040 #include "Epetra_SerialComm.h"
00041 #include "Epetra_Map.h"
00042 #include "Epetra_CrsGraph.h"
00043 #include "EpetraExt_BTF_CrsGraph.h"
00044 #include "../epetra_test_err.h"
00045
00046
00047 int main(int argc, char *argv[]) {
00048
00049 int i, ierr=0, returnierr=0;
00050
00051 #ifdef EPETRA_MPI
00052
00053
00054
00055 MPI_Init(&argc,&argv);
00056 int size, rank;
00057
00058 MPI_Comm_size(MPI_COMM_WORLD, &size);
00059 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
00060
00061 #else
00062
00063 int size = 1;
00064 int rank = 0;
00065
00066 #endif
00067
00068 bool verbose = false;
00069
00070
00071 if (argc>1) if (argv[1][0]=='-' && argv[1][1]=='v') verbose = true;
00072
00073
00074 #ifdef EPETRA_MPI
00075 Epetra_MpiComm Comm(MPI_COMM_WORLD);
00076 #else
00077 Epetra_SerialComm Comm;
00078 #endif
00079 if (!verbose) Comm.SetTracebackMode(0);
00080
00081 int MyPID = Comm.MyPID();
00082 int NumProc = Comm.NumProc();
00083
00084 if (verbose) {
00085 cout << EpetraExt::EpetraExt_Version() << endl << endl;
00086 cout << Comm << endl << flush;
00087 }
00088
00089 Comm.Barrier();
00090 bool verbose1 = verbose;
00091
00092 if (verbose) verbose = (MyPID==0);
00093
00094 int NumMyElements = 3;
00095 int NumGlobalElements = NumMyElements;
00096 int IndexBase = 0;
00097
00098 cout << "MyPID: " << MyPID << ", NumMyElements: " << NumMyElements << endl;
00099
00100 Epetra_Map Map( NumMyElements, 0, Comm );
00101 cout << Map << endl;
00102
00103 Epetra_CrsGraph Graph( Copy, Map, 1 );
00104
00105 int index = 2;
00106 Graph.InsertGlobalIndices( 0, 1, &index );
00107 index = 0;
00108 Graph.InsertGlobalIndices( 1, 1, &index );
00109 index = 1;
00110 Graph.InsertGlobalIndices( 2, 1, &index );
00111
00112 Graph.FillComplete();
00113 cout << Graph << endl;
00114
00115 EpetraExt::CrsGraph_BTF BTFTransform;
00116 Epetra_CrsGraph & NewGraph = BTFTransform( Graph );
00117
00118 cout << NewGraph << endl;
00119
00120 #ifdef EPETRA_MPI
00121 MPI_Finalize();
00122 #endif
00123
00124 return returnierr;
00125 }
00126