libMesh::EigenSolver< T > Class Template Reference
#include <eigen_solver.h>

Public Member Functions | |
| EigenSolver () | |
| virtual | ~EigenSolver () |
| bool | initialized () const |
| virtual void | clear () |
| virtual void | init ()=0 |
| EigenSolverType | eigen_solver_type () const |
| EigenProblemType | eigen_problem_type () const |
| PositionOfSpectrum | position_of_spectrum () const |
| void | set_eigensolver_type (const EigenSolverType est) |
| void | set_eigenproblem_type (EigenProblemType ept) |
| void | set_position_of_spectrum (PositionOfSpectrum pos) |
| virtual std::pair< unsigned int, unsigned int > | solve_standard (SparseMatrix< T > &matrix_A, int nev, int ncv, const double tol, const unsigned int m_its)=0 |
| virtual std::pair< unsigned int, unsigned int > | solve_standard (ShellMatrix< T > &matrix_A, int nev, int ncv, const double tol, const unsigned int m_its)=0 |
| virtual std::pair< unsigned int, unsigned int > | solve_generalized (SparseMatrix< T > &matrix_A, SparseMatrix< T > &matrix_B, int nev, int ncv, const double tol, const unsigned int m_its)=0 |
| virtual std::pair< unsigned int, unsigned int > | solve_generalized (ShellMatrix< T > &matrix_A, SparseMatrix< T > &matrix_B, int nev, int ncv, const double tol, const unsigned int m_its)=0 |
| virtual std::pair< unsigned int, unsigned int > | solve_generalized (SparseMatrix< T > &matrix_A, ShellMatrix< T > &matrix_B, int nev, int ncv, const double tol, const unsigned int m_its)=0 |
| virtual std::pair< unsigned int, unsigned int > | solve_generalized (ShellMatrix< T > &matrix_A, ShellMatrix< T > &matrix_B, int nev, int ncv, const double tol, const unsigned int m_its)=0 |
| virtual std::pair< Real, Real > | get_eigenpair (unsigned int i, NumericVector< T > &solution)=0 |
| virtual std::pair< Real, Real > | get_eigenvalue (unsigned int i)=0 |
| virtual void | attach_deflation_space (NumericVector< T > &deflation_vector)=0 |
Static Public Member Functions | |
| static AutoPtr< EigenSolver< T > > | build (const SolverPackage solver_package=SLEPC_SOLVERS) |
| static std::string | get_info () |
| static void | print_info (std::ostream &out=libMesh::out) |
| static unsigned int | n_objects () |
| static void | enable_print_counter_info () |
| static void | disable_print_counter_info () |
Protected Types | |
| typedef std::map< std::string, std::pair< unsigned int, unsigned int > > | Counts |
Protected Member Functions | |
| void | increment_constructor_count (const std::string &name) |
| void | increment_destructor_count (const std::string &name) |
Protected Attributes | |
| EigenSolverType | _eigen_solver_type |
| EigenProblemType | _eigen_problem_type |
| PositionOfSpectrum | _position_of_spectrum |
| bool | _is_initialized |
Static Protected Attributes | |
| static Counts | _counts |
| static Threads::atomic < unsigned int > | _n_objects |
| static Threads::spin_mutex | _mutex |
| static bool | _enable_print_counter = true |
Detailed Description
template<typename T>
class libMesh::EigenSolver< T >
This class provides an interface to solvers for eigenvalue problems.
Definition at line 52 of file eigen_solver.h.
Member Typedef Documentation
typedef std::map<std::string, std::pair<unsigned int, unsigned int> > libMesh::ReferenceCounter::Counts [protected, inherited] |
Data structure to log the information. The log is identified by the class name.
Definition at line 113 of file reference_counter.h.
Constructor & Destructor Documentation
| libMesh::EigenSolver< T >::EigenSolver | ( | ) | [inline] |
Constructor. Initializes Solver data structures
Definition at line 242 of file eigen_solver.h.
00242 : 00243 00244 _eigen_solver_type (ARNOLDI), 00245 _eigen_problem_type (NHEP), 00246 _position_of_spectrum (LARGEST_MAGNITUDE), 00247 _is_initialized (false) 00248 { 00249 }
| libMesh::EigenSolver< T >::~EigenSolver | ( | ) | [inline, virtual] |
Destructor.
Definition at line 255 of file eigen_solver.h.
References libMesh::EigenSolver< T >::clear().
00256 { 00257 this->clear (); 00258 }
Member Function Documentation
| virtual void libMesh::EigenSolver< T >::attach_deflation_space | ( | NumericVector< T > & | deflation_vector | ) | [pure virtual] |
Attach a deflation space defined by a single vector.
Implemented in libMesh::SlepcEigenSolver< T >.
| AutoPtr< EigenSolver< T > > libMesh::EigenSolver< T >::build | ( | const SolverPackage | solver_package = SLEPC_SOLVERS |
) | [inline, static] |
Builds an EigenSolver using the linear solver package specified by solver_package
Definition at line 37 of file eigen_solver.C.
References libMesh::err, and libMeshEnums::SLEPC_SOLVERS.
00038 { 00039 // Build the appropriate solver 00040 switch (solver_package) 00041 { 00042 00043 00044 00045 #ifdef LIBMESH_HAVE_SLEPC 00046 case SLEPC_SOLVERS: 00047 { 00048 AutoPtr<EigenSolver<T> > ap(new SlepcEigenSolver<T>); 00049 return ap; 00050 } 00051 #endif 00052 00053 00054 default: 00055 libMesh::err << "ERROR: Unrecognized eigen solver package: " 00056 << solver_package 00057 << std::endl; 00058 libmesh_error(); 00059 } 00060 00061 AutoPtr<EigenSolver<T> > ap(NULL); 00062 return ap; 00063 }
| virtual void libMesh::EigenSolver< T >::clear | ( | ) | [inline, virtual] |
Release all memory and clear data structures.
Reimplemented in libMesh::SlepcEigenSolver< T >.
Definition at line 83 of file eigen_solver.h.
Referenced by libMesh::EigenSolver< T >::~EigenSolver().
| void libMesh::ReferenceCounter::disable_print_counter_info | ( | ) | [static, inherited] |
Definition at line 106 of file reference_counter.C.
References libMesh::ReferenceCounter::_enable_print_counter.
00107 { 00108 _enable_print_counter = false; 00109 return; 00110 }
| EigenProblemType libMesh::EigenSolver< T >::eigen_problem_type | ( | ) | const [inline] |
Returns the type of the eigen problem.
Definition at line 98 of file eigen_solver.h.
00098 { return _eigen_problem_type;}
| EigenSolverType libMesh::EigenSolver< T >::eigen_solver_type | ( | ) | const [inline] |
Returns the type of eigensolver to use.
Definition at line 93 of file eigen_solver.h.
00093 { return _eigen_solver_type; }
| void libMesh::ReferenceCounter::enable_print_counter_info | ( | ) | [static, inherited] |
Methods to enable/disable the reference counter output from print_info()
Definition at line 100 of file reference_counter.C.
References libMesh::ReferenceCounter::_enable_print_counter.
00101 { 00102 _enable_print_counter = true; 00103 return; 00104 }
| virtual std::pair<Real, Real> libMesh::EigenSolver< T >::get_eigenpair | ( | unsigned int | i, | |
| NumericVector< T > & | solution | |||
| ) | [pure virtual] |
Returns the ith eigenvalue (real and imaginary part), and copies the \ ith eigen vector to the solution vector.
Implemented in libMesh::SlepcEigenSolver< T >.
| virtual std::pair<Real, Real> libMesh::EigenSolver< T >::get_eigenvalue | ( | unsigned int | i | ) | [pure virtual] |
Returns the ith eigenvalue (real and imaginary part). Same as above function, except it does copy the eigenvector.
Implemented in libMesh::SlepcEigenSolver< T >.
| std::string libMesh::ReferenceCounter::get_info | ( | ) | [static, inherited] |
Gets a string containing the reference information.
Definition at line 47 of file reference_counter.C.
References libMesh::ReferenceCounter::_counts, and libMesh::Quality::name().
Referenced by libMesh::ReferenceCounter::print_info().
00048 { 00049 #if defined(LIBMESH_ENABLE_REFERENCE_COUNTING) && defined(DEBUG) 00050 00051 std::ostringstream oss; 00052 00053 oss << '\n' 00054 << " ---------------------------------------------------------------------------- \n" 00055 << "| Reference count information |\n" 00056 << " ---------------------------------------------------------------------------- \n"; 00057 00058 for (Counts::iterator it = _counts.begin(); 00059 it != _counts.end(); ++it) 00060 { 00061 const std::string name(it->first); 00062 const unsigned int creations = it->second.first; 00063 const unsigned int destructions = it->second.second; 00064 00065 oss << "| " << name << " reference count information:\n" 00066 << "| Creations: " << creations << '\n' 00067 << "| Destructions: " << destructions << '\n'; 00068 } 00069 00070 oss << " ---------------------------------------------------------------------------- \n"; 00071 00072 return oss.str(); 00073 00074 #else 00075 00076 return ""; 00077 00078 #endif 00079 }
| void libMesh::ReferenceCounter::increment_constructor_count | ( | const std::string & | name | ) | [inline, protected, inherited] |
Increments the construction counter. Should be called in the constructor of any derived class that will be reference counted.
Definition at line 163 of file reference_counter.h.
References libMesh::ReferenceCounter::_counts, and libMesh::Threads::spin_mtx.
Referenced by libMesh::ReferenceCountedObject< RBParametrized >::ReferenceCountedObject().
00164 { 00165 Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx); 00166 std::pair<unsigned int, unsigned int>& p = _counts[name]; 00167 00168 p.first++; 00169 }
| void libMesh::ReferenceCounter::increment_destructor_count | ( | const std::string & | name | ) | [inline, protected, inherited] |
Increments the destruction counter. Should be called in the destructor of any derived class that will be reference counted.
Definition at line 176 of file reference_counter.h.
References libMesh::ReferenceCounter::_counts, and libMesh::Threads::spin_mtx.
Referenced by libMesh::ReferenceCountedObject< RBParametrized >::~ReferenceCountedObject().
00177 { 00178 Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx); 00179 std::pair<unsigned int, unsigned int>& p = _counts[name]; 00180 00181 p.second++; 00182 }
| virtual void libMesh::EigenSolver< T >::init | ( | ) | [pure virtual] |
Initialize data structures if not done so already.
Implemented in libMesh::SlepcEigenSolver< T >.
| bool libMesh::EigenSolver< T >::initialized | ( | ) | const [inline] |
- Returns:
- true if the data structures are initialized, false otherwise.
Definition at line 77 of file eigen_solver.h.
Referenced by libMesh::SlepcEigenSolver< T >::clear(), and libMesh::SlepcEigenSolver< T >::init().
00077 { return _is_initialized; }
| static unsigned int libMesh::ReferenceCounter::n_objects | ( | ) | [inline, static, inherited] |
Prints the number of outstanding (created, but not yet destroyed) objects.
Definition at line 79 of file reference_counter.h.
References libMesh::ReferenceCounter::_n_objects.
00080 { return _n_objects; }
| PositionOfSpectrum libMesh::EigenSolver< T >::position_of_spectrum | ( | ) | const [inline] |
Returns the position of the spectrum to compute.
Definition at line 103 of file eigen_solver.h.
00104 { return _position_of_spectrum;}
| void libMesh::ReferenceCounter::print_info | ( | std::ostream & | out = libMesh::out |
) | [static, inherited] |
Prints the reference information, by default to libMesh::out.
Definition at line 88 of file reference_counter.C.
References libMesh::ReferenceCounter::_enable_print_counter, and libMesh::ReferenceCounter::get_info().
00089 { 00090 if( _enable_print_counter ) out_stream << ReferenceCounter::get_info(); 00091 }
| void libMesh::EigenSolver< T >::set_eigenproblem_type | ( | EigenProblemType | ept | ) | [inline] |
Sets the type of the eigenproblem.
Definition at line 115 of file eigen_solver.h.
00116 {_eigen_problem_type = ept;}
| void libMesh::EigenSolver< T >::set_eigensolver_type | ( | const EigenSolverType | est | ) | [inline] |
Sets the type of eigensolver to use.
Definition at line 109 of file eigen_solver.h.
00110 { _eigen_solver_type = est; }
| void libMesh::EigenSolver< T >::set_position_of_spectrum | ( | PositionOfSpectrum | pos | ) | [inline] |
Sets the position of the spectrum.
Definition at line 121 of file eigen_solver.h.
00122 {_position_of_spectrum= pos;}
| virtual std::pair<unsigned int, unsigned int> libMesh::EigenSolver< T >::solve_generalized | ( | ShellMatrix< T > & | matrix_A, | |
| ShellMatrix< T > & | matrix_B, | |||
| int | nev, | |||
| int | ncv, | |||
| const double | tol, | |||
| const unsigned int | m_its | |||
| ) | [pure virtual] |
Solves the generalized eigen problem when both matrix_A and matrix_B are of type ShellMatrix.
Implemented in libMesh::SlepcEigenSolver< T >.
| virtual std::pair<unsigned int, unsigned int> libMesh::EigenSolver< T >::solve_generalized | ( | SparseMatrix< T > & | matrix_A, | |
| ShellMatrix< T > & | matrix_B, | |||
| int | nev, | |||
| int | ncv, | |||
| const double | tol, | |||
| const unsigned int | m_its | |||
| ) | [pure virtual] |
Solves the generalized eigen problem when matrix_A is a SparseMatrix and matrix_B is a ShellMatrix.
Implemented in libMesh::SlepcEigenSolver< T >.
| virtual std::pair<unsigned int, unsigned int> libMesh::EigenSolver< T >::solve_generalized | ( | ShellMatrix< T > & | matrix_A, | |
| SparseMatrix< T > & | matrix_B, | |||
| int | nev, | |||
| int | ncv, | |||
| const double | tol, | |||
| const unsigned int | m_its | |||
| ) | [pure virtual] |
Solves the generalized eigen problem when matrix_A is a ShellMatrix and matrix_B is a SparseMatrix.
Implemented in libMesh::SlepcEigenSolver< T >.
| virtual std::pair<unsigned int, unsigned int> libMesh::EigenSolver< T >::solve_generalized | ( | SparseMatrix< T > & | matrix_A, | |
| SparseMatrix< T > & | matrix_B, | |||
| int | nev, | |||
| int | ncv, | |||
| const double | tol, | |||
| const unsigned int | m_its | |||
| ) | [pure virtual] |
Solves the generalized eigen problem when both matrix_A and matrix_B are of type SparseMatrix and returns the number of converged eigenpairs and the number of iterations.
Implemented in libMesh::SlepcEigenSolver< T >.
| virtual std::pair<unsigned int, unsigned int> libMesh::EigenSolver< T >::solve_standard | ( | ShellMatrix< T > & | matrix_A, | |
| int | nev, | |||
| int | ncv, | |||
| const double | tol, | |||
| const unsigned int | m_its | |||
| ) | [pure virtual] |
Solves the standard eigen problem when matrix_A is a ShellMatrix, and returns the number of converged eigenpairs and the number of iterations.
Implemented in libMesh::SlepcEigenSolver< T >.
| virtual std::pair<unsigned int, unsigned int> libMesh::EigenSolver< T >::solve_standard | ( | SparseMatrix< T > & | matrix_A, | |
| int | nev, | |||
| int | ncv, | |||
| const double | tol, | |||
| const unsigned int | m_its | |||
| ) | [pure virtual] |
Solves the standard eigen problem when matrix_A is a SparseMatrix, and returns the number of converged eigenpairs and the number of iterations.
Implemented in libMesh::SlepcEigenSolver< T >.
Member Data Documentation
ReferenceCounter::Counts libMesh::ReferenceCounter::_counts [static, protected, inherited] |
Actually holds the data.
Definition at line 118 of file reference_counter.h.
Referenced by libMesh::ReferenceCounter::get_info(), libMesh::ReferenceCounter::increment_constructor_count(), and libMesh::ReferenceCounter::increment_destructor_count().
EigenProblemType libMesh::EigenSolver< T >::_eigen_problem_type [protected] |
Enum stating which type of eigen problem we deal with.
Definition at line 222 of file eigen_solver.h.
Referenced by libMesh::EigenSolver< Number >::eigen_problem_type(), libMesh::EigenSolver< Number >::set_eigenproblem_type(), libMesh::SlepcEigenSolver< T >::set_slepc_problem_type(), and libMesh::SlepcEigenSolver< T >::SlepcEigenSolver().
EigenSolverType libMesh::EigenSolver< T >::_eigen_solver_type [protected] |
Enum stating which type of eigensolver to use.
Definition at line 217 of file eigen_solver.h.
Referenced by libMesh::SlepcEigenSolver< T >::clear(), libMesh::EigenSolver< Number >::eigen_solver_type(), libMesh::EigenSolver< Number >::set_eigensolver_type(), libMesh::SlepcEigenSolver< T >::set_slepc_solver_type(), and libMesh::SlepcEigenSolver< T >::SlepcEigenSolver().
bool libMesh::ReferenceCounter::_enable_print_counter = true [static, protected, inherited] |
Flag to control whether reference count information is printed when print_info is called.
Definition at line 137 of file reference_counter.h.
Referenced by libMesh::ReferenceCounter::disable_print_counter_info(), libMesh::ReferenceCounter::enable_print_counter_info(), and libMesh::ReferenceCounter::print_info().
bool libMesh::EigenSolver< T >::_is_initialized [protected] |
Flag indicating if the data structures have been initialized.
Definition at line 232 of file eigen_solver.h.
Referenced by libMesh::SlepcEigenSolver< T >::clear(), libMesh::SlepcEigenSolver< T >::init(), and libMesh::EigenSolver< Number >::initialized().
Threads::spin_mutex libMesh::ReferenceCounter::_mutex [static, protected, inherited] |
Mutual exclusion object to enable thread-safe reference counting.
Definition at line 131 of file reference_counter.h.
Threads::atomic< unsigned int > libMesh::ReferenceCounter::_n_objects [static, protected, inherited] |
The number of objects. Print the reference count information when the number returns to 0.
Definition at line 126 of file reference_counter.h.
Referenced by libMesh::ReferenceCounter::n_objects(), libMesh::ReferenceCounter::ReferenceCounter(), and libMesh::ReferenceCounter::~ReferenceCounter().
PositionOfSpectrum libMesh::EigenSolver< T >::_position_of_spectrum [protected] |
Enum stating where to evaluate the spectrum.
Definition at line 227 of file eigen_solver.h.
Referenced by libMesh::EigenSolver< Number >::position_of_spectrum(), libMesh::EigenSolver< Number >::set_position_of_spectrum(), and libMesh::SlepcEigenSolver< T >::set_slepc_position_of_spectrum().
The documentation for this class was generated from the following files:
Site Created By: libMesh Developers
Last modified: February 05 2013 19:55:16 UTC
Hosted By: