ug4
ug::IPreconditionedLinearOperatorInverse< X > Class Template Reference

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

#include <preconditioned_linear_operator_inverse.h>

+ Inheritance diagram for ug::IPreconditionedLinearOperatorInverse< X >:

Public Types

typedef ILinearOperatorInverse< X, X > base_type
 Base class. More...
 
typedef X codomain_function_type
 Range space. More...
 
typedef X domain_function_type
 Domain space. More...
 
- Public Types inherited from ug::ILinearOperatorInverse< X, Y >
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 Types inherited from ug::VectorDebugWritingObject< X >
typedef X vector_type
 type of vector More...
 

Public Member Functions

virtual bool apply (X &x, const X &b)
 compute new correction c = B*d More...
 
virtual std::string config_string () const
 returns information about configuration parameters More...
 
std::string config_string_preconditioner_convergence_check () const
 returns config information of convergence check and preconditioner More...
 
virtual bool init (SmartPtr< ILinearOperator< X, X > > J, const X &u)
 initializes the solver for an operator More...
 
virtual bool init (SmartPtr< ILinearOperator< X, X > > L)
 initializes the solver for an operator More...
 
 IPreconditionedLinearOperatorInverse ()
 Empty constructor. More...
 
 IPreconditionedLinearOperatorInverse (SmartPtr< ILinearIterator< X, X > > spPrecond)
 constructor setting the preconditioner More...
 
 IPreconditionedLinearOperatorInverse (SmartPtr< ILinearIterator< X, X > > spPrecond, SmartPtr< IConvergenceCheck< X > > spConvCheck)
 constructor setting the preconditioner More...
 
void set_compute_fresh_defect_when_finished (bool bRecompute)
 for debug: computes norm again after whole calculation of apply More...
 
void set_preconditioner (SmartPtr< ILinearIterator< X, X > > spPrecond)
 sets the preconditioner More...
 
SmartPtr< ILinearIterator< X, X > > preconditioner ()
 
ConstSmartPtr< ILinearIterator< X, X > > preconditioner () const
 
- Public Member Functions inherited from ug::ILinearOperatorInverse< X, Y >
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...
 
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_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...
 
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...
 
- Public Member Functions inherited from ug::VectorDebugWritingObject< X >
virtual void set_debug (SmartPtr< IVectorDebugWriter< vector_type > > spDebugWriter)
 set debug writer More...
 
SmartPtr< IVectorDebugWriter< vector_type > > vector_debug_writer ()
 returns the debug writer More...
 
ConstSmartPtr< IVectorDebugWriter< vector_type > > vector_debug_writer () const
 
bool vector_debug_writer_valid () const
 returns true if the debug writer is set More...
 
 VectorDebugWritingObject ()
 
 VectorDebugWritingObject (SmartPtr< IVectorDebugWriter< vector_type > > spDebugWriter)
 
void write_debug (const vector_type &vec, const char *filename)
 writing debug output for a vector (if debug writer set) More...
 
virtual ~VectorDebugWritingObject ()
 virtual destructor More...
 

Protected Attributes

bool m_bRecompute
 flag if fresh defect should be computed when finish for debug purpose More...
 
SmartPtr< ILinearIterator< X, X > > m_spPrecond
 Iterator used in the iterative scheme to compute the correction and update the defect. More...
 
- Protected Attributes inherited from ug::ILinearOperatorInverse< X, Y >
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...
 
- Protected Attributes inherited from ug::VectorDebugWritingObject< X >
SmartPtr< IVectorDebugWriter< vector_type > > m_spVectorDebugWriter
 Debug Writer. More...
 

Additional Inherited Members

- Protected Member Functions inherited from ug::VectorDebugWritingObject< X >
void enter_vector_debug_writer_section (const char *secDir)
 enters a debugging section More...
 
void enter_vector_debug_writer_section (std::string secDir)
 enters a debugging section More...
 
void leave_vector_debug_writer_section ()
 leaves a debugging section More...
 
void print_debugger_message (const char *msg)
 prints a debugger message (listing all the sections) More...
 
void print_debugger_message (std::string msg)
 prints a debugger message (listing all the sections) More...
 
virtual void write_debug (const vector_type &vec, std::string name)
 writing debug output for a vector (if debug writer set) More...
 

Detailed Description

template<typename X>
class ug::IPreconditionedLinearOperatorInverse< X >

describes an inverse linear mapping X->X

This a useful derived class from ILinearOperatorInverse, that uses a ILinearIterator in order to precondition the solution process. This is used e.g. in LinearSolver, CG and BiCGStab.

Template Parameters
Xdomain and range space

Member Typedef Documentation

◆ base_type

Base class.

◆ codomain_function_type

Range space.

◆ domain_function_type

template<typename X >
typedef X ug::IPreconditionedLinearOperatorInverse< X >::domain_function_type

Domain space.

Constructor & Destructor Documentation

◆ IPreconditionedLinearOperatorInverse() [1/3]

Empty constructor.

◆ IPreconditionedLinearOperatorInverse() [2/3]

template<typename X >
ug::IPreconditionedLinearOperatorInverse< X >::IPreconditionedLinearOperatorInverse ( SmartPtr< ILinearIterator< X, X > >  spPrecond)
inline

constructor setting the preconditioner

◆ IPreconditionedLinearOperatorInverse() [3/3]

template<typename X >
ug::IPreconditionedLinearOperatorInverse< X >::IPreconditionedLinearOperatorInverse ( SmartPtr< ILinearIterator< X, X > >  spPrecond,
SmartPtr< IConvergenceCheck< X > >  spConvCheck 
)
inline

constructor setting the preconditioner

Member Function Documentation

◆ apply()

template<typename X >
virtual bool ug::IPreconditionedLinearOperatorInverse< X >::apply ( X &  c,
const X &  d 
)
inlinevirtual

compute new correction c = B*d

This method applies the iterator operator, i.e. c = B*d. The domain function d remains unchanged. Note, that this method can always be implemented by creating a copy of d and calling apply_update_defect with this copy.

Parameters
[in]ddefect
[out]ccorrection
Returns
bool success flag

Implements ug::ILinearIterator< X, X >.

Reimplemented in ug::AutoLinearSolver< TVector >.

References ug::ILinearOperatorInverse< X, Y >::apply_return_defect(), ug::ILinearOperatorInverse< X, Y >::linear_operator(), ug::IPreconditionedLinearOperatorInverse< X >::m_bRecompute, ug::ILinearOperatorInverse< X, Y >::name(), UG_LOG, and ug::VectorDebugWritingObject< X >::write_debug().

◆ config_string()

template<typename X >
virtual std::string ug::IPreconditionedLinearOperatorInverse< X >::config_string ( ) const
inlinevirtual

◆ config_string_preconditioner_convergence_check()

template<typename X >
std::string ug::IPreconditionedLinearOperatorInverse< X >::config_string_preconditioner_convergence_check ( ) const
inline

◆ init() [1/2]

◆ init() [2/2]

◆ preconditioner() [1/2]

template<typename X >
SmartPtr<ILinearIterator<X, X> > ug::IPreconditionedLinearOperatorInverse< X >::preconditioner ( )
inline

returns the preconditioner

References ug::IPreconditionedLinearOperatorInverse< X >::m_spPrecond.

◆ preconditioner() [2/2]

template<typename X >
ConstSmartPtr<ILinearIterator<X, X> > ug::IPreconditionedLinearOperatorInverse< X >::preconditioner ( ) const
inline

returns the preconditioner

References ug::IPreconditionedLinearOperatorInverse< X >::m_spPrecond.

◆ set_compute_fresh_defect_when_finished()

template<typename X >
void ug::IPreconditionedLinearOperatorInverse< X >::set_compute_fresh_defect_when_finished ( bool  bRecompute)
inline

for debug: computes norm again after whole calculation of apply

References ug::IPreconditionedLinearOperatorInverse< X >::m_bRecompute.

◆ set_preconditioner()

template<typename X >
void ug::IPreconditionedLinearOperatorInverse< X >::set_preconditioner ( SmartPtr< ILinearIterator< X, X > >  spPrecond)
inline

Member Data Documentation

◆ m_bRecompute

template<typename X >
bool ug::IPreconditionedLinearOperatorInverse< X >::m_bRecompute
protected

◆ m_spPrecond


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