LifeV
lifev/darcy/testsuite/basic_test/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 Darcy test with Dirichlet, Neumann and Robin boundary conditions
30 
31 */
32 
33 
34 /**
35  @file main.hpp
36  @author A. Fumagalli <alessio.fumagalli@mail.polimi.it>
37  @date 2012-06-13
38 */
39 
40 
41 // ===================================================
42 //! Includes
43 // ===================================================
44 
45 
46 #include <Epetra_ConfigDefs.h>
47 #ifdef EPETRA_MPI
48 #include <mpi.h>
49 #include <Epetra_MpiComm.h>
50 #else
51 #include <Epetra_SerialComm.h>
52 #endif
53 
54 
55 #include <lifev/core/LifeV.hpp>
56 
57 #include <lifev/core/algorithm/PreconditionerIfpack.hpp>
58 #include <lifev/core/algorithm/PreconditionerML.hpp>
59 
60 #include "darcy.hpp"
61 
62 
63 // ===================================================
64 //! Namespaces
65 // ===================================================
66 using namespace LifeV;
67 namespace
68 {
69 static bool regIF = (PRECFactory::instance().registerProduct ( "Ifpack", &createIfpack ) );
70 static bool regML = (PRECFactory::instance().registerProduct ( "ML", &createML ) );
71 }
72 
73 // ===================================================
74 //! Main
75 // ===================================================
76 int main (int argc, char* argv[])
77 {
78 
79 #ifdef HAVE_MPI
80 
81  MPI_Init ( &argc, &argv );
82 
83 #endif
84 
85  // Error known
86  const LifeV::Real errorKnown ( 0.9554685918458008 );
87 
88  // Tolerance between the error and the error known
89  const LifeV::Real tolerance ( 1e-10 );
90 
91  darcy_nonlinear Darcy ( argc, argv );
92 
93  // Error of the problem
94  const LifeV::Real error = Darcy.run();
95  const bool unsuccess = std::fabs ( error - errorKnown ) > tolerance;
96 
97 #ifdef HAVE_MPI
98 
99  MPI_Finalize();
100 
101 #endif
102 
103  if ( unsuccess )
104  {
105  return ( EXIT_FAILURE );
106  }
107  else
108  {
109  return ( EXIT_SUCCESS );
110  }
111 }
darcy_nonlinear(int argc, char **argv)
Constructor.
Definition: 2d/darcy.cpp:110
Includes.
Definition: 2d/darcy.hpp:143
int main(int argc, char **argv)