eigen_system.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 #ifndef LIBMESH_EIGEN_SYSTEM_H
20 #define LIBMESH_EIGEN_SYSTEM_H
21 
22 #include "libmesh/libmesh_config.h"
23 
24 // Currently, the EigenSystem should only be available
25 // if SLEPc support is enabled.
26 #if defined(LIBMESH_HAVE_SLEPC)
27 
28 // Local Includes
29 #include "libmesh/system.h"
30 #include "libmesh/eigen_solver.h"
31 
32 // C++ includes
33 
34 namespace libMesh
35 {
36 
37 
38 // Forward Declarations
39 template <typename T> class SparseMatrix;
40 
41 
50 // ------------------------------------------------------------
51 // EigenSystem class definition
52 
53 class EigenSystem : public System
54 {
55 public:
56 
62  const std::string& name,
63  const unsigned int number);
64 
68  virtual ~EigenSystem ();
69 
74 
78  typedef System Parent;
79 
83  sys_type & system () { return *this; }
84 
89  virtual void clear ();
90 
95  virtual void reinit ();
96 
100  virtual void solve ();
101 
105  virtual void assemble ();
106 
111  virtual std::pair<Real, Real> get_eigenpair (unsigned int i);
112 
117  virtual std::string system_type () const { return "Eigen"; }
118 
122  virtual unsigned int n_matrices () const;
123 
127  unsigned int get_n_converged () const {return _n_converged_eigenpairs;}
128 
132  unsigned int get_n_iterations () const {return _n_iterations;}
133 
138 
143 
148  bool generalized () const { return _is_generalized_eigenproblem; }
149 
154 
159 
165 
166 
167 protected:
168 
169 
174  virtual void init_data ();
175 
179  virtual void init_matrices ();
180 
185  void set_n_converged (unsigned int nconv)
186  { _n_converged_eigenpairs = nconv; }
187 
192  void set_n_iterations (unsigned int its)
193  { _n_iterations = its;}
194 
195 
196 private:
197 
202 
206  unsigned int _n_iterations;
207 
213 
218 
219 
220 };
221 
222 
223 
224 // ------------------------------------------------------------
225 // EigenSystem inline methods
226 inline
227 unsigned int EigenSystem::n_matrices () const
228 {
230  return 2;
231 
232  return 1;
233 }
234 
235 
236 } // namespace libMesh
237 
238 
239 #endif // LIBMESH_HAVE_SLEPC
240 
241 #endif // LIBMESH_EIGEN_SYSTEM_H

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

Hosted By:
SourceForge.net Logo