Logo  0.95.0-final
Finite Element Embedded Library and Language in C++
Feel++ Feel++ on Github Feel++ community
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
solvereigenslepc.hpp
Go to the documentation of this file.
1 /* -*- mode: c++; coding: utf-8; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; show-trailing-whitespace: t -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
2 
3  This file is part of the Feel library
4 
5  Author(s): Christophe Prud'homme <christophe.prudhomme@feelpp.org>
6  Date: 2007-07-04
7 
8  Copyright (C) 2007-2011 Universite Joseph Fourier (Grenoble I)
9 
10  This library is free software; you can redistribute it and/or
11  modify it under the terms of the GNU Lesser General Public
12  License as published by the Free Software Foundation; either
13  version 3.0 of the License, or (at your option) any later version.
14 
15  This library is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  Lesser General Public License for more details.
19 
20  You should have received a copy of the GNU Lesser General Public
21  License along with this library; if not, write to the Free Software
22  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 */
29 #ifndef __SolverEigenSlepc_H
30 #define __SolverEigenSlepc_H 1
31 
35 
40 #if defined(FEELPP_HAS_SLEPC) && defined(FEELPP_HAS_PETSC)
41 #ifndef USE_COMPLEX_NUMBERS
42 extern "C"
43 {
44 # include <slepceps.h>
45 # include <slepcip.h>
46 }
47 #else
48 # include <slepceps.h>
49 # include <slepcip.h>
50 #endif
51 
52 
53 namespace Feel
54 {
65 template<typename T>
66 class SolverEigenSlepc : public SolverEigen<T>
67 {
68  typedef SolverEigen<T> super;
69 public:
70 
71 
75 
76  typedef typename super::value_type value_type;
77  typedef typename super::real_type real_type;
78 
79  typedef typename super::solvereigen_type solvereigen_type;
80  typedef typename super::solvereigen_ptrtype solvereigen_ptrtype;
81 
82  typedef typename super::vector_ptrtype vector_ptrtype;
83  typedef typename super::sparse_matrix_type sparse_matrix_type;
84 
85  typedef typename super::solve_return_type solve_return_type;
86  typedef typename super::eigenpair_type eigenpair_type;
87 
88  typedef typename super::eigenmodes_type eigenmodes_type;
90 
94 
98  SolverEigenSlepc()
99  {
100  this->M_eigen_solver_type = KRYLOVSCHUR;
101  }
102 
103  SolverEigenSlepc( po::variables_map const& vm, std::string const& prefix = "" )
104  :
105  super( vm, prefix )
106  {
107  }
108 
109  SolverEigenSlepc( SolverEigenSlepc const & );
110 
114  ~SolverEigenSlepc()
115  {
116  this->clear ();
117  }
118 
119 
120 
121 
125  void init();
126 
128 
132 
133 
135 
139 
140 
147  eigenpair_type eigenPair ( unsigned int i );
148 
152  virtual eigenmodes_type eigenModes () ;
153 
158  real_type relativeError ( unsigned int i );
159 
161 
165 
166 
168 
172 
176  void clear();
177 
178 
187  solve_return_type solve ( MatrixSparse<T> &matrix_A,
188  int nev,
189  int ncv,
190  const double tol,
191  const unsigned int m_its );
192 
202  solve_return_type solve ( MatrixSparse<T> &matrix_A,
203  MatrixSparse<T> &matrix_B,
204  int nev,
205  int ncv,
206  const double tol,
207  const unsigned int m_its );
208 
209 
210 
212 
213 
214 
215 private:
216 
221  void setSlepcSolverType ();
222 
227  void setSlepcProblemType ();
228 
233  void setSlepcPositionOfSpectrum();
234 
238  void setSlepcSpectralTransform();
239 
243  EPS M_eps;
244 
248  IP M_ip;
249 
253  Vec M_mode;
254 };
255 po::options_description solvereigenslepc_options( std::string const& prefix = "" );
256 
257 } // Feel
258 
259 #endif // SLEPC PETSC
260 #endif /* __SolverEigenSlepc_H */

Generated on Sun Oct 20 2013 08:25:05 for Feel++ by doxygen 1.8.4