LifeV
lifev/eta/testsuite/blocks_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 compute a block matrix associated to the Stokes problem
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  // Known errors
70  const LifeV::Real knownMatrixError ( 4.55 );
71  const LifeV::Real knownRhsError ( 0.0192705923625467 );
72 
73 
74  // Tolerance
75  const LifeV::Real tolerance ( 1e-10 );
76 
77  ETA_Blocks2DTest eta_blocks2DTest;
78 
79  // Error of the problem
80  const std::vector<Real> errors = eta_blocks2DTest.run();
81  const bool unsuccess = ( std::abs (errors[0] - knownMatrixError) > tolerance ||
82  std::abs (errors[1] - knownRhsError) > tolerance);
83 
84  if (unsuccess)
85  {
86  if (verbose)
87  {
88  std::cout << "End Result: TEST NOT PASSED" << std::endl;
89  }
90  }
91  else
92  {
93  if (verbose)
94  {
95  std::cout << "End Result: TEST PASSED" << std::endl;
96  }
97  }
98 
99 #ifdef HAVE_MPI
100  MPI_Finalize();
101 #endif
102 
103 
104  if ( unsuccess )
105  {
106  return ( EXIT_FAILURE );
107  }
108  else
109  {
110  return ( EXIT_SUCCESS );
111  }
112 
113 }
int main(int argc, char **argv)