dune-fem 2.8.0
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Attributes | List of all members
Dune::Fem::ConjugateGradientSolver< Operator > Class Template Reference

linear solver using the CG algorithm More...

#include <dune/fem/solver/cginverseoperator.hh>

Inheritance diagram for Dune::Fem::ConjugateGradientSolver< Operator >:
Inheritance graph

Public Types

typedef Operator OperatorType
 type of the operators to invert
 
typedef OperatorType::DomainFieldType DomainFieldType
 field type of the operator's domain vectors
 
typedef OperatorType::RangeFieldType RangeFieldType
 field type of the operator's range vectors
 
typedef Dune::FieldTraits< RangeFieldType >::real_type RealType
 
typedef OperatorType::DomainFunctionType DomainFunctionType
 type of the operator's domain vectors
 
typedef OperatorType::RangeFunctionType RangeFunctionType
 type of the operator's range vectors
 
typedef Fem::Operator< RangeFunctionType, DomainFunctionTypePreconditionerType
 type of the preconditioner, maps from the range of the operator (the dual space) in it's domain
 

Public Member Functions

 ConjugateGradientSolver (const RealType &epsilon, unsigned int maxIterations, int errorMeasure, bool verbose)
 constructor
 
 ConjugateGradientSolver (const RealType &epsilon, unsigned int maxIterations, bool verbose, const ParameterReader &parameter=Parameter::container())
 
 ConjugateGradientSolver (RealType epsilon, unsigned int maxIterations, const ParameterReader &parameter=Parameter::container())
 constructor
 
void solve (const OperatorType &op, const RangeFunctionType &b, DomainFunctionType &x) const
 solve $op( x ) = b$
 
void solve (const OperatorType &op, const PreconditionerType &p, const RangeFunctionType &b, DomainFunctionType &x) const
 solve $op( x ) = b$
 
unsigned int iterations () const
 number of iterations needed for last solve
 
void setMaxIterations (unsigned int maxIterations)
 
double averageCommTime () const
 return average communication time during last solve
 

Protected Attributes

const RealType epsilon_
 
unsigned int maxIterations_
 
int errorMeasure_
 
const bool verbose_
 
double averageCommTime_
 
unsigned int realCount_
 

Detailed Description

template<class Operator>
class Dune::Fem::ConjugateGradientSolver< Operator >

linear solver using the CG algorithm

Parameters
Operatortype of the operator to invert

Member Typedef Documentation

◆ DomainFieldType

field type of the operator's domain vectors

◆ DomainFunctionType

type of the operator's domain vectors

◆ OperatorType

template<class Operator >
typedef Operator Dune::Fem::ConjugateGradientSolver< Operator >::OperatorType

type of the operators to invert

◆ PreconditionerType

type of the preconditioner, maps from the range of the operator (the dual space) in it's domain

◆ RangeFieldType

field type of the operator's range vectors

◆ RangeFunctionType

type of the operator's range vectors

◆ RealType

template<class Operator >
typedef Dune::FieldTraits<RangeFieldType>::real_type Dune::Fem::ConjugateGradientSolver< Operator >::RealType

Constructor & Destructor Documentation

◆ ConjugateGradientSolver() [1/3]

template<class Operator >
Dune::Fem::ConjugateGradientSolver< Operator >::ConjugateGradientSolver ( const RealType epsilon,
unsigned int  maxIterations,
int  errorMeasure,
bool  verbose 
)
inline

constructor

Parameters
[in]epsilontolerance
[in]maxIterationsmaximum number of CG iterations
[in]errorMeasureuse absolute (0) or relative (1) error
[in]verboseverbose output

◆ ConjugateGradientSolver() [2/3]

template<class Operator >
Dune::Fem::ConjugateGradientSolver< Operator >::ConjugateGradientSolver ( const RealType epsilon,
unsigned int  maxIterations,
bool  verbose,
const ParameterReader parameter = Parameter::container() 
)
inline

◆ ConjugateGradientSolver() [3/3]

template<class Operator >
Dune::Fem::ConjugateGradientSolver< Operator >::ConjugateGradientSolver ( RealType  epsilon,
unsigned int  maxIterations,
const ParameterReader parameter = Parameter::container() 
)
inline

constructor

Parameters
[in]epsilontolerance
[in]maxIterationsmaximum number of CG iterations

Member Function Documentation

◆ averageCommTime()

template<class Operator >
double Dune::Fem::ConjugateGradientSolver< Operator >::averageCommTime ( ) const
inline

return average communication time during last solve

◆ iterations()

template<class Operator >
unsigned int Dune::Fem::ConjugateGradientSolver< Operator >::iterations ( ) const
inline

number of iterations needed for last solve

◆ setMaxIterations()

template<class Operator >
void Dune::Fem::ConjugateGradientSolver< Operator >::setMaxIterations ( unsigned int  maxIterations)
inline

◆ solve() [1/2]

template<class Operator >
void Dune::Fem::ConjugateGradientSolver< Operator >::solve ( const OperatorType op,
const PreconditionerType p,
const RangeFunctionType b,
DomainFunctionType x 
) const
inline

solve $op( x ) = b$

Note
The CG algorithm also works for positive semidefinite operators. In this case, $x \cdot v = b \cdot v$ for all $v$ in the operator's kernel.
Parameters
[in]oplinear operator to invert (must be symmetic and positive definite)
[in]p(lef) preconditioning operator
[in]bright hand side
xsolution (must be initialized to a start value)

◆ solve() [2/2]

template<class Operator >
void Dune::Fem::ConjugateGradientSolver< Operator >::solve ( const OperatorType op,
const RangeFunctionType b,
DomainFunctionType x 
) const
inline

solve $op( x ) = b$

Note
The CG algorithm also works for positive semidefinite operators. In this case, $x \cdot v = b \cdot v$ for all $v$ in the operator's kernel.
Parameters
[in]oplinear operator to invert (must be symmetic and positive definite)
[in]bright hand side
xsolution (must be initialized to a start value)

Member Data Documentation

◆ averageCommTime_

template<class Operator >
double Dune::Fem::ConjugateGradientSolver< Operator >::averageCommTime_
mutableprotected

◆ epsilon_

template<class Operator >
const RealType Dune::Fem::ConjugateGradientSolver< Operator >::epsilon_
protected

◆ errorMeasure_

template<class Operator >
int Dune::Fem::ConjugateGradientSolver< Operator >::errorMeasure_
protected

◆ maxIterations_

template<class Operator >
unsigned int Dune::Fem::ConjugateGradientSolver< Operator >::maxIterations_
protected

◆ realCount_

template<class Operator >
unsigned int Dune::Fem::ConjugateGradientSolver< Operator >::realCount_
mutableprotected

◆ verbose_

template<class Operator >
const bool Dune::Fem::ConjugateGradientSolver< Operator >::verbose_
protected

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