LifeV
PreconditionerAztecOO.hpp
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 AztecOO preconditioner
30 
31  @author Cristiano Malossi <cristiano.malossi@epfl.ch>
32  @contributor Gwenol Grandperrin <gwenol.grandperrin@epfl.ch>
33  @maintainer Gwenol Grandperrin <gwenol.grandperrin@epfl.ch>
34 
35  @date 17-11-2009
36  */
37 
38 #ifndef AZTECOOPRECONDITIONER_HPP
39 #define AZTECOOPRECONDITIONER_HPP 1
40 
41 #include <lifev/core/algorithm/SolverAztecOO.hpp>
42 #include <lifev/core/algorithm/Preconditioner.hpp>
43 
44 namespace LifeV
45 {
46 
47 //! PreconditionerAztecOO - The implementation of Preconditioner for AztecOO preconditioners
48 /*!
49  @author Cristiano Malossi <cristinao.malossi@epfl.ch>
50 
51  This class provides the interface for using AztecOO preconditioners with SolverAztecOO.
52  */
54 {
55 public:
56 
57  //! @name Public Types
58  //@{
59 
61 
62  typedef super::operator_raw_type operator_raw_type;
63  typedef super::operator_type operator_type;
64 
66 
67  //@}
68 
69 
70  //! @name Constructors & Destructor
71  //@{
72 
73  //! Constructor
75 
76  //! Destructor
77  virtual ~PreconditionerAztecOO() {}
78 
79  //@}
80 
81 
82  //! @name Methods
83  //@{
84 
85  //! Build the preconditioner
86  /*!
87  @param A the base matrix for computing the preconditioner
88  */
89  Int buildPreconditioner ( operator_type& matrix );
90 
91  //! Reset the preconditioner
92  void resetPreconditioner();
93 
94  //! Create the list of parameters of the preconditioner
95  /*!
96  @param list A Parameter list to be filled
97  @param dataFile A GetPot object containing the data about the preconditioner
98  @param section The section in "dataFile" where to find data about the preconditioner
99  @param subSection The subsection in "dataFile" where to find data about the preconditioner
100  */
101  void createParametersList ( list_Type& list, const GetPot& dataFile, const std::string& section, const std::string& subSection );
102 
103  //! Show informations about the preconditioner
104  virtual void showMe ( std::ostream& output = std::cout ) const;
105 
106  //! Compute the condition number of the preconditioner
107  /*!
108  @return Condition number of the preconditioner
109  */
110  Real condest();
111 
112  //@}
113 
114 
115  //! @name Set Methods
116  //@{
117 
118  //! Set the data of the preconditioner using a GetPot object
119  /*!
120  @param dataFile A GetPot object containing the data about the preconditioner
121  @param section The section in "dataFile" where to find data about the preconditioner
122  */
123  void setDataFromGetPot ( const GetPot& dataFile, const std::string& section );
124 
125  //! Set the external solver (AztecOO)
126  /*!
127  @param solver reference to the AztecOO solver
128  */
129  void setSolver ( SolverAztecOO& solver )
130  {
131  M_solver = &solver;
132  }
133 
134  //@}
135 
136 
137  //! @name Get Methods
138  //@{
139 
140  //! Return the pointer to the preconditioner
141  /*!
142  @return always zero because no external precondtioner is used here!
143  */
145 
146  //! Return the shared pointer to the preconditioner
147  /*!
148  @Deprecated
149  */
151 
152  //! Return the name of the preconditioner
153  /*!
154  @return "AztecOO"
155  */
156  std::string preconditionerType()
157  {
158  return "AztecOO";
159  }
160 
161  //@}
162 
163 private:
164 
166 };
167 
169 {
170  return new PreconditionerAztecOO();
171 }
172 
173 namespace
174 {
176 }
177 
178 } // namespace LifeV
179 
180 #endif // AZTECOOPRECONDITIONER_HPP
Int buildPreconditioner(operator_type &matrix)
Build the preconditioner.
Preconditioner * createPreconditionerAztecOO()
void createParametersList(list_Type &list, const GetPot &dataFile, const std::string &section, const std::string &subSection)
Create the list of parameters of the preconditioner.
void setDataFromGetPot(const GetPot &dataFile, const std::string &section)
Set the data of the preconditioner using a GetPot object.
void resetPreconditioner()
Reset the preconditioner.
SolverAztecOO - Class to wrap linear solver.
Real condest()
Compute the condition number of the preconditioner.
int32_type Int
Generic integer data.
Definition: LifeV.hpp:188
void updateInverseJacobian(const UInt &iQuadPt)
PreconditionerAztecOO - The implementation of Preconditioner for AztecOO preconditioners.
Epetra_Operator prec_raw_type
std::string preconditionerType()
Return the name of the preconditioner.
MatrixEpetra< Real > operator_raw_type
void setSolver(SolverAztecOO &solver)
Set the external solver (AztecOO)
double Real
Generic real data.
Definition: LifeV.hpp:175
Teuchos::ParameterList list_Type
Preconditioner - Abstract preconditioner class.
std::shared_ptr< prec_raw_type > prec_type
super::prec_raw_type * preconditioner()
Return the pointer to the preconditioner.
super::prec_type preconditionerPtr()
Return the shared pointer to the preconditioner.
virtual void showMe(std::ostream &output=std::cout) const
Show informations about the preconditioner.
std::shared_ptr< operator_raw_type > operator_type
virtual ~PreconditionerAztecOO()
Destructor.