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

describes a linear iterator More...

#include <linear_iterator.h>

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

Public Types

typedef Y codomain_function_type
 Range space. More...
 
typedef X domain_function_type
 Domain space. More...
 

Public Member Functions

virtual bool apply (Y &c, const X &d)=0
 compute new correction c = B*d More...
 
virtual bool apply_update_defect (Y &c, X &d)=0
 compute new correction c = B*d and update defect d := d - A*c More...
 
virtual SmartPtr< ILinearIterator< X, Y > > clone ()=0
 clone More...
 
virtual std::string config_string () const
 
SmartPtr< IDamping< X, Y > > damping ()
 returns the scaling More...
 
 ILinearIterator ()
 constructor More...
 
 ILinearIterator (const ILinearIterator< X, Y > &parent)
 copy constructor More...
 
virtual bool init (SmartPtr< ILinearOperator< Y, X > > J, const Y &u)=0
 initialize for operator J(u) and linearization point u More...
 
virtual bool init (SmartPtr< ILinearOperator< Y, X > > L)=0
 initialize for linear operator L More...
 
virtual const char * name () const =0
 returns the name of iterator More...
 
void set_damp (number factor)
 sets the damping to a constant factor More...
 
void set_damp (SmartPtr< IDamping< X, Y > > spScaling)
 sets a scaling for the correction More...
 
virtual bool supports_parallel () const =0
 returns if parallel solving is supported More...
 
virtual ~ILinearIterator ()
 virtual destructor More...
 

Protected Attributes

SmartPtr< IDamping< X, Y > > m_spDamping
 the scaling More...
 

Detailed Description

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

describes a linear iterator

This class is the base class for all linear iterators. Iterators (also called preconditioners) are used in iterative schemes when solving a linear system. Usually, a linear problem like L*u = f is intended to be solved. This is done in an iterative way by performing an iteration of

start: compute d := f - L*u iterate: - c := B*d (compute correction)

  • u := u + c (update solution)
  • d := d - L*c (update defect)

This iterator class describes the application of B in the scheme above. The application has been split up into two parts.

  1. init(L, u) or init(L): These methods initialize the iterator and one of these methods has to be called before any of the apply methods can be used. Passing the linear operator indicates that this operator is used as underlying for the iterator.
  2. apply or apply_return_defect: These methods are used to compute the correction (and to update the defect at the same time). Note, that these methods can only be called when the iterator has been initialized.

This splitting has been made, since initialization may be computationally expensive. Thus, the user of this class has the choice when to call this initialization. E.g. when the operator is applied several times the init of the iterator is only needed once.

Template Parameters
XDomain space function
YRange space function

Member Typedef Documentation

◆ codomain_function_type

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

Range space.

◆ domain_function_type

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

Domain space.

Constructor & Destructor Documentation

◆ ~ILinearIterator()

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

virtual destructor

◆ ILinearIterator() [1/2]

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

constructor

References ug::ILinearIterator< X, Y >::set_damp().

◆ ILinearIterator() [2/2]

template<typename X , typename Y = X>
ug::ILinearIterator< X, Y >::ILinearIterator ( const ILinearIterator< X, Y > &  parent)
inline

Member Function Documentation

◆ apply()

template<typename X , typename Y = X>
virtual bool ug::ILinearIterator< X, Y >::apply ( Y &  c,
const X &  d 
)
pure virtual

◆ apply_update_defect()

template<typename X , typename Y = X>
virtual bool ug::ILinearIterator< X, Y >::apply_update_defect ( Y &  c,
X &  d 
)
pure virtual

compute new correction c = B*d and update defect d := d - A*c

This method applies the inverse operator, i.e. c = B*d. The domain function d is changed in the way, that the defect d := d - A*c is returned in the function. This is always useful, when the iterating 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 := d - A*c.

Parameters
[in,out]ddefect
[out]ucorrection
Returns
bool success flag

Implemented in ug::CombinedLinearIterator< X, Y >, ug::LinearIteratorSum< X, Y >, ug::LinearIteratorProduct< X, Y >, ug::ILinearOperatorInverse< X, X >, ug::AgglomeratingBase< ILinearIterator< TAlgebra::vector_type >, TAlgebra >, ug::AgglomeratingBase< IPreconditioner< TAlgebra >, TAlgebra >, ug::ITransformingIteration< TAlgebra, TDerived >, ug::ITransformingIteration< TAlgebra, AssembledTransformingSmoother< TDomain, TAlgebra > >, ug::IProjGaussSeidel< TDomain, TAlgebra >, ug::OperatorInverseIterator< TAlgebra >, ug::DebugIterator< TAlgebra >, and ug::IPreconditioner< TAlgebra >.

◆ clone()

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

clone

Implemented in ug::CombinedLinearIterator< X, Y >, ug::LineVanka< TDomain, TAlgebra >, ug::LineGaussSeidel< TDomain, TAlgebra >, ug::UzawaBase< TDomain, TAlgebra >, ug::SequentialSubspaceCorrection< TDomain, TAlgebra >, ug::AssembledMultiGridCycle< TDomain, TAlgebra >, ug::ElementGaussSeidel< TDomain, TAlgebra >, ug::ComponentGaussSeidel< TDomain, TAlgebra >, ug::DiagVanka< TAlgebra >, ug::Vanka< TAlgebra >, ug::AssembledTransformingSmoother< TDomain, TAlgebra >, ug::SchurPrecond< TAlgebra >, ug::ProjSymmetricGaussSeidel< TDomain, TAlgebra >, ug::ProjBackwardGaussSeidel< TDomain, TAlgebra >, ug::ProjGaussSeidel< TDomain, TAlgebra >, ug::PILUTPreconditioner< TAlgebra >, ug::OperatorInverseIterator< TAlgebra >, ug::Jacobi< TAlgebra >, ug::LinearIteratorSum< X, Y >, ug::LinearIteratorProduct< X, Y >, ug::ILUTScalarPreconditioner< TAlgebra >, ug::ILUTPreconditioner< TAlgebra >, ug::ILU< TAlgebra >, ug::SymmetricGaussSeidel< TAlgebra >, ug::BackwardGaussSeidel< TAlgebra >, ug::GaussSeidel< TAlgebra >, ug::SparseBlockGaussSeidel2< TAlgebra, backward, forward >, ug::SparseBlockGaussSeidel< TAlgebra, backward, forward >, ug::BlockGaussSeidelIterative< TAlgebra, backward, forward >, ug::BlockGaussSeidel< TAlgebra, backward, forward >, ug::IExternalSolver< TAlgebra >, ug::DebugIterator< TAlgebra >, ug::AgglomeratingPreconditioner< TAlgebra >, ug::AgglomeratingIterator< TAlgebra >, ug::ILinearOperatorInverse< X, Y >, ug::ILinearOperatorInverse< TAlgebra::vector_type, TAlgebra::vector_type >, ug::ILinearOperatorInverse< X, X >, ug::CRILUTPreconditioner< class >, ug::PCRILUTPreconditioner< class >, and ug::Electromagnetism::TimeHarmonicNedelecHybridSmoother< class, class >.

◆ config_string()

◆ damping()

template<typename X , typename Y = X>
SmartPtr<IDamping<X,Y> > ug::ILinearIterator< X, Y >::damping ( )
inline

returns the scaling

References ug::ILinearIterator< X, Y >::m_spDamping.

◆ init() [1/2]

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

initialize for operator J(u) and linearization point u

This method passes the linear operator J(u) that should be used as underlying by this iterator. As second argument the linearization point is passed. This is needed e.g. for the geometric multigrid method.

Parameters
[in]Jlinearized operator to use as underlying
[in]ulinearization point
Returns
bool success flag

Implemented in ug::CombinedLinearIterator< X, Y >, ug::LinearIteratorSum< X, Y >, ug::LinearIteratorProduct< X, Y >, ug::IPreconditionedLinearOperatorInverse< X >, and ug::ILinearOperatorInverse< X, X >.

◆ init() [2/2]

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

initialize for linear operator L

This method passes the operator L that used as underlying by this operator. In addition some preparation step can be made.

Parameters
[in]Llinear operator to use as underlying
Returns
bool success flag

Implemented in ug::CombinedLinearIterator< X, Y >, ug::LinearIteratorSum< X, Y >, ug::LinearIteratorProduct< X, Y >, ug::IPreconditionedLinearOperatorInverse< X >, and ug::ILinearOperatorInverse< X, X >.

◆ name()

template<typename X , typename Y = X>
virtual const char* ug::ILinearIterator< X, Y >::name ( ) const
pure virtual

returns the name of iterator

This method returns the name of the iterator operator. This function is typically needed, when the iterator operator is used inside of another operator and some debug output should be printed

Returns
const char* name of inverse operator

Implemented in ug::ILinearOperatorInverse< TAlgebra::vector_type, TAlgebra::vector_type >, ug::ILinearOperatorInverse< X, X >, ug::IProjGaussSeidel< TDomain, TAlgebra >, ug::CombinedLinearIterator< X, Y >, ug::GaussSeidelBase< TAlgebra >, ug::IPreconditioner< TAlgebra >, ug::ILinearOperatorInverse< X, Y >, ug::LineVanka< TDomain, TAlgebra >, ug::LineGaussSeidel< TDomain, TAlgebra >, ug::UzawaBase< TDomain, TAlgebra >, ug::SequentialSubspaceCorrection< TDomain, TAlgebra >, ug::AssembledMultiGridCycle< TDomain, TAlgebra >, ug::ElementGaussSeidel< TDomain, TAlgebra >, ug::ComponentGaussSeidel< TDomain, TAlgebra >, ug::DiagVanka< TAlgebra >, ug::Vanka< TAlgebra >, ug::AssembledTransformingSmoother< TDomain, TAlgebra >, ug::SchurPrecond< TAlgebra >, ug::ProjSymmetricGaussSeidel< TDomain, TAlgebra >, ug::ProjBackwardGaussSeidel< TDomain, TAlgebra >, ug::ProjGaussSeidel< TDomain, TAlgebra >, ug::PILUTPreconditioner< TAlgebra >, ug::OperatorInverseIterator< TAlgebra >, ug::Jacobi< TAlgebra >, ug::LinearIteratorSum< X, Y >, ug::LinearIteratorProduct< X, Y >, ug::ILUTScalarPreconditioner< TAlgebra >, ug::ILUTPreconditioner< TAlgebra >, ug::ILU< TAlgebra >, ug::SymmetricGaussSeidel< TAlgebra >, ug::BackwardGaussSeidel< TAlgebra >, ug::GaussSeidel< TAlgebra >, ug::SparseBlockGaussSeidel2< TAlgebra, backward, forward >, ug::SparseBlockGaussSeidel< TAlgebra, backward, forward >, ug::BlockGaussSeidelIterative< TAlgebra, backward, forward >, ug::BlockGaussSeidel< TAlgebra, backward, forward >, ug::LU< TAlgebra >, ug::LinearSolver< TVector >, ug::LinearSolver< ug::ParallelVector >, ug::GMRES< TVector >, ug::FETISolver< TAlgebra >, ug::PrimalSubassembledMatrixInverse< TAlgebra >, ug::PrimalSubassembledMatrixInverse< algebra_type >, ug::IExternalSolver< TAlgebra >, ug::DebugIterator< TAlgebra >, ug::CG< TVector >, ug::BiCGStab< TVector >, ug::AutoLinearSolver< TVector >, ug::AnalyzingSolver< M, X, Y >, ug::AgglomeratingPreconditioner< TAlgebra >, ug::AgglomeratingIterator< TAlgebra >, ug::AgglomeratingSolver< TAlgebra >, ug::CRILUTPreconditioner< class >, ug::PCRILUTPreconditioner< class >, and ug::Electromagnetism::TimeHarmonicNedelecHybridSmoother< class, class >.

Referenced by ug::ILinearIterator< X, Y >::config_string().

◆ set_damp() [1/2]

template<typename X , typename Y = X>
void ug::ILinearIterator< X, Y >::set_damp ( number  factor)
inline

sets the damping to a constant factor

References ug::ILinearIterator< X, Y >::m_spDamping, and make_sp().

◆ set_damp() [2/2]

template<typename X , typename Y = X>
void ug::ILinearIterator< X, Y >::set_damp ( SmartPtr< IDamping< X, Y > >  spScaling)
inline

sets a scaling for the correction

Sets a scaling for the correction, i.e., once the correction has been computed, c = B*d, the correction is scaled by a factor, c := s*c, where s is provided by the passed scaling class. Note, that the scaling factor may depend on the defect and correction. The internal update of the defect as done in apply_update_defect must be performed with respect to the scaled correction.

References ug::ILinearIterator< X, Y >::m_spDamping.

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

◆ supports_parallel()

template<typename X , typename Y = X>
virtual bool ug::ILinearIterator< X, Y >::supports_parallel ( ) const
pure virtual

returns if parallel solving is supported

Implemented in ug::ILinearOperatorInverse< TAlgebra::vector_type, TAlgebra::vector_type >, ug::ILinearOperatorInverse< X, X >, ug::ILinearOperatorInverse< X, Y >, ug::LineVanka< TDomain, TAlgebra >, ug::LineGaussSeidel< TDomain, TAlgebra >, ug::UzawaBase< TDomain, TAlgebra >, ug::SequentialSubspaceCorrection< TDomain, TAlgebra >, ug::AssembledMultiGridCycle< TDomain, TAlgebra >, ug::ElementGaussSeidel< TDomain, TAlgebra >, ug::ComponentGaussSeidel< TDomain, TAlgebra >, ug::DiagVanka< TAlgebra >, ug::Vanka< TAlgebra >, ug::AssembledTransformingSmoother< TDomain, TAlgebra >, ug::SchurPrecond< TAlgebra >, ug::OperatorInverseIterator< TAlgebra >, ug::Jacobi< TAlgebra >, ug::CombinedLinearIterator< X, Y >, ug::ILUTScalarPreconditioner< TAlgebra >, ug::ILUTPreconditioner< TAlgebra >, ug::ILU< TAlgebra >, ug::GaussSeidelBase< TAlgebra >, ug::SparseBlockGaussSeidel2< TAlgebra, backward, forward >, ug::SparseBlockGaussSeidel< TAlgebra, backward, forward >, ug::BlockGaussSeidelIterative< TAlgebra, backward, forward >, ug::BlockGaussSeidel< TAlgebra, backward, forward >, ug::IBlockJacobiPreconditioner< TAlgebra >, ug::LU< TAlgebra >, ug::LinearSolver< TVector >, ug::LinearSolver< ug::ParallelVector >, ug::GMRES< TVector >, ug::FETISolver< TAlgebra >, ug::PrimalSubassembledMatrixInverse< TAlgebra >, ug::PrimalSubassembledMatrixInverse< algebra_type >, ug::IExternalSolver< TAlgebra >, ug::DebugIterator< TAlgebra >, ug::CG< TVector >, ug::BiCGStab< TVector >, ug::AutoLinearSolver< TVector >, ug::AnalyzingSolver< M, X, Y >, ug::AgglomeratingPreconditioner< TAlgebra >, ug::AgglomeratingIterator< TAlgebra >, ug::AgglomeratingSolver< TAlgebra >, ug::CRILUTPreconditioner< class >, ug::PCRILUTPreconditioner< class >, and ug::Electromagnetism::TimeHarmonicNedelecHybridSmoother< class, class >.

Member Data Documentation

◆ m_spDamping


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