Feel++ 0.91.0

Feel::Backend< T > Class Template Reference

! More...

#include <backend.hpp>

Inheritance diagram for Feel::Backend< T >:
Feel::BackendGmm< T > Feel::BackendPetsc< T >

List of all members.

Public Types

Typedefs
typedef T value_type
typedef type_traits< T >::real_type real_type
typedef Vector< value_type > vector_type
typedef boost::shared_ptr
< vector_type
vector_ptrtype
typedef MatrixSparse< value_type > sparse_matrix_type
typedef boost::shared_ptr
< sparse_matrix_type
sparse_matrix_ptrtype
typedef Backend< value_type > backend_type
typedef boost::shared_ptr
< backend_type
backend_ptrtype
typedef SolverNonLinear
< value_type > 
solvernonlinear_type
typedef boost::shared_ptr
< solvernonlinear_type
solvernonlinear_ptrtype
typedef boost::tuple< bool,
size_type, value_type > 
solve_return_type
typedef boost::tuple< bool,
size_type, value_type > 
nl_solve_return_type

Public Member Functions

Accessors
MatrixStructure precMatrixStructure () const
value_type rTolerance () const
value_type dTolerance () const
value_type aTolerance () const
size_type maxIterations () const
bool converged () const
size_type nIterations () const
bool transpose () const
mpi::communicator const & comm () const
Mutators
 BOOST_PARAMETER_MEMBER_FUNCTION ((void), setTolerances, tag,(required(rtolerance,(double)))(optional(maxit,(size_type), 1000)(atolerance,(double), 1e-50)(dtolerance,(double), 1e5)))
void setPrecMatrixStructure (MatrixStructure mstruct)
solvernonlinear_ptrtype nlSolver ()
void setTranspose (bool transpose)
Methods
virtual real_type dot (vector_type const &x, vector_type const &y) const
real_type dot (vector_ptrtype const &x, vector_ptrtype const &y) const
virtual void prod (sparse_matrix_type const &A, vector_type const &x, vector_type &y) const =0
void prod (sparse_matrix_ptrtype const &A, vector_ptrtype const &x, vector_ptrtype &y) const
 BOOST_PARAMETER_MEMBER_FUNCTION ((solve_return_type), solve, tag,(required(matrix,(sparse_matrix_ptrtype))(in_out(solution),*(mpl::or_< boost::is_convertible< mpl::_, vector_type & >, boost::is_convertible< mpl::_, vector_ptrtype > >))(rhs,(vector_ptrtype)))(optional(prec,(sparse_matrix_ptrtype), matrix)(maxit,(size_type), 1000)(rtolerance,(double), 1e-13)(atolerance,(double), 1e-50)(dtolerance,(double), 1e5)(reuse_prec,(bool), false)(transpose,(bool), false)))
virtual solve_return_type solve (sparse_matrix_ptrtype const &A, sparse_matrix_ptrtype const &P, vector_ptrtype &x, vector_ptrtype const &b)=0
solve_return_type solve (sparse_matrix_ptrtype const &A, sparse_matrix_ptrtype const &P, vector_ptrtype &x, vector_ptrtype const &b, bool reuse_prec)
virtual nl_solve_return_type nlSolve (sparse_matrix_ptrtype &A, vector_ptrtype &x, vector_ptrtype &b, const double, const int)
virtual nl_solve_return_type nlSolve (sparse_matrix_ptrtype &A, vector_ptrtype &x, vector_ptrtype &b, const double, const int, bool reusePC)

Constructors, destructor

 Backend ()
 Backend (po::variables_map const &vm, std::string const &prefix="")
 Backend (Backend const &)
virtual ~Backend ()
virtual sparse_matrix_ptrtype newMatrix (DataMap const &dm1, DataMap const &dm2)=0
template<typename DomainSpace , typename ImageSpace >
sparse_matrix_ptrtype newMatrix (DomainSpace const &dm, ImageSpace const &im)
virtual vector_ptrtype newVector (DataMap const &dm)=0
template<typename DomainSpace >
vector_ptrtype newVector (DomainSpace const &dm)
static backend_ptrtype build (BackendType=BACKEND_PETSC)
static backend_ptrtype build (po::variables_map const &vm, std::string const &prefix="")

Detailed Description

template<typename T>
class Feel::Backend< T >

!

base class for all linear algebra backends

Author:
Christophe Prud'homme
See also:

Member Function Documentation

template<typename T>
value_type Feel::Backend< T >::aTolerance ( ) const [inline]
Returns:
the absolute tolerance
template<typename T>
Feel::Backend< T >::BOOST_PARAMETER_MEMBER_FUNCTION ( (void)  ,
setTolerances  ,
tag  ,
(required(rtolerance,(double)))(optional(maxit,(size_type), 1000)(atolerance,(double),1e-50)(dtolerance,(double),1e5))   
) [inline]

set tolerances: relative tolerance rtol, divergence tolerance dtol and absolute tolerance atol

template<typename T>
Feel::Backend< T >::BOOST_PARAMETER_MEMBER_FUNCTION ( (solve_return_type)  ,
solve  ,
tag  ,
(required(matrix,(sparse_matrix_ptrtype))(in_out(solution),*(mpl::or_< boost::is_convertible< mpl::_, vector_type & >,boost::is_convertible< mpl::_, vector_ptrtype > >))(rhs,(vector_ptrtype)))(optional(prec,(sparse_matrix_ptrtype), matrix)(maxit,(size_type), 1000)(rtolerance,(double), 1e-13)(atolerance,(double), 1e-50)(dtolerance,(double), 1e5)(reuse_prec,(bool), false)(transpose,(bool), false))   
) [inline]

solve for $P A x = P b$ where $P$ is an approximation of the inverse of $A$. this interface uses the boost.parameter library to ease the function usage

Parameters:
Amatrix to inverse
rhsright hand side vector
solutionsolution of the system
Ppreconditioner
maxitmaximum number of iterations
tolerancetolerance on the residual
reuse_precif true use adaptive preconditioning strategy
transposeif true solve the transpose problem
Warning:
some parameter may not be meaningful for all backends

References Feel::Backend< T >::newVector(), and Feel::Backend< T >::solve().

template<typename T >
Backend< T >::backend_ptrtype Feel::Backend< T >::build ( BackendType  bt = BACKEND_PETSC) [static]

Builds a Backend, if Petsc is available, use Petsc by default, otherwise use GMM which is distributed with feel

template<typename T >
Backend< T >::backend_ptrtype Feel::Backend< T >::build ( po::variables_map const &  vm,
std::string const &  prefix = "" 
) [static]

Builds a Backend

template<typename T>
mpi::communicator const& Feel::Backend< T >::comm ( ) const [inline]
Returns:
the communicator
template<typename T >
Backend< T >::real_type Feel::Backend< T >::dot ( vector_type const &  x,
vector_type const &  y 
) const [virtual]

clean up

Returns:
$ r = x^T * y $

References Feel::Vector< T >::localSize().

Referenced by Feel::Backend< T >::dot().

template<typename T>
real_type Feel::Backend< T >::dot ( vector_ptrtype const &  x,
vector_ptrtype const &  y 
) const [inline]
Returns:
$ r = x^T * y $

References Feel::Backend< T >::dot().

template<typename T>
value_type Feel::Backend< T >::dTolerance ( ) const [inline]
Returns:
the divergence tolerance
template<typename T>
size_type Feel::Backend< T >::maxIterations ( ) const [inline]
Returns:
the maximum number of iterations
template<typename T>
template<typename DomainSpace , typename ImageSpace >
sparse_matrix_ptrtype Feel::Backend< T >::newMatrix ( DomainSpace const &  dm,
ImageSpace const &  im 
) [inline]

helper function

References Feel::Backend< T >::newMatrix().

template<typename T>
virtual sparse_matrix_ptrtype Feel::Backend< T >::newMatrix ( DataMap const &  dm1,
DataMap const &  dm2 
) [pure virtual]

instantiate a new sparse vector

Implemented in Feel::BackendGmm< T >, and Feel::BackendPetsc< T >.

Referenced by Feel::Backend< T >::newMatrix().

template<typename T>
virtual vector_ptrtype Feel::Backend< T >::newVector ( DataMap const &  dm) [pure virtual]
template<typename T>
template<typename DomainSpace >
vector_ptrtype Feel::Backend< T >::newVector ( DomainSpace const &  dm) [inline]

helper function

References Feel::Backend< T >::newVector().

template<typename T >
Backend< T >::nl_solve_return_type Feel::Backend< T >::nlSolve ( sparse_matrix_ptrtype &  A,
vector_ptrtype &  x,
vector_ptrtype &  b,
const double  tol,
const int  its,
bool  reusePC 
) [virtual]

solve for the nonlinear problem $F( u ) = 0$ with an adaptive strategy to reuse the preconditioner

template<typename T >
Backend< T >::nl_solve_return_type Feel::Backend< T >::nlSolve ( sparse_matrix_ptrtype &  A,
vector_ptrtype &  x,
vector_ptrtype &  b,
const double  tol,
const int  its 
) [virtual]

solve for the nonlinear problem $F( u ) = 0$

template<typename T>
solvernonlinear_ptrtype Feel::Backend< T >::nlSolver ( ) [inline]
Returns:
the non linear solver
template<typename T>
MatrixStructure Feel::Backend< T >::precMatrixStructure ( ) const [inline]
Returns:
the type of preconditioner associated to the matrix
template<typename T>
virtual void Feel::Backend< T >::prod ( sparse_matrix_type const &  A,
vector_type const &  x,
vector_type y 
) const [pure virtual]
Returns:
$ y = A * x $

Implemented in Feel::BackendGmm< T >, and Feel::BackendPetsc< T >.

Referenced by Feel::Backend< T >::prod().

template<typename T>
void Feel::Backend< T >::prod ( sparse_matrix_ptrtype const &  A,
vector_ptrtype const &  x,
vector_ptrtype &  y 
) const [inline]
Returns:
$ y = A * x $

References Feel::Backend< T >::prod().

template<typename T>
value_type Feel::Backend< T >::rTolerance ( ) const [inline]
Returns:
the relative tolerance
template<typename T>
void Feel::Backend< T >::setPrecMatrixStructure ( MatrixStructure  mstruct) [inline]

set the type of preconditioner associated to the matrix

Referenced by Feel::BackendPetsc< T >::solve().

template<typename T >
Backend< T >::solve_return_type Feel::Backend< T >::solve ( sparse_matrix_ptrtype const &  A,
sparse_matrix_ptrtype const &  P,
vector_ptrtype &  x,
vector_ptrtype const &  b,
bool  reuse_prec 
)

solve for $P A x = P b$ where $P$ is an approximation of the inverse of $A$ using an adaptive preconditioning strategy.

Parameters:
Amatrix to inverse
rhsright hand side vector
solutionsolution of the system
Ppreconditioner
maxitmaximum number of iterations
tolerancetolerance on the residual
transposeif true solve the transpose problem
Warning:
some parameter may not be meaningful for all backends
template<typename T>
virtual solve_return_type Feel::Backend< T >::solve ( sparse_matrix_ptrtype const &  A,
sparse_matrix_ptrtype const &  P,
vector_ptrtype &  x,
vector_ptrtype const &  b 
) [pure virtual]

solve for $P A x = P b$ where $P$ is an approximation of the inverse of $A$.

Parameters:
Amatrix to inverse
rhsright hand side vector
solutionsolution of the system
Ppreconditioner
maxitmaximum number of iterations
tolerancetolerance on the residual
transposeif true solve the transpose problem
Warning:
some parameter may not be meaningful for all backends

Implemented in Feel::BackendGmm< T >, and Feel::BackendPetsc< T >.

Referenced by Feel::Backend< T >::BOOST_PARAMETER_MEMBER_FUNCTION().