eigen_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_SOLVER_H
21 #define LIBMESH_EIGEN_SOLVER_H
22 
23 
24 #include "libmesh/libmesh_config.h"
25 #ifdef LIBMESH_HAVE_SLEPC
26 
27 // Local includes
28 #include "libmesh/libmesh_common.h"
32 #include "libmesh/libmesh.h"
34 
35 
36 // C++ includes
37 
38 namespace libMesh
39 {
40 
41 // forward declarations
42 template <typename T> class AutoPtr;
43 template <typename T> class SparseMatrix;
44 template <typename T> class ShellMatrix;
45 template <typename T> class NumericVector;
46 
47 
53 template <typename T>
54 class EigenSolver : public ReferenceCountedObject<EigenSolver<T> >,
55  public ParallelObject
56 {
57 public:
58 
63  LIBMESH_CAN_DEFAULT_TO_COMMWORLD);
64 
68  virtual ~EigenSolver ();
69 
75  LIBMESH_CAN_DEFAULT_TO_COMMWORLD,
76  const SolverPackage solver_package = SLEPC_SOLVERS);
77 
82  bool initialized () const { return _is_initialized; }
83 
84 
88  virtual void clear () {}
89 
93  virtual void init () = 0;
94 
99 
104 
109  { return _position_of_spectrum;}
110 
115  { _eigen_solver_type = est; }
116 
121  {_eigen_problem_type = ept;}
122 
127  {_position_of_spectrum= pos;}
128 
134  virtual std::pair<unsigned int, unsigned int> solve_standard (SparseMatrix<T> &matrix_A,
135  int nev,
136  int ncv,
137  const double tol,
138  const unsigned int m_its) = 0;
139 
145  virtual std::pair<unsigned int, unsigned int> solve_standard (ShellMatrix<T> &matrix_A,
146  int nev,
147  int ncv,
148  const double tol,
149  const unsigned int m_its) = 0;
150 
151 
158  virtual std::pair<unsigned int, unsigned int> solve_generalized (SparseMatrix<T> &matrix_A,
159  SparseMatrix<T> &matrix_B,
160  int nev,
161  int ncv,
162  const double tol,
163  const unsigned int m_its) = 0;
164 
169  virtual std::pair<unsigned int, unsigned int> solve_generalized (ShellMatrix<T> &matrix_A,
170  SparseMatrix<T> &matrix_B,
171  int nev,
172  int ncv,
173  const double tol,
174  const unsigned int m_its) = 0;
175 
180  virtual std::pair<unsigned int, unsigned int> solve_generalized (SparseMatrix<T> &matrix_A,
181  ShellMatrix<T> &matrix_B,
182  int nev,
183  int ncv,
184  const double tol,
185  const unsigned int m_its) = 0;
186 
191  virtual std::pair<unsigned int, unsigned int> solve_generalized (ShellMatrix<T> &matrix_A,
192  ShellMatrix<T> &matrix_B,
193  int nev,
194  int ncv,
195  const double tol,
196  const unsigned int m_its) = 0;
197 
198 
203  virtual std::pair<Real, Real> get_eigenpair (unsigned int i,
204  NumericVector<T> &solution) = 0;
205 
210  virtual std::pair<Real, Real> get_eigenvalue (unsigned int i) = 0;
211 
215  virtual void attach_deflation_space(NumericVector<T> &deflation_vector) = 0;
216 
217 protected:
218 
223 
228 
233 
238 
239 };
240 
241 
242 
243 
244 /*----------------------- inline functions ----------------------------------*/
245 template <typename T>
246 inline
248  ParallelObject(comm_in),
249  _eigen_solver_type (ARNOLDI),
250  _eigen_problem_type (NHEP),
251  _position_of_spectrum (LARGEST_MAGNITUDE),
252  _is_initialized (false)
253 {
254 }
255 
256 
257 
258 template <typename T>
259 inline
261 {
262  this->clear ();
263 }
264 
265 } // namespace libMesh
266 
267 #endif // LIBMESH_HAVE_SLEPC
268 
269 #endif // LIBMESH_EIGEN_SOLVER_H

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

Hosted By:
SourceForge.net Logo