Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
Arcane::Alina::AMG< Backend, Coarsening, Relax > Class Template Reference

Algebraic multigrid method. More...

#include </__w/arcaneframework.github.io/arcaneframework.github.io/framework/arccore/src/alina/arccore/alina/AMG.h>

Collaboration diagram for Arcane::Alina::AMG< Backend, Coarsening, Relax >:

Classes

struct  params
 Parameters of the method. More...
struct  AMGLevel

Public Types

typedef Backend backend_type
typedef Backend::value_type value_type
typedef Backend::col_type col_type
typedef Backend::ptr_type ptr_type
typedef Backend::matrix matrix
typedef Backend::vector vector
typedef Coarsening< Backend > coarsening_type
typedef Relax< Backend > relax_type
typedef BuiltinBackend< value_type, col_type, ptr_type >::matrix build_matrix
typedef math::scalar_of< value_type >::type scalar_type
typedef Backend::params backend_params
 Backend parameters.

Public Member Functions

template<class Matrix>
 AMG (const Matrix &M, const params &p=params(), const backend_params &bprm=backend_params())
 Builds the AMG hierarchy for the system matrix.
 AMG (std::shared_ptr< build_matrix > A, const params &p=params(), const backend_params &bprm=backend_params())
 Builds the AMG hierarchy for the system matrix.
template<class Matrix>
void rebuild (const Matrix &M, const backend_params &bprm=backend_params())
 Rebuild the hierarchy using the new system matrix.
void rebuild (std::shared_ptr< build_matrix > A, const backend_params &bprm=backend_params())
 Rebuild the hierarchy using the new system matrix.
template<class Vec1, class Vec2>
void cycle (const Vec1 &rhs, Vec2 &&x) const
 Performs single V-cycle for the given right-hand side and solution.
template<class Vec1, class Vec2>
void apply (const Vec1 &rhs, Vec2 &&x) const
 Performs single V-cycle after clearing x.
std::shared_ptr< matrix > system_matrix_ptr () const
 Returns the system matrix from the finest level.
const matrix & system_matrix () const
size_t bytes () const

Public Attributes

params prm

Private Types

typedef std::list< AMGLevel >::const_iterator level_iterator

Private Member Functions

void _initialize (std::shared_ptr< build_matrix > A, const backend_params &bprm=backend_params())
template<class Vec1, class Vec2>
void cycle (level_iterator lvl, const Vec1 &rhs, Vec2 &x) const

Private Attributes

std::list< AMGLevellevels

Friends

template<class B, template< class > class C, template< class > class R>
std::ostream & operator<< (std::ostream &os, const AMG< B, C, R > &a)
 Sends information about the AMG hierarchy to output stream.

Detailed Description

template<class Backend, template< class > class Coarsening, template< class > class Relax>
class Arcane::Alina::AMG< Backend, Coarsening, Relax >

Algebraic multigrid method.

AMG is one of the most effective methods for solution of large sparse unstructured systems of equations, arising, for example, from discretization of PDEs on unstructured grids [Trottenberg2001]. The method can be used as a black-box solver for various computational problems, since it does not require any information about the underlying geometry.

The three template parameters allow the user to select the exact components of the method:

  1. Backend to transfer the constructed hierarchy to,
  2. Coarsening strategy for hierarchy construction, and
  3. Relaxation scheme (smoother to use during the solution phase).

Instance of the class builds the AMG hierarchy for the given system matrix and is intended to be used as a preconditioner.

Definition at line 70 of file AMG.h.

Member Typedef Documentation

◆ backend_params

template<class Backend, template< class > class Coarsening, template< class > class Relax>
typedef Backend::params Arcane::Alina::AMG< Backend, Coarsening, Relax >::backend_params

Backend parameters.

Definition at line 90 of file AMG.h.

◆ backend_type

template<class Backend, template< class > class Coarsening, template< class > class Relax>
typedef Backend Arcane::Alina::AMG< Backend, Coarsening, Relax >::backend_type

Definition at line 74 of file AMG.h.

◆ build_matrix

template<class Backend, template< class > class Coarsening, template< class > class Relax>
typedef BuiltinBackend<value_type,col_type,ptr_type>::matrix Arcane::Alina::AMG< Backend, Coarsening, Relax >::build_matrix

Definition at line 85 of file AMG.h.

◆ coarsening_type

template<class Backend, template< class > class Coarsening, template< class > class Relax>
typedef Coarsening<Backend> Arcane::Alina::AMG< Backend, Coarsening, Relax >::coarsening_type

Definition at line 82 of file AMG.h.

◆ col_type

template<class Backend, template< class > class Coarsening, template< class > class Relax>
typedef Backend::col_type Arcane::Alina::AMG< Backend, Coarsening, Relax >::col_type

Definition at line 77 of file AMG.h.

◆ level_iterator

template<class Backend, template< class > class Coarsening, template< class > class Relax>
typedef std::list<AMGLevel>::const_iterator Arcane::Alina::AMG< Backend, Coarsening, Relax >::level_iterator
private

Definition at line 475 of file AMG.h.

◆ matrix

template<class Backend, template< class > class Coarsening, template< class > class Relax>
typedef Backend::matrix Arcane::Alina::AMG< Backend, Coarsening, Relax >::matrix

Definition at line 79 of file AMG.h.

◆ ptr_type

template<class Backend, template< class > class Coarsening, template< class > class Relax>
typedef Backend::ptr_type Arcane::Alina::AMG< Backend, Coarsening, Relax >::ptr_type

Definition at line 78 of file AMG.h.

◆ relax_type

template<class Backend, template< class > class Coarsening, template< class > class Relax>
typedef Relax<Backend> Arcane::Alina::AMG< Backend, Coarsening, Relax >::relax_type

Definition at line 83 of file AMG.h.

◆ scalar_type

template<class Backend, template< class > class Coarsening, template< class > class Relax>
typedef math::scalar_of<value_type>::type Arcane::Alina::AMG< Backend, Coarsening, Relax >::scalar_type

Definition at line 87 of file AMG.h.

◆ value_type

template<class Backend, template< class > class Coarsening, template< class > class Relax>
typedef Backend::value_type Arcane::Alina::AMG< Backend, Coarsening, Relax >::value_type

Definition at line 76 of file AMG.h.

◆ vector

template<class Backend, template< class > class Coarsening, template< class > class Relax>
typedef Backend::vector Arcane::Alina::AMG< Backend, Coarsening, Relax >::vector

Definition at line 80 of file AMG.h.

Constructor & Destructor Documentation

◆ AMG() [1/2]

template<class Backend, template< class > class Coarsening, template< class > class Relax>
template<class Matrix>
Arcane::Alina::AMG< Backend, Coarsening, Relax >::AMG ( const Matrix & M,
const params & p = params(),
const backend_params & bprm = backend_params() )
inlineexplicit

Builds the AMG hierarchy for the system matrix.

The input matrix is copied here and is safe to delete afterwards.

Parameters
AThe system matrix. Should be convertible to a CSRMatrix.
pAMG parameters.

Definition at line 190 of file AMG.h.

◆ AMG() [2/2]

template<class Backend, template< class > class Coarsening, template< class > class Relax>
Arcane::Alina::AMG< Backend, Coarsening, Relax >::AMG ( std::shared_ptr< build_matrix > A,
const params & p = params(),
const backend_params & bprm = backend_params() )
inlineexplicit

Builds the AMG hierarchy for the system matrix.

The shared pointer to the input matrix is passed here. The matrix will not be copied and should out-live the amg instance. The matrix should be either in CSRMatrix format, or inherit from the class and override its ptr(), col(), and val() virtual functions.

Parameters
AThe system matrix.
pAMG parameters.

Definition at line 212 of file AMG.h.

Member Function Documentation

◆ _initialize()

template<class Backend, template< class > class Coarsening, template< class > class Relax>
void Arcane::Alina::AMG< Backend, Coarsening, Relax >::_initialize ( std::shared_ptr< build_matrix > A,
const backend_params & bprm = backend_params() )
inlineprivate

Definition at line 479 of file AMG.h.

◆ apply()

template<class Backend, template< class > class Coarsening, template< class > class Relax>
template<class Vec1, class Vec2>
void Arcane::Alina::AMG< Backend, Coarsening, Relax >::apply ( const Vec1 & rhs,
Vec2 && x ) const
inline

Performs single V-cycle after clearing x.

This is intended for use as a preconditioning procedure.

Parameters
rhsRight-hand side vector.
xSolution vector.

Definition at line 278 of file AMG.h.

◆ bytes()

template<class Backend, template< class > class Coarsening, template< class > class Relax>
size_t Arcane::Alina::AMG< Backend, Coarsening, Relax >::bytes ( ) const
inline

Definition at line 301 of file AMG.h.

◆ cycle() [1/2]

template<class Backend, template< class > class Coarsening, template< class > class Relax>
template<class Vec1, class Vec2>
void Arcane::Alina::AMG< Backend, Coarsening, Relax >::cycle ( const Vec1 & rhs,
Vec2 && x ) const
inline

Performs single V-cycle for the given right-hand side and solution.

Parameters
rhsRight-hand side vector.
xSolution vector.

Definition at line 264 of file AMG.h.

Referenced by Arcane::Alina::AMG< Backend, Alina::CoarseningRuntime, Alina::RelaxationRuntime >::apply(), and Arcane::Alina::AMG< Backend, Alina::CoarseningRuntime, Alina::RelaxationRuntime >::cycle().

Here is the caller graph for this function:

◆ cycle() [2/2]

template<class Backend, template< class > class Coarsening, template< class > class Relax>
template<class Vec1, class Vec2>
void Arcane::Alina::AMG< Backend, Coarsening, Relax >::cycle ( level_iterator lvl,
const Vec1 & rhs,
Vec2 & x ) const
inlineprivate

Definition at line 525 of file AMG.h.

◆ rebuild() [1/2]

template<class Backend, template< class > class Coarsening, template< class > class Relax>
template<class Matrix>
void Arcane::Alina::AMG< Backend, Coarsening, Relax >::rebuild ( const Matrix & M,
const backend_params & bprm = backend_params() )
inline

Rebuild the hierarchy using the new system matrix.

This requires for prm.allow_rebuild to be set. The transfer operators created during the initial setup are reused.

Definition at line 227 of file AMG.h.

Referenced by Arcane::Alina::AMG< Backend, Alina::CoarseningRuntime, Alina::RelaxationRuntime >::rebuild().

Here is the caller graph for this function:

◆ rebuild() [2/2]

template<class Backend, template< class > class Coarsening, template< class > class Relax>
void Arcane::Alina::AMG< Backend, Coarsening, Relax >::rebuild ( std::shared_ptr< build_matrix > A,
const backend_params & bprm = backend_params() )
inline

Rebuild the hierarchy using the new system matrix.

This requires for prm.allow_rebuild to be set. The transfer operators created during the initial setup are reused.

Definition at line 241 of file AMG.h.

◆ system_matrix()

template<class Backend, template< class > class Coarsening, template< class > class Relax>
const matrix & Arcane::Alina::AMG< Backend, Coarsening, Relax >::system_matrix ( ) const
inline

Definition at line 296 of file AMG.h.

◆ system_matrix_ptr()

template<class Backend, template< class > class Coarsening, template< class > class Relax>
std::shared_ptr< matrix > Arcane::Alina::AMG< Backend, Coarsening, Relax >::system_matrix_ptr ( ) const
inline

Returns the system matrix from the finest level.

Definition at line 291 of file AMG.h.

◆ operator<<

template<class Backend, template< class > class Coarsening, template< class > class Relax>
template<class B, template< class > class C, template< class > class R>
std::ostream & operator<< ( std::ostream & os,
const AMG< B, C, R > & a )
friend

Sends information about the AMG hierarchy to output stream.

Definition at line 578 of file AMG.h.

Member Data Documentation

◆ levels

template<class Backend, template< class > class Coarsening, template< class > class Relax>
std::list<AMGLevel> Arcane::Alina::AMG< Backend, Coarsening, Relax >::levels
private

Definition at line 477 of file AMG.h.

◆ prm

template<class Backend, template< class > class Coarsening, template< class > class Relax>
params Arcane::Alina::AMG< Backend, Coarsening, Relax >::prm

Definition at line 311 of file AMG.h.


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