LifeV
doc/CodingGuidelines/main.cpp
Go to the documentation of this file.
1 //@HEADER
2 /*
3 *******************************************************************************
4 
5  Copyright (C) 2004, 2005, 2007 EPFL, Politecnico di Milano, INRIA
6  Copyright (C) 2010 EPFL, Politecnico di Milano, Emory University
7 
8  This file is part of LifeV.
9 
10  LifeV is free software; you can redistribute it and/or modify
11  it under the terms of the GNU Lesser General Public License as published by
12  the Free Software Foundation, either version 3 of the License, or
13  (at your option) any later version.
14 
15  LifeV is distributed in the hope that it will be useful,
16  but 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 License
21  along with LifeV. If not, see <http://www.gnu.org/licenses/>.
22 
23 *******************************************************************************
24 */
25 //@HEADER
26 
27 /*!
28  @file
29  @brief A short description of the test content
30 
31  @author Name Surname <name.surname@email.org>
32  @date 00-00-0000
33 
34  Here write a long and detailed description of the test.
35 
36  Please note that the test should be quick (maximum 5 minutes)
37  and should not be an application.
38 
39  Remember to add and configure a testsuite.at file to allow
40  night execution of the test inside the testsuite.
41  */
42 
43 
44 #include <Epetra_ConfigDefs.h>
45 #ifdef EPETRA_MPI
46 #include <mpi.h>
47 #include <Epetra_MpiComm.h>
48 #else
49 #include <Epetra_SerialComm.h>
50 #endif
51 
52 #include <lifev/core/LifeV.hpp>
53 
56 {
57  LifeV::AboutData about ( "Name of the application" ,
58  "Name of the test" ,
59  "Test version 0.0",
60  "Short description",
61  LifeV::AboutData::License_GPL,
62  "Copyright (c) 2009 EPFL");
63 
64  about.addAuthor ("Name Surname", "Developer", "name.surname@epfl.ch", "");
65  about.addAuthor ("Name Surname", "Developer", "name.surname@epfl.ch", "");
66 
67  return about;
68 }
69 
70 using namespace LifeV;
71 
72 int
73 main ( int argc, char** argv )
74 {
75  //MPI communicator initialization
76  std::shared_ptr<Epetra_Comm> comm;
77 
78 #ifdef HAVE_MPI
79  std::cout << "MPI Initialization" << std::endl;
80  MPI_Init ( &argc, &argv );
81 #endif
82 
83  //MPI Preprocessing
84 #ifdef EPETRA_MPI
85 
86  int nprocs;
87  int rank;
88 
89  MPI_Comm_size ( MPI_COMM_WORLD, &nprocs );
90  MPI_Comm_rank ( MPI_COMM_WORLD, &rank );
91 
92  if ( rank == 0 )
93  {
94  std::cout << "MPI processes: " << nprocs << std::endl;
95  std::cout << "MPI Epetra Initialization ... " << std::endl;
96  }
97  comm.reset ( new Epetra_MpiComm ( MPI_COMM_WORLD ) );
98 
99  comm->Barrier();
100 
101 #else
102 
103  std::cout << "MPI SERIAL Epetra Initialization ... " << std::endl;
104  comm.reset ( new Epetra_SerialComm() );
105 
106 #endif
107 
108  // ----- Test calls -----
109  //
110  // The test should return a result (for tolerance comparison)
111  // or a flag (0: EXIT_SUCCESS, 1:EXIT_FAILURE).
112  //
113 
114  // The test must verify if tolerance is satisfied!
115  if ( result > tolerance)
116  {
117  return EXIT_FAILURE;
118  }
119 
120  // ----- End of test calls -----
121 
122 #ifdef HAVE_MPI
123  std::cout << "MPI Finalization" << std::endl;
124  MPI_Finalize();
125 #endif
126 
127  // If everything runs correctly we return EXIT_SUCCESS flag
128  return EXIT_SUCCESS;
129 }
LifeV::AboutData makeAbout()
Definition: cavity.cpp:79
void updateInverseJacobian(const UInt &iQuadPt)
int main(int argc, char **argv)
Definition: dummy.cpp:5