//============================================================================== int main(int argc, char *argv[]) { #ifdef HAVE_MPI MPI_Init(&argc,&argv); Epetra_MpiComm Comm(MPI_COMM_WORLD); #else Epetra_SerialComm Comm; #endif // only one process if (Comm.NumProc() != 1) { #ifdef HAVE_MPI MPI_Finalize(); #endif if (Comm.MyPID() == 0) cout << "Please run this test with one process only" << endl; // return success not to break the tests exit(EXIT_SUCCESS); } // ======================================================== // // now create the famous "upper arrow" matrix, which // // should be reordered as a "lower arrow". Sparsity pattern // // will be printed on screen. // // ======================================================== // int NumPoints = 16; #if !defined(EPETRA_NO_32BIT_GLOBAL_INDICES) || !defined(EPETRA_NO_64BIT_GLOBAL_INDICES) Epetra_Map Map(-1,NumPoints,0,Comm); #else Epetra_Map Map; #endif std::vector<int> Indices(NumPoints); std::vector<double> Values(NumPoints); Teuchos::RefCountPtr<Epetra_CrsMatrix> A = Teuchos::rcp( new Epetra_CrsMatrix(Copy,Map,0) ); for (int i = 0 ; i < NumPoints ; ++i) { int NumEntries; if (i == 0) { NumEntries = NumPoints; for (int j = 0 ; j < NumPoints ; ++j) { Indices[j] = j; Values[j] = 1.0; } } else { NumEntries = 2; Indices[0] = 0; Indices[1] = i; Values[0] = 1.0; Values[1] = 1.0; } #if !defined(EPETRA_NO_32BIT_GLOBAL_INDICES) || !defined(EPETRA_NO_64BIT_GLOBAL_INDICES) A->InsertGlobalValues(i, NumEntries, &Values[0], &Indices[0]); #endif } A->FillComplete(); // print the sparsity to file, postscript format ////Ifpack_PrintSparsity(A,"OrigA.ps"); // create the reordering... Teuchos::RefCountPtr<Ifpack_RCMReordering> Reorder = Teuchos::rcp( new Ifpack_RCMReordering() ); // and compute is on A IFPACK_CHK_ERR(Reorder->Compute(*A)); // cout information cout << *Reorder; // create a reordered matrix Ifpack_ReorderFilter ReordA(A, Reorder); // print the sparsity to file, postscript format ////Ifpack_PrintSparsity(ReordA,"ReordA.ps"); #ifdef HAVE_MPI MPI_Finalize(); #endif return(EXIT_SUCCESS); }