LifeV
lifev/eta/testsuite/vectorial_ADR_2D/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 
29 Simple ETA test to compare ETA to ADRAssembly in a 2D space
30 
31 */
32 
33 
34 /**
35  @file main.hpp
36  @author L. Pasquale <luca.pasquale@mail.polimi.it>
37  @date 2012-11-20
38 */
39 
40 
41 // ===================================================
42 //! Includes
43 // ===================================================
44 
45 #include <lifev/core/LifeV.hpp>
46 
48 
49 
50 // ===================================================
51 //! Namespaces
52 // ===================================================
53 using namespace LifeV;
54 
55 // ===================================================
56 //! Main
57 // ===================================================
58 int main (int argc, char* argv[])
59 {
60 
61 #ifdef HAVE_MPI
62  MPI_Init (&argc, &argv);
63  std::shared_ptr<Epetra_Comm> Comm (new Epetra_MpiComm (MPI_COMM_WORLD) );
64 #else
65  std::shared_ptr<Epetra_Comm> Comm (new Epetra_SerialComm);
66 #endif
67  bool verbose (Comm->MyPID() == 0);
68 
69  // Tolerance
70  const LifeV::Real tolerance ( 1e-10 );
71 
72  ETA_VectorialADR2DTest eta_vectorialADR2DTest;
73 
74  // Error of the problem
75  const LifeV::Real error = eta_vectorialADR2DTest.run();
76  const bool unsuccess = std::fabs ( error ) > tolerance;
77 
78  if (unsuccess)
79  {
80  if (verbose)
81  {
82  std::cout << "End Result: TEST NOT PASSED" << std::endl;
83  }
84  }
85  else
86  {
87  if (verbose)
88  {
89  std::cout << "End Result: TEST PASSED" << std::endl;
90  }
91  }
92 
93 #ifdef HAVE_MPI
94  MPI_Finalize();
95 #endif
96 
97 
98  if ( unsuccess )
99  {
100  return ( EXIT_FAILURE );
101  }
102  else
103  {
104  return ( EXIT_SUCCESS );
105  }
106 
107 }
int main(int argc, char **argv)