00001 //@HEADER 00002 // *********************************************************************** 00003 // 00004 // New_Package Example Package 00005 // Copyright (2004) 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 00030 // hello_test 00031 // 00032 // usage: 00033 // hello_test 00034 // 00035 // output: 00036 // prints a summary line and one line "Hello" for each process to standard out 00037 // If --enable-newp_swahili is set on the configure line: 00038 // prints a summary line and one line "Jambo" for each process to standard out 00039 // 00040 #include "Newp_Hello.h" 00041 #ifdef HAVE_NEWP_SWAHILI 00042 #include "Newp_Jambo.h" 00043 #endif 00044 #include "New_Package_Version.h" 00045 00046 int main(int argc, char **argv) 00047 { 00048 // 00049 // If --enable-mpi, an MPI communicator is used, otherwise a serial 00050 // stub communicator is used. 00051 // 00052 #ifdef EPETRA_MPI 00053 MPI_Init(&argc,&argv); 00054 Epetra_MpiComm Comm (MPI_COMM_WORLD); 00055 #else 00056 Epetra_SerialComm Comm; 00057 #endif 00058 00059 // 00060 // Print out a summary line followed by a "Hello" line from each process 00061 // 00062 00063 if (Comm.MyPID()==0) 00064 cout << New_Package_Version() << endl << endl; 00065 00066 Newp_Hello Hello( Comm ) ; 00067 Hello.Print( cout ); 00068 00069 00070 // 00071 // If --enable-newp_swahili is set, HAVE_NEWP_SWAHILI is set in 00072 // New_Package_config.h which is included by Newp_Hello.h and hence: 00073 // Print out a summary line followed by a "Jambo" line from each process 00074 // 00075 #ifdef HAVE_NEWP_SWAHILI 00076 Newp_Jambo Jambo( Comm ) ; 00077 Jambo.Print( cout ); 00078 #endif 00079 00080 #ifdef EPETRA_MPI 00081 MPI_Finalize(); 00082 #endif 00083 return 0; 00084 } 00085 00086 00087
1.3.9.1