test/FECrsMatrix/cxx_main.cpp

Go to the documentation of this file.
00001 //@HEADER
00002 // ************************************************************************
00003 // 
00004 //               Epetra: Linear Algebra Services Package 
00005 //                 Copyright (2001) Sandia Corporation
00006 // 
00007 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
00008 // license for use of this work by or on behalf of the U.S. Government.
00009 // 
00010 // This library is free software; you can redistribute it and/or modify
00011 // it under the terms of the GNU Lesser General Public License as
00012 // published by the Free Software Foundation; either version 2.1 of the
00013 // License, or (at your option) any later version.
00014 //  
00015 // This library is distributed in the hope that it will be useful, but
00016 // WITHOUT ANY WARRANTY; without even the implied warranty of
00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018 // Lesser General Public License for more details.
00019 //  
00020 // You should have received a copy of the GNU Lesser General Public
00021 // License along with this library; if not, write to the Free Software
00022 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00023 // USA
00024 // Questions? Contact Michael A. Heroux (maherou@sandia.gov) 
00025 // 
00026 // ************************************************************************
00027 //@HEADER
00028 
00029 // Epetra_FECrsMatrix Test routine
00030 
00031 #include "Epetra_Time.h"
00032 #include "Epetra_Map.h"
00033 #include "Epetra_FECrsMatrix.h"
00034 #include "ExecuteTestProblems.h"
00035 #ifdef EPETRA_MPI
00036 #include "Epetra_MpiComm.h"
00037 #include <mpi.h>
00038 #else
00039 #include "Epetra_SerialComm.h"
00040 #endif
00041 #include "../epetra_test_err.h"
00042 #include "Epetra_Version.h"
00043 
00044 int main(int argc, char *argv[]) {
00045 
00046   int ierr = 0;
00047 
00048 #ifdef EPETRA_MPI
00049 
00050   // Initialize MPI
00051 
00052   MPI_Init(&argc,&argv);
00053   Epetra_MpiComm Comm(MPI_COMM_WORLD);
00054 
00055 #else
00056 
00057   Epetra_SerialComm Comm;
00058 
00059 #endif
00060 
00061 //  Comm.SetTracebackMode(0); // This should shut down any error tracing
00062   bool verbose = false;
00063 
00064   // Check if we should print results to standard out
00065   if (argc>1) if (argv[1][0]=='-' && argv[1][1]=='v') verbose = true;
00066 
00067 #ifdef EPETRA_MPI
00068   int localverbose = verbose ? 1 : 0;
00069   int globalverbose=0;
00070   MPI_Allreduce(&localverbose, &globalverbose, 1, MPI_INT, MPI_SUM,
00071     MPI_COMM_WORLD);
00072   verbose = (globalverbose>0);
00073 #endif
00074 
00075   int MyPID = Comm.MyPID();
00076   int NumProc = Comm.NumProc(); 
00077 
00078   if (verbose && MyPID==0)
00079     cout << Epetra_Version() << endl << endl;
00080 
00081   if (verbose) cout << Comm <<endl;
00082 
00083   // Redefine verbose to only print on PE 0
00084   //if (verbose && rank!=0) verbose = false;
00085 
00086   int NumMyElements = 4;
00087   int NumGlobalElements = NumMyElements*NumProc;
00088   int IndexBase = 0;
00089   
00090   Epetra_Map Map(NumGlobalElements, NumMyElements, IndexBase, Comm);
00091 
00092   EPETRA_TEST_ERR( Drumm1(Map, verbose),ierr);
00093 
00094   EPETRA_TEST_ERR( Drumm2(Map, verbose),ierr);
00095 
00096   EPETRA_TEST_ERR( Drumm3(Map, verbose),ierr);
00097 
00098 
00099   bool preconstruct_graph = false;
00100 
00101   EPETRA_TEST_ERR( four_quads(Comm, preconstruct_graph, verbose), ierr);
00102 
00103   preconstruct_graph = true;
00104 
00105   EPETRA_TEST_ERR( four_quads(Comm, preconstruct_graph, verbose), ierr);
00106 
00107   EPETRA_TEST_ERR( submatrix_formats(Comm, verbose), ierr);
00108 
00109   EPETRA_TEST_ERR( rectangular(Comm, verbose), ierr);
00110 
00111 #ifdef EPETRA_MPI
00112   MPI_Finalize();
00113 #endif
00114 
00115   return ierr;
00116 }
00117 

Generated on Thu Sep 18 12:37:56 2008 for Epetra Package Browser (Single Doxygen Collection) by doxygen 1.3.9.1