LifeV
lifev/core/testsuite/template_test/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  @contributor Name Surname <name.surname@email.org>
33  @maintainer Name Surname <name.surname@email.org>
34 
35  @date 00-00-0000
36 
37  Here write a long and detailed description of the test.
38 
39  Please note that the test should be quick (maximum 5 minutes)
40  and should not be an application.
41 
42  Remember to add and configure a testsuite.at file to allow
43  night execution of the test inside the testsuite.
44  */
45 
46 
47 #include <Epetra_ConfigDefs.h>
48 #ifdef EPETRA_MPI
49 #include <mpi.h>
50 #include <Epetra_MpiComm.h>
51 #else
52 #include <Epetra_SerialComm.h>
53 #endif
54 
55 
56 #include <lifev/core/LifeV.hpp>
57 
58 using namespace LifeV;
59 
60 int
61 main ( int argc, char** argv )
62 {
63  //MPI communicator initialization
64  std::shared_ptr<Epetra_Comm> comm;
65 
66 #ifdef HAVE_MPI
67  std::cout << "MPI Initialization" << std::endl;
68  MPI_Init ( &argc, &argv );
69 #endif
70 
71  //MPI Preprocessing
72 #ifdef EPETRA_MPI
73 
74  int nprocs;
75  int rank;
76 
77  MPI_Comm_size ( MPI_COMM_WORLD, &nprocs );
78  MPI_Comm_rank ( MPI_COMM_WORLD, &rank );
79 
80  if ( rank == 0 )
81  {
82  std::cout << "MPI processes: " << nprocs << std::endl;
83  std::cout << "MPI Epetra Initialization ... " << std::endl;
84  }
85  comm.reset ( new Epetra_MpiComm ( MPI_COMM_WORLD ) );
86 
87  comm->Barrier();
88 
89 #else
90 
91  std::cout << "MPI SERIAL Epetra Initialization ... " << std::endl;
92  comm.reset ( new Epetra_SerialComm() );
93 
94 #endif
95 
96  // ----- Test calls -----
97  //
98  // The test should return a result (for tolerance comparison)
99  // or a flag (0: EXIT_SUCCESS, 1:EXIT_FAILURE).
100  //
101 
102  // The test must verify if tolerance is satisfied!
103  Real result (0);
104  Real tolerance (1e-10);
105 
106  if ( result > tolerance)
107  {
108  return EXIT_FAILURE;
109  }
110 
111  // ----- End of test calls -----
112 
113 #ifdef HAVE_MPI
114  std::cout << "MPI Finalization" << std::endl;
115  MPI_Finalize();
116 #endif
117 
118  // If everything runs correctly we return EXIT_SUCCESS flag
119  return EXIT_SUCCESS;
120 }
void updateInverseJacobian(const UInt &iQuadPt)
int main(int argc, char **argv)
Definition: dummy.cpp:5
double Real
Generic real data.
Definition: LifeV.hpp:175