ug4
ug::ILinearOperatorInverse< X, Y > Class Template Referenceabstract

describes an inverse linear mapping X->Y More...

#include <linear_operator_inverse.h>

+ Inheritance diagram for ug::ILinearOperatorInverse< X, Y >:

Public Types

typedef Y codomain_function_type
 Range space. More...
 
typedef X domain_function_type
 Domain space. More...
 
- Public Types inherited from ug::ILinearIterator< X, X >
typedef X codomain_function_type
 Range space. More...
 
typedef X domain_function_type
 Domain space. More...
 

Public Member Functions

virtual bool apply (Y &u, const X &f)=0
 applies inverse operator, i.e. returns u = A^{-1} f More...
 
virtual bool apply_return_defect (Y &u, X &f)=0
 applies inverse operator, i.e. returns u = A^{-1} f and returns defect d := f - A*u More...
 
virtual bool apply_update_defect (Y &u, X &f)
 
virtual SmartPtr< ILinearIterator< X, Y > > clone ()
 clone More...
 
virtual std::string config_string () const
 returns information about configuration parameters More...
 
SmartPtr< IConvergenceCheck< X > > convergence_check ()
 returns the convergence check More...
 
ConstSmartPtr< IConvergenceCheck< X > > convergence_check () const
 returns the convergence check More...
 
number defect () const
 returns the current defect More...
 
 ILinearOperatorInverse ()
 constructor setting convergence check to (100, 1e-12, 1e-12, true) More...
 
 ILinearOperatorInverse (SmartPtr< IConvergenceCheck< X > > spConvCheck)
 Default constructor. More...
 
virtual bool init (SmartPtr< ILinearOperator< Y, X > > J, const Y &u)
 initializes for the inverse for a linearized operator at linearization point u More...
 
virtual bool init (SmartPtr< ILinearOperator< Y, X > > L)
 initializes for the inverse for a linear operator More...
 
SmartPtr< ILinearOperator< Y, X > > linear_operator ()
 returns the current Operator this Inverse Operator is initialized for More...
 
virtual const char * name () const =0
 returns the name of the operator inverse More...
 
number reduction () const
 returns the current relative reduction More...
 
void set_convergence_check (SmartPtr< IConvergenceCheck< X > > spConvCheck)
 set the convergence check More...
 
virtual int standard_offset () const
 returns the standard offset for output More...
 
int step () const
 returns the current number of steps More...
 
virtual bool supports_parallel () const =0
 returns if parallel solving is supported More...
 
virtual ~ILinearOperatorInverse ()
 virtual destructor More...
 
- Public Member Functions inherited from ug::ILinearIterator< X, X >
virtual bool apply (X &c, const X &d)=0
 compute new correction c = B*d More...
 
virtual bool apply_update_defect (X &c, X &d)=0
 compute new correction c = B*d and update defect d := d - A*c More...
 
SmartPtr< IDamping< X, X > > damping ()
 returns the scaling More...
 
 ILinearIterator ()
 constructor More...
 
 ILinearIterator (const ILinearIterator< X, X > &parent)
 copy constructor More...
 
virtual bool init (SmartPtr< ILinearOperator< X, X > > J, const X &u)=0
 initialize for operator J(u) and linearization point u More...
 
virtual bool init (SmartPtr< ILinearOperator< X, X > > L)=0
 initialize for linear operator L More...
 
void set_damp (number factor)
 sets the damping to a constant factor More...
 
void set_damp (SmartPtr< IDamping< X, X > > spScaling)
 sets a scaling for the correction More...
 
virtual ~ILinearIterator ()
 virtual destructor More...
 

Protected Attributes

SmartPtr< IConvergenceCheck< X > > m_spConvCheck
 smart pointer holding the convergence check More...
 
SmartPtr< ILinearOperator< Y, X > > m_spLinearOperator
 Operator that is inverted by this Inverse Operator. More...
 
- Protected Attributes inherited from ug::ILinearIterator< X, X >
SmartPtr< IDamping< X, X > > m_spDamping
 the scaling More...
 

Detailed Description

template<typename X, typename Y = X>
class ug::ILinearOperatorInverse< X, Y >

describes an inverse linear mapping X->Y

This class is the base class for the inversion of linear operator given in form of the ILinearOperator interface class. Given a operator L, the basic usage of this class is to invert this operator, i.e. to compute the solution u of

L*u = f     i.e. u := L^{-1} f

This application has been split up into three steps:

  1. init(): This method initializes the inverse operator. The inverse operator is initialized the way that, its application will be the inverse application of the operator L passed in by this function. The prepare method can only be called, when this method has been called once.
  2. apply(): This method performs the inversion. Before this method is called the init and prepare methods have to be called.

This splitting has been made, since initialization and preparation may be computationally expansive. Thus, the user of this class has the choice when to call this initialization/preparation. E.g. when the operator is applied several times on the same vectors, those have only to be prepared once and the init of the operator is only needed once.

Template Parameters
Xdomain space
Yrange space

Member Typedef Documentation

◆ codomain_function_type

template<typename X , typename Y = X>
typedef Y ug::ILinearOperatorInverse< X, Y >::codomain_function_type

Range space.

◆ domain_function_type

template<typename X , typename Y = X>
typedef X ug::ILinearOperatorInverse< X, Y >::domain_function_type

Domain space.

Constructor & Destructor Documentation

◆ ILinearOperatorInverse() [1/2]

template<typename X , typename Y = X>
ug::ILinearOperatorInverse< X, Y >::ILinearOperatorInverse ( )
inline

constructor setting convergence check to (100, 1e-12, 1e-12, true)

References new().

◆ ILinearOperatorInverse() [2/2]

template<typename X , typename Y = X>
ug::ILinearOperatorInverse< X, Y >::ILinearOperatorInverse ( SmartPtr< IConvergenceCheck< X > >  spConvCheck)
inline

Default constructor.

◆ ~ILinearOperatorInverse()

template<typename X , typename Y = X>
virtual ug::ILinearOperatorInverse< X, Y >::~ILinearOperatorInverse ( )
inlinevirtual

virtual destructor

Member Function Documentation

◆ apply()

template<typename X , typename Y = X>
virtual bool ug::ILinearOperatorInverse< X, Y >::apply ( Y &  u,
const X &  f 
)
pure virtual

applies inverse operator, i.e. returns u = A^{-1} f

This method applies the inverse operator, i.e. u = A^{-1} f. The domain function f remains unchanged. Note, that this method can always be implemented by creating a copy of f and calling apply_return_defect with this copy.

Parameters
[in]fright-hand side
[out]usolution
Returns
bool success flag

Implemented in ug::FETISolver< TAlgebra >, ug::AgglomeratingBase< IMatrixOperatorInverse< TAlgebra::matrix_type, TAlgebra::vector_type >, TAlgebra >, ug::LU< TAlgebra >, ug::PrimalSubassembledMatrixInverse< TAlgebra >, ug::PrimalSubassembledMatrixInverse< algebra_type >, ug::IExternalSolver< TAlgebra >, and ug::IMatrixOperatorInverse< TAlgebra::matrix_type, TAlgebra::vector_type >.

◆ apply_return_defect()

template<typename X , typename Y = X>
virtual bool ug::ILinearOperatorInverse< X, Y >::apply_return_defect ( Y &  u,
X &  f 
)
pure virtual

applies inverse operator, i.e. returns u = A^{-1} f and returns defect d := f - A*u

This method applies the inverse operator, i.e. u = A^{-1} f. The domain function f is changed in the way, that the defect d := f - A*u is returned in the function. This is always useful, when the inverting algorithm can (or must) update the defect during computation (this is e.g. the case for the geometric multigrid method). Note, that this method can always be implemented by calling apply and then computing d := f - A*u.

Parameters
[in,out]fright-hand side
[out]usolution
Returns
bool success flag

Implemented in ug::LU< TAlgebra >, ug::PrimalSubassembledMatrixInverse< TAlgebra >, ug::PrimalSubassembledMatrixInverse< algebra_type >, ug::IExternalSolver< TAlgebra >, ug::AgglomeratingBase< IMatrixOperatorInverse< TAlgebra::matrix_type, TAlgebra::vector_type >, TAlgebra >, ug::FETISolver< TAlgebra >, and ug::IMatrixOperatorInverse< TAlgebra::matrix_type, TAlgebra::vector_type >.

Referenced by ug::IPreconditionedLinearOperatorInverse< X >::apply(), and ug::ILinearOperatorInverse< X, Y >::apply_update_defect().

◆ apply_update_defect()

template<typename X , typename Y = X>
virtual bool ug::ILinearOperatorInverse< X, Y >::apply_update_defect ( Y &  u,
X &  f 
)
inlinevirtual

◆ clone()

template<typename X , typename Y = X>
virtual SmartPtr<ILinearIterator<X,Y> > ug::ILinearOperatorInverse< X, Y >::clone ( )
inlinevirtual

clone

Implements ug::ILinearIterator< X, X >.

Reimplemented in ug::IExternalSolver< TAlgebra >.

References SPNULL, and UG_THROW.

◆ config_string()

template<typename X , typename Y = X>
virtual std::string ug::ILinearOperatorInverse< X, Y >::config_string ( ) const
inlinevirtual

returns information about configuration parameters

this should return necessary information about parameters and possibly calling config_string of subcomponents.

Returns
std::string necessary information about configuration parameters

Reimplemented from ug::ILinearIterator< X, X >.

Reimplemented in ug::LU< TAlgebra >, ug::GMRES< TVector >, ug::BiCGStab< TVector >, ug::AnalyzingSolver< M, X, Y >, ug::AgglomeratingSolver< TAlgebra >, ug::IPreconditionedLinearOperatorInverse< X >, and ug::IPreconditionedLinearOperatorInverse< TVector >.

References ug::ILinearOperatorInverse< X, Y >::name().

◆ convergence_check() [1/2]

template<typename X , typename Y = X>
SmartPtr<IConvergenceCheck<X> > ug::ILinearOperatorInverse< X, Y >::convergence_check ( )
inline

returns the convergence check

References ug::ILinearOperatorInverse< X, Y >::m_spConvCheck.

◆ convergence_check() [2/2]

◆ defect()

template<typename X , typename Y = X>
number ug::ILinearOperatorInverse< X, Y >::defect ( ) const
inline

◆ init() [1/2]

template<typename X , typename Y = X>
virtual bool ug::ILinearOperatorInverse< X, Y >::init ( SmartPtr< ILinearOperator< Y, X > >  J,
const Y &  u 
)
inlinevirtual

initializes for the inverse for a linearized operator at linearization point u

This method passes the linear operator J(u) that should be inverted by this operator. As second argument the linearization point is passed. This is needed e.g. for the geometric multigrid method, that inverts a linearized operator based on coarser grid operators, that have to be initialized based on the linearization point.

Parameters
[in]Jlinearized operator to invert
[in]ulinearization point
Returns
bool success flag

Reimplemented in ug::IMatrixOperatorInverse< TAlgebra::matrix_type, TAlgebra::vector_type >.

References ug::ILinearOperatorInverse< X, Y >::m_spLinearOperator.

◆ init() [2/2]

template<typename X , typename Y = X>
virtual bool ug::ILinearOperatorInverse< X, Y >::init ( SmartPtr< ILinearOperator< Y, X > >  L)
inlinevirtual

initializes for the inverse for a linear operator

This method passes the operator L that is inverted by this operator. In addition some preparation step can be made.

Parameters
[in]Llinear operator to invert
Returns
bool success flag

Reimplemented in ug::IMatrixOperatorInverse< TAlgebra::matrix_type, TAlgebra::vector_type >.

References ug::ILinearOperatorInverse< X, Y >::m_spLinearOperator.

Referenced by ug::AutoLinearSolver< TVector >::init_op().

◆ linear_operator()

◆ name()

◆ reduction()

template<typename X , typename Y = X>
number ug::ILinearOperatorInverse< X, Y >::reduction ( ) const
inline

◆ set_convergence_check()

template<typename X , typename Y = X>
void ug::ILinearOperatorInverse< X, Y >::set_convergence_check ( SmartPtr< IConvergenceCheck< X > >  spConvCheck)
inline

◆ standard_offset()

template<typename X , typename Y = X>
virtual int ug::ILinearOperatorInverse< X, Y >::standard_offset ( ) const
inlinevirtual

returns the standard offset for output

Referenced by ug::ILinearOperatorInverse< X, Y >::set_convergence_check().

◆ step()

template<typename X , typename Y = X>
int ug::ILinearOperatorInverse< X, Y >::step ( ) const
inline

◆ supports_parallel()

Member Data Documentation

◆ m_spConvCheck

◆ m_spLinearOperator

template<typename X , typename Y = X>
SmartPtr<ILinearOperator<Y,X> > ug::ILinearOperatorInverse< X, Y >::m_spLinearOperator
protected

Operator that is inverted by this Inverse Operator.

Referenced by ug::ILinearOperatorInverse< X, Y >::init(), and ug::ILinearOperatorInverse< X, Y >::linear_operator().


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