19#ifndef LIBMESH_EIGEN_SYSTEM_H
20#define LIBMESH_EIGEN_SYSTEM_H
22#include "libmesh/libmesh_config.h"
26#if defined(LIBMESH_HAVE_SLEPC)
29#include "libmesh/system.h"
30#include "libmesh/eigen_solver.h"
36template <
typename T>
class SparseMatrix;
37template <
typename T>
class ShellMatrix;
63 const std::string & name_in,
64 const unsigned int number_in);
96 virtual void clear ()
override;
102 virtual void reinit ()
override;
107 virtual void solve ()
override;
125 virtual std::string
system_type ()
const override {
return "Eigen"; }
This class provides an interface to solvers for eigenvalue problems.
Manages consistently variables, degrees of freedom, and coefficient vectors for eigenvalue problems.
SparseMatrix< Number > * matrix_A
The system matrix for standard eigenvalue problems.
void set_initial_space(NumericVector< Number > &initial_space_in)
Sets an initial eigen vector.
virtual std::pair< Real, Real > get_eigenvalue(dof_id_type i)
bool _use_shell_matrices
A boolean flag to indicate whether or not to use shell matrices.
virtual std::string system_type() const override
void set_eigenproblem_type(EigenProblemType ept)
Sets the type of the current eigen problem.
unsigned int _n_converged_eigenpairs
The number of converged eigenpairs.
EigenSystem(EigenSystem &&)=default
EigenProblemType _eigen_problem_type
The type of the eigenvalue problem.
SparseMatrix< Number > * matrix_B
A second system matrix for generalized eigenvalue problems.
bool use_shell_matrices() const
virtual void clear() override
Clear all the data structures associated with the system.
bool has_precond_matrix() const
bool has_matrix_A() const
std::unique_ptr< ShellMatrix< Number > > shell_matrix_A
The system shell matrix for standard eigenvalue problems.
unsigned int _n_iterations
The number of iterations of the eigen solver algorithm.
bool _use_shell_precond_matrix
A boolean flag to indicate whether or not to use a shell preconditioning matrix.
const SparseMatrix< Number > & get_matrix_B() const
void set_n_converged(unsigned int nconv)
Set the _n_converged_eigenpairs member, useful for subclasses of EigenSystem.
virtual void solve() override
Assembles & solves the eigen system.
virtual std::pair< Real, Real > get_eigenpair(dof_id_type i)
const SparseMatrix< Number > & get_precond_matrix() const
std::unique_ptr< ShellMatrix< Number > > shell_precond_matrix
A preconditioning shell matrix.
const ShellMatrix< Number > & get_shell_matrix_A() const
unsigned int get_n_converged() const
const ShellMatrix< Number > & get_shell_precond_matrix() const
SparseMatrix< Number > * precond_matrix
A preconditioning matrix.
void use_shell_matrices(bool use_shell_matrices)
Set a flag to use shell matrices.
bool has_matrix_B() const
EigenProblemType get_eigenproblem_type() const
bool has_shell_precond_matrix() const
bool use_shell_precond_matrix() const
virtual void init_matrices() override
Initializes the matrices associated with the system.
EigenSystem & operator=(const EigenSystem &)=delete
void solve_helper(SparseMatrix< Number > *const A, SparseMatrix< Number > *const B, SparseMatrix< Number > *const P)
unsigned int get_n_iterations() const
const ShellMatrix< Number > & get_shell_matrix_B() const
System Parent
The type of the parent.
EigenSystem sys_type
The type of system.
const SparseMatrix< Number > & get_matrix_A() const
std::unique_ptr< EigenSolver< Number > > eigen_solver
The EigenSolver, defining which interface, i.e solver package to use.
bool has_shell_matrix_A() const
const EigenSolver< Number > & get_eigen_solver() const
void use_shell_precond_matrix(bool use_shell_precond_matrix)
Set a flag to use a shell preconditioning matrix.
virtual void reinit() override
Reinitializes the member data fields associated with the system, so that, e.g., assemble() may be use...
EigenSystem(const EigenSystem &)=delete
Special functions.
virtual void add_matrices() override
Adds the necessary matrices and shell matrices.
void set_n_iterations(unsigned int its)
Set the _n_iterations member, useful for subclasses of EigenSystem.
bool has_shell_matrix_B() const
std::unique_ptr< ShellMatrix< Number > > shell_matrix_B
A second system shell matrix for generalized eigenvalue problems.
This is the EquationSystems class.
Provides a uniform interface to vector storage schemes for different linear algebra libraries.
Generic shell matrix, i.e.
Manages consistently variables, degrees of freedom, and coefficient vectors.
The libMesh namespace provides an interface to certain functionality in the library.
EigenProblemType
Defines an enum for eigenproblem types.