eigen_sparse_linear_solver.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2014 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
3 
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License, or (at your option) any later version.
8 
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
13 
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 
18 
19 
20 #ifndef LIBMESH_EIGEN_SPARSE_LINEAR_SOLVER_H
21 #define LIBMESH_EIGEN_SPARSE_LINEAR_SOLVER_H
22 
23 #include "libmesh/libmesh_common.h"
24 
25 #ifdef LIBMESH_HAVE_EIGEN
26 
27 // Eigen includes
28 
29 // Local includes
30 #include "libmesh/linear_solver.h"
33 
34 // C++ includes
35 
36 namespace libMesh
37 {
38 
39 
40 
48 template <typename T>
50 {
51  public:
56  LIBMESH_CAN_DEFAULT_TO_COMMWORLD);
57 
62 
66  void clear ();
67 
71  void init ();
72 
76  std::pair<unsigned int, Real>
77  solve (SparseMatrix<T> &matrix,
78  NumericVector<T> &solution,
79  NumericVector<T> &rhs,
80  const double tol,
81  const unsigned int m_its);
82 
86  std::pair<unsigned int, Real>
88  NumericVector<T> &solution,
89  NumericVector<T> &rhs,
90  const double tol,
91  const unsigned int m_its);
92 
96  std::pair<unsigned int, Real>
97  solve (SparseMatrix<T> &matrix,
98  SparseMatrix<T> &pc,
99  NumericVector<T> &solution,
100  NumericVector<T> &rhs,
101  const double tol,
102  const unsigned int m_its);
103 
107  std::pair<unsigned int, Real>
108  solve (const ShellMatrix<T>& shell_matrix,
109  NumericVector<T>& solution_in,
110  NumericVector<T>& rhs_in,
111  const double tol,
112  const unsigned int m_its);
113 
119  virtual std::pair<unsigned int, Real>
120  solve (const ShellMatrix<T>& shell_matrix,
121  const SparseMatrix<T>& precond_matrix,
122  NumericVector<T>& solution_in,
123  NumericVector<T>& rhs_in,
124  const double tol,
125  const unsigned int m_its);
126 
131  virtual void print_converged_reason();
132 
133  private:
134 
140 
141 };
142 
143 
144 /*----------------------- functions ----------------------------------*/
145 template <typename T>
146 inline
148  LinearSolver<T>(comm)
149 {
150 }
151 
152 
153 
154 template <typename T>
155 inline
157 {
158  this->clear ();
159 }
160 
161 
162 
163 template <typename T>
164 inline
165 std::pair<unsigned int, Real>
170  const double,
171  const unsigned int)
172 {
173  libMesh::err << "ERROR: Eigen does not support a user-supplied preconditioner!"
174  << std::endl;
175  libmesh_error();
176 
177  std::pair<unsigned int, Real> p;
178  return p;
179 }
180 
181 } // namespace libMesh
182 
183 #endif // #ifdef LIBMESH_HAVE_EIGEN
184 #endif // LIBMESH_EIGEN_SPARSE_LINEAR_SOLVER_H

Site Created By: libMesh Developers
Last modified: February 07 2014 16:57:04 UTC

Hosted By:
SourceForge.net Logo