laspack_linear_solver.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2018 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 namespace libMesh
39 {
40 
49 template <typename T>
51 {
52 public:
57 
62 
66  virtual void clear () override;
67 
71  virtual void init (const char * name = nullptr) override;
72 
76  virtual 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) override;
82 
86  virtual std::pair<unsigned int, Real>
88  NumericVector<T> & solution,
89  NumericVector<T> & rhs,
90  const double tol,
91  const unsigned int m_its) override;
92 
96  virtual 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) override;
103 
107  virtual 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) override;
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) override;
126 
131  virtual void print_converged_reason() const override;
132 
136  virtual LinearConvergenceReason get_converged_reason() const override;
137 
138 private:
139 
145 
149  PrecondProcType _precond_type;
150 };
151 
152 
153 /*----------------------- functions ----------------------------------*/
154 template <typename T>
155 inline
157  LinearSolver<T>(comm),
158  _precond_type (ILUPrecond)
159 {
160 }
161 
162 
163 
164 template <typename T>
165 inline
167 {
168  this->clear ();
169 }
170 
171 
172 
173 template <typename T>
174 inline
175 std::pair<unsigned int, Real>
177  SparseMatrix<T> &,
180  const double,
181  const unsigned int)
182 {
183  libmesh_error_msg("ERROR: LASPACK does not support a user-supplied preconditioner!");
184 
185  std::pair<unsigned int, Real> p;
186  return p;
187 }
188 
189 } // namespace libMesh
190 
191 #endif // #ifdef LIBMESH_HAVE_LASPACK
192 #endif // LIBMESH_LASPACK_LINEAR_SOLVER_H
std::string name(const ElemQuality q)
Definition: elem_quality.C:42
virtual void print_converged_reason() const override
virtual void init(const char *name=nullptr) override
Provides a uniform interface to vector storage schemes for different linear algebra libraries...
Definition: diff_context.h:40
const Parallel::Communicator & comm() const
LaspackLinearSolver(const libMesh::Parallel::Communicator &comm)
virtual std::pair< unsigned int, Real > solve(SparseMatrix< T > &matrix, NumericVector< T > &solution, NumericVector< T > &rhs, const double tol, const unsigned int m_its) override
virtual void clear() override
virtual LinearConvergenceReason get_converged_reason() const override
virtual std::pair< unsigned int, Real > adjoint_solve(SparseMatrix< T > &matrix, NumericVector< T > &solution, NumericVector< T > &rhs, const double tol, const unsigned int m_its) override