test/FECrsGraph/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_FECrsGraph Test routine
00030 
00031 #include "Epetra_Time.h"
00032 #include "Epetra_Map.h"
00033 #include "ExecuteTestProblems.h"
00034 #ifdef EPETRA_MPI
00035 #include "Epetra_MpiComm.h"
00036 #include <mpi.h>
00037 #else
00038 #include "Epetra_SerialComm.h"
00039 #endif
00040 #include "../epetra_test_err.h"
00041 #include "Epetra_Version.h"
00042 
00043 int main(int argc, char *argv[]) {
00044 
00045   int ierr = 0;
00046 
00047 #ifdef EPETRA_MPI
00048   MPI_Init(&argc,&argv);
00049   Epetra_MpiComm Comm(MPI_COMM_WORLD);
00050 #else
00051   Epetra_SerialComm Comm;
00052 #endif
00053 
00054 //  Comm.SetTracebackMode(0); // This should shut down any error tracing
00055   bool verbose = false;
00056 
00057   // Check if we should print results to standard out
00058   if (argc>1) if (argv[1][0]=='-' && argv[1][1]=='v') verbose = true;
00059 
00060 #ifdef EPETRA_MPI
00061   int localverbose = verbose ? 1 : 0;
00062   int globalverbose=0;
00063   MPI_Allreduce(&localverbose, &globalverbose, 1, MPI_INT, MPI_SUM,
00064     MPI_COMM_WORLD);
00065   verbose = (globalverbose>0);
00066 #endif
00067 
00068   int MyPID = Comm.MyPID();
00069   int NumProc = Comm.NumProc(); 
00070 
00071   if (verbose && MyPID==0)
00072     cout << Epetra_Version() << endl << endl;
00073 
00074   if (verbose) cout << Comm <<endl;
00075 
00076   int NumMyElements = 4;
00077   int NumGlobalElements = NumMyElements*NumProc;
00078   int IndexBase = 0;
00079   
00080   Epetra_Map Map(NumGlobalElements, NumMyElements, IndexBase, Comm);
00081 
00082   EPETRA_TEST_ERR( Drumm1(Map, verbose),ierr);
00083 
00084   EPETRA_TEST_ERR( Drumm2(Map, verbose),ierr);
00085 
00086 
00087   bool preconstruct_graph = false;
00088 
00089   EPETRA_TEST_ERR( four_quads(Comm, preconstruct_graph, verbose), ierr);
00090 
00091   preconstruct_graph = true;
00092 
00093   EPETRA_TEST_ERR( four_quads(Comm, preconstruct_graph, verbose), ierr);
00094 
00095   EPETRA_TEST_ERR( rectangular(Comm, verbose), ierr);
00096 
00097   EPETRA_TEST_ERR( Young1(Comm, verbose), ierr);
00098 
00099 #ifdef EPETRA_MPI
00100   MPI_Finalize();
00101 #endif
00102 
00103   return ierr;
00104 }
00105 

Generated on Wed May 12 21:41:04 2010 for Epetra Package Browser (Single Doxygen Collection) by  doxygen 1.4.7