laspack_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_LASPACK_LINEAR_SOLVER_H
21 #define LIBMESH_LASPACK_LINEAR_SOLVER_H
22 
23 #include "libmesh/libmesh_common.h"
24 
25 #if defined(LIBMESH_HAVE_LASPACK)
26 //#if defined(LIBMESH_HAVE_LASPACK) && !defined(LIBMESH_USE_COMPLEX_NUMBERS)
27 
28 // Laspack includes
29 #include <itersolv.h>
30 #include <rtc.h>
31 #include <errhandl.h>
32 
33 // Local includes
34 #include "libmesh/linear_solver.h"
35 #include "libmesh/laspack_vector.h"
36 #include "libmesh/laspack_matrix.h"
37 
38 // C++ includes
39 
40 namespace libMesh
41 {
42 
43 
44 
52 template <typename T>
54 {
55  public:
60  LIBMESH_CAN_DEFAULT_TO_COMMWORLD);
61 
66 
70  void clear ();
71 
75  void init ();
76 
80  std::pair<unsigned int, Real>
81  solve (SparseMatrix<T> &matrix,
82  NumericVector<T> &solution,
83  NumericVector<T> &rhs,
84  const double tol,
85  const unsigned int m_its);
86 
90  std::pair<unsigned int, Real>
92  NumericVector<T> &solution,
93  NumericVector<T> &rhs,
94  const double tol,
95  const unsigned int m_its);
96 
100  std::pair<unsigned int, Real>
101  solve (SparseMatrix<T> &matrix,
102  SparseMatrix<T> &pc,
103  NumericVector<T> &solution,
104  NumericVector<T> &rhs,
105  const double tol,
106  const unsigned int m_its);
107 
111  std::pair<unsigned int, Real>
112  solve (const ShellMatrix<T>& shell_matrix,
113  NumericVector<T>& solution_in,
114  NumericVector<T>& rhs_in,
115  const double tol,
116  const unsigned int m_its);
117 
123  virtual std::pair<unsigned int, Real>
124  solve (const ShellMatrix<T>& shell_matrix,
125  const SparseMatrix<T>& precond_matrix,
126  NumericVector<T>& solution_in,
127  NumericVector<T>& rhs_in,
128  const double tol,
129  const unsigned int m_its);
130 
135  virtual void print_converged_reason();
136 
137  private:
138 
144 
148  PrecondProcType _precond_type;
149 };
150 
151 
152 /*----------------------- functions ----------------------------------*/
153 template <typename T>
154 inline
156  LinearSolver<T>(comm),
157  _precond_type (ILUPrecond)
158 {
159 }
160 
161 
162 
163 template <typename T>
164 inline
166 {
167  this->clear ();
168 }
169 
170 
171 
172 template <typename T>
173 inline
174 std::pair<unsigned int, Real>
179  const double,
180  const unsigned int)
181 {
182  libMesh::err << "ERROR: LASPACK does not support a user-supplied preconditioner!"
183  << std::endl;
184  libmesh_error();
185 
186  std::pair<unsigned int, Real> p;
187  return p;
188 }
189 
190 } // namespace libMesh
191 
192 #endif // #ifdef LIBMESH_HAVE_LASPACK
193 #endif // LIBMESH_LASPACK_LINEAR_SOLVER_H

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

Hosted By:
SourceForge.net Logo