LifeV
GenericDriver.cpp
Go to the documentation of this file.
1 // @HEADER
2 // ***********************************************************************
3 //
4 // Teuchos: Common Tools 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307
23 // USA
24 // Questions? Contact Michael A. Heroux (maherou@sandia.gov)
25 //
26 // ***********************************************************************
27 // @HEADER
28 
29 
30 #include <iostream>
31 #include <cstdlib>
32 #include <string>
33 
34 #ifdef HAVE_MPI
35 # include <mpi.h>
36 #endif
37 
38 
39 int main( int argc, char* argv[] )
40 {
41 
42  bool success = true;
43  int procRank = 0;
44 
45 #ifdef HAVE_MPI
46  MPI_Init (&argc, &argv);
47  MPI_Comm_rank( MPI_COMM_WORLD, &procRank );
48 #endif
49 
50  std::string printMsg = "";
51  if (argc > 1)
52  printMsg = argv[1];
53  int returnVal = 0;
54  if (argc > 2)
55  returnVal = std::atoi(argv[2]);
56 
57  if (printMsg.length() && procRank==0)
58  std::cout << "\n" << printMsg << "\n";
59 
60  if (procRank==0) {
61  if (success)
62  std::cout << "\nEnd Result: TEST PASSED" << std::endl;
63  else
64  std::cout << "\nEnd Result: TEST FAILED" << std::endl;
65  }
66 
67 #ifdef HAVE_MPI
68  MPI_Finalize();
69 #endif
70 
71  return returnVal;
72 
73 }
int main(int argc, char **argv)
Definition: dummy.cpp:5