FEAT 3
Finite Element Analysis Toolbox
Loading...
Searching...
No Matches
FEAT::Solver::JacobiPrecond< Matrix_, Filter_ > Class Template Referenceabstract

Jacobi preconditioner implementation. More...

#include <jacobi_precond.hpp>

Inheritance diagram for FEAT::Solver::JacobiPrecond< Matrix_, Filter_ >:
FEAT::Solver::SolverBase< Matrix_::VectorTypeL >

Public Types

typedef SolverBase< VectorTypeBaseClass
 Our base class. More...
 
typedef MatrixType::DataType DataType
 The floating point precision. More...
 
typedef Filter_ FilterType
 The filter type. More...
 
typedef Matrix_ MatrixType
 The matrix type. More...
 
typedef MatrixType::VectorTypeL VectorType
 The type of vector this solver can be applied to. More...
 

Public Member Functions

 JacobiPrecond (const MatrixType &matrix, const FilterType &filter, DataType omega=DataType(1))
 Constructor. More...
 
 JacobiPrecond (const String &section_name, const PropertyMap *section, const MatrixType &matrix, const FilterType &filter)
 Constructor using a PropertyMap. More...
 
virtual ~JacobiPrecond ()
 Empty virtual destructor. More...
 
virtual Status apply (Matrix_::VectorTypeL &vec_cor, const Matrix_::VectorTypeL &vec_def)=0
 Solver application method. More...
 
virtual Status apply (VectorType &vec_cor, const VectorType &vec_def) override
 Solver application method. More...
 
virtual void done ()
 Finalization method. More...
 
virtual void done_numeric ()
 Numeric finalization method. More...
 
virtual void done_symbolic () override
 Symbolic finalization method. More...
 
virtual void init ()
 Initialization method. More...
 
virtual void init_numeric () override
 Numeric initialization method. More...
 
virtual void init_symbolic () override
 Symbolic initialization method. More...
 
virtual String name () const override
 Returns a descriptive string. More...
 
void set_omega (DataType omega)
 Sets the damping parameter. More...
 

Protected Attributes

const FilterType_filter
 The filter for projecting solution and defect to subspaces. More...
 
VectorType _inv_diag
 The component-wise inverted diagonal of _matrix. More...
 
const MatrixType_matrix
 The system matrix. More...
 
DataType _omega
 The damping parameter. More...
 

Detailed Description

template<typename Matrix_, typename Filter_>
class FEAT::Solver::JacobiPrecond< Matrix_, Filter_ >

Jacobi preconditioner implementation.

This class implements a simple damped Jacobi preconditioner.

This implementation works for the following matrix types and combinations thereof:

Moreover, this implementation supports all data and index types.

Author
Peter Zajac

Definition at line 33 of file jacobi_precond.hpp.

Member Typedef Documentation

◆ BaseClass

template<typename Matrix_ , typename Filter_ >
typedef SolverBase<VectorType> FEAT::Solver::JacobiPrecond< Matrix_, Filter_ >::BaseClass

Our base class.

Definition at line 46 of file jacobi_precond.hpp.

◆ DataType

template<typename Matrix_ , typename Filter_ >
typedef MatrixType::DataType FEAT::Solver::JacobiPrecond< Matrix_, Filter_ >::DataType

The floating point precision.

Definition at line 44 of file jacobi_precond.hpp.

◆ FilterType

template<typename Matrix_ , typename Filter_ >
typedef Filter_ FEAT::Solver::JacobiPrecond< Matrix_, Filter_ >::FilterType

The filter type.

Definition at line 40 of file jacobi_precond.hpp.

◆ MatrixType

template<typename Matrix_ , typename Filter_ >
typedef Matrix_ FEAT::Solver::JacobiPrecond< Matrix_, Filter_ >::MatrixType

The matrix type.

Definition at line 38 of file jacobi_precond.hpp.

◆ VectorType

template<typename Matrix_ , typename Filter_ >
typedef MatrixType::VectorTypeL FEAT::Solver::JacobiPrecond< Matrix_, Filter_ >::VectorType

The type of vector this solver can be applied to.

Definition at line 42 of file jacobi_precond.hpp.

Constructor & Destructor Documentation

◆ JacobiPrecond() [1/2]

template<typename Matrix_ , typename Filter_ >
FEAT::Solver::JacobiPrecond< Matrix_, Filter_ >::JacobiPrecond ( const MatrixType matrix,
const FilterType filter,
DataType  omega = DataType(1) 
)
inlineexplicit

Constructor.

Parameters
[in]matrixThe matrix whose main diagonal is to be used.
[in]filterThe system filter.
[in]omegaThe damping parameter for the preconditioner.

Definition at line 71 of file jacobi_precond.hpp.

◆ JacobiPrecond() [2/2]

template<typename Matrix_ , typename Filter_ >
FEAT::Solver::JacobiPrecond< Matrix_, Filter_ >::JacobiPrecond ( const String section_name,
const PropertyMap section,
const MatrixType matrix,
const FilterType filter 
)
inlineexplicit

Constructor using a PropertyMap.

Parameters
[in]section_nameThe name of the config section, which it does not know by itself
[in]sectionA pointer to the PropertyMap section configuring this solver
[in]matrixThe system matrix.
[in]filterThe system filter.
Returns
A shared pointer to a new JacobiPrecond object.

Definition at line 96 of file jacobi_precond.hpp.

References FEAT::PropertyMap::query().

◆ ~JacobiPrecond()

template<typename Matrix_ , typename Filter_ >
virtual FEAT::Solver::JacobiPrecond< Matrix_, Filter_ >::~JacobiPrecond ( )
inlinevirtual

Empty virtual destructor.

Definition at line 111 of file jacobi_precond.hpp.

Member Function Documentation

◆ apply() [1/2]

virtual Status FEAT::Solver::SolverBase< Matrix_::VectorTypeL >::apply ( Matrix_::VectorTypeL &  vec_cor,
const Matrix_::VectorTypeL &  vec_def 
)
pure virtualinherited

Solver application method.

This method applies the solver represented by this object onto a given defect vector and returns the corresponding correction vector.

Note
Solvers which derive from the IterativeSolver base class also provide a correct() method which corrects an initial solution instead of starting with the null vector.
Parameters
[out]vec_corThe vector that shall receive the solution of the linear system. It is assumed to be allocated, but its numerical contents may be undefined upon calling this method.
[in]vec_defThe vector that represents the right-hand-side of the linear system to be solved.
Attention
vec_cor and vec_def must not refer to the same vector object!
Returns
A Status code that represents the status of the solution step.

Implemented in FEAT::Solver::AmaVanka< Matrix_, Filter_ >.

◆ apply() [2/2]

template<typename Matrix_ , typename Filter_ >
virtual Status FEAT::Solver::JacobiPrecond< Matrix_, Filter_ >::apply ( VectorType vec_cor,
const VectorType vec_def 
)
inlineoverridevirtual

Solver application method.

This method applies the solver represented by this object onto a given defect vector and returns the corresponding correction vector.

Note
Solvers which derive from the IterativeSolver base class also provide a correct() method which corrects an initial solution instead of starting with the null vector.
Parameters
[out]vec_corThe vector that shall receive the solution of the linear system. It is assumed to be allocated, but its numerical contents may be undefined upon calling this method.
[in]vec_defThe vector that represents the right-hand-side of the linear system to be solved.
Attention
vec_cor and vec_def must not refer to the same vector object!
Returns
A Status code that represents the status of the solution step.

Definition at line 157 of file jacobi_precond.hpp.

References FEAT::Solver::JacobiPrecond< Matrix_, Filter_ >::_inv_diag, and FEAT::Solver::success.

◆ done()

virtual void FEAT::Solver::SolverBase< Matrix_::VectorTypeL >::done ( )
inlinevirtualinherited

Finalization method.

This function performs both the symbolic and numeric finalization, i.e. it simply performs

this->done_numeric();
this->done_symbolic();

Definition at line 283 of file base.hpp.

◆ done_numeric()

virtual void FEAT::Solver::SolverBase< Matrix_::VectorTypeL >::done_numeric ( )
inlinevirtualinherited

Numeric finalization method.

This method is called to release any data allocated in the numeric initialization step.

Reimplemented in FEAT::Solver::GenericUmfpack< Matrix_ >.

Definition at line 246 of file base.hpp.

◆ done_symbolic()

template<typename Matrix_ , typename Filter_ >
virtual void FEAT::Solver::JacobiPrecond< Matrix_, Filter_ >::done_symbolic ( )
inlineoverridevirtual

Symbolic finalization method.

This method is called to release any data allocated in the symbolic initialization step.

Reimplemented from FEAT::Solver::SolverBase< Matrix_::VectorTypeL >.

Definition at line 128 of file jacobi_precond.hpp.

References FEAT::Solver::JacobiPrecond< Matrix_, Filter_ >::_inv_diag.

◆ init()

virtual void FEAT::Solver::SolverBase< Matrix_::VectorTypeL >::init ( )
inlinevirtualinherited

Initialization method.

This function performs both the symbolic and numeric initialization, i.e. it simply performs

this->init_symbolic();
this->init_numeric();

Definition at line 268 of file base.hpp.

◆ init_numeric()

template<typename Matrix_ , typename Filter_ >
virtual void FEAT::Solver::JacobiPrecond< Matrix_, Filter_ >::init_numeric ( )
inlineoverridevirtual

Numeric initialization method.

This method is called to perform numeric initialization of the solver.
Before this function can be called, the symbolic initialization must be performed.

Reimplemented from FEAT::Solver::SolverBase< Matrix_::VectorTypeL >.

Definition at line 134 of file jacobi_precond.hpp.

References FEAT::Solver::JacobiPrecond< Matrix_, Filter_ >::_inv_diag, FEAT::Solver::JacobiPrecond< Matrix_, Filter_ >::_matrix, and FEAT::Solver::JacobiPrecond< Matrix_, Filter_ >::_omega.

◆ init_symbolic()

template<typename Matrix_ , typename Filter_ >
virtual void FEAT::Solver::JacobiPrecond< Matrix_, Filter_ >::init_symbolic ( )
inlineoverridevirtual

Symbolic initialization method.

This method is called to perform symbolic initialization of the solver.

Reimplemented from FEAT::Solver::SolverBase< Matrix_::VectorTypeL >.

Definition at line 122 of file jacobi_precond.hpp.

References FEAT::Solver::JacobiPrecond< Matrix_, Filter_ >::_inv_diag, and FEAT::Solver::JacobiPrecond< Matrix_, Filter_ >::_matrix.

◆ name()

template<typename Matrix_ , typename Filter_ >
virtual String FEAT::Solver::JacobiPrecond< Matrix_, Filter_ >::name ( ) const
inlineoverridevirtual

Returns a descriptive string.

Returns
A string describing the solver.

Implements FEAT::Solver::SolverBase< Matrix_::VectorTypeL >.

Definition at line 116 of file jacobi_precond.hpp.

◆ set_omega()

template<typename Matrix_ , typename Filter_ >
void FEAT::Solver::JacobiPrecond< Matrix_, Filter_ >::set_omega ( DataType  omega)
inline

Sets the damping parameter.

Parameters
[in]omegaThe new damping parameter.

Definition at line 150 of file jacobi_precond.hpp.

References FEAT::Solver::JacobiPrecond< Matrix_, Filter_ >::_omega, and XASSERT.

Member Data Documentation

◆ _filter

template<typename Matrix_ , typename Filter_ >
const FilterType& FEAT::Solver::JacobiPrecond< Matrix_, Filter_ >::_filter
protected

The filter for projecting solution and defect to subspaces.

Definition at line 52 of file jacobi_precond.hpp.

◆ _inv_diag

◆ _matrix

template<typename Matrix_ , typename Filter_ >
const MatrixType& FEAT::Solver::JacobiPrecond< Matrix_, Filter_ >::_matrix
protected

◆ _omega

template<typename Matrix_ , typename Filter_ >
DataType FEAT::Solver::JacobiPrecond< Matrix_, Filter_ >::_omega
protected

The documentation for this class was generated from the following file: