New_Package Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
cxx_main.cpp
Go to the documentation of this file.
1 //@HEADER
2 // ***********************************************************************
3 //
4 // New_Package Example Package
5 // Copyright (2004) Sandia Corporation
6 //
7 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8 // license for use of this work by or on behalf of the U.S. Government.
9 //
10 // This library is free software; you can redistribute it and/or modify
11 // it under the terms of the GNU Lesser General Public License as
12 // published by the Free Software Foundation; either version 2.1 of the
13 // License, or (at your option) any later version.
14 //
15 // This library is distributed in the hope that it will be useful, but
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 // Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public
21 // License along with this library; if not, write to the Free Software
22 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
23 // USA
24 // Questions? Contact Michael A. Heroux (maherou@sandia.gov)
25 //
26 // ***********************************************************************
27 //@HEADER
28 //
29 
30 // hello_test
31 //
32 // usage:
33 // hello_test
34 //
35 // output:
36 // prints a summary line and one line "Hello" for each process to standard out
37 // If --enable-newp_swahili is set on the configure line:
38 // prints a summary line and one line "Jambo" for each process to standard out
39 //
40 #include "Newp_Hello.h"
41 #ifdef HAVE_NEWP_SWAHILI
42 #include "Newp_Jambo.h"
43 #endif
44 #include "New_Package_Version.h"
45 
46 int main(int argc, char **argv)
47 {
48  //
49  // If --enable-mpi, an MPI communicator is used, otherwise a serial
50  // stub communicator is used.
51  //
52 #ifdef EPETRA_MPI
53  MPI_Init(&argc,&argv);
54  Epetra_MpiComm Comm (MPI_COMM_WORLD);
55 #else
56  Epetra_SerialComm Comm;
57 #endif
58 
59  //
60  // Print out a summary line followed by a "Hello" line from each process
61  //
62 
63  if (Comm.MyPID()==0)
64  cout << New_Package_Version() << endl << endl;
65 
66  Newp_Hello Hello( Comm ) ;
67  Hello.Print( cout );
68 
69 
70  //
71  // If --enable-newp_swahili is set, HAVE_NEWP_SWAHILI is set in
72  // New_Package_config.h which is included by Newp_Hello.h and hence:
73  // Print out a summary line followed by a "Jambo" line from each process
74  //
75 #ifdef HAVE_NEWP_SWAHILI
76  Newp_Jambo Jambo( Comm ) ;
77  Jambo.Print( cout );
78 #endif
79 
80 #ifdef EPETRA_MPI
81  MPI_Finalize();
82 #endif
83  return 0;
84 }
85 
86 
87 
int main(int argc, char **argv)
Definition: cxx_main.cpp:46
int MyPID() const
A sample class.
Definition: Newp_Hello.h:59
virtual void Print(ostream &os) const
Definition: Newp_Hello.cpp:43
virtual void Print(ostream &os) const
Print method.
Definition: Newp_Jambo.cpp:39
Newp_Jambo: A sample class.
Definition: Newp_Jambo.h:58
string New_Package_Version()