Alien  1.3.0
Developer documentation
Loading...
Searching...
No Matches
Alien::LinearSolver< Tag > Class Template Reference

Linear solver interface. More...

#include <core/alien/core/backend/LinearSolver.h>

Inheritance diagram for Alien::LinearSolver< Tag >:
Collaboration diagram for Alien::LinearSolver< Tag >:

Public Types

typedef AlgebraTraits< Tag >::solver_type KernelSolver
 The type of the solver.
Public Types inherited from Alien::ILinearSolver
typedef SolverStatus Status
 Type of the solver status.

Public Member Functions

template<typename... T>
 LinearSolver (T... args)
 Creates a linear solver.
virtual ~LinearSolver ()
 Free resources.
Arccore::String getBackEndName () const
 Get package back end name.
void init ()
 Initialize the linear solver.
void end ()
 Finalize the linear solver.
void updateParallelMng (Arccore::MessagePassing::IMessagePassingMng *pm)
 update parallel_mng, required for redistribution For some solver libraries, Solver is kind of a global object and must be updated accordingly with Matrices and Vectors (Think PETScInit)
bool solve (const IMatrix &A, const IVector &b, IVector &x)
 Solve the linear system A * x = b.
const SolverStatgetSolverStat () const
 Get statistics on the solve phase.
bool hasParallelSupport () const
 Indicates if the kernel is parallel.
const SolverStatusgetStatus () const
 Get solver resolution status.
std::shared_ptr< ILinearAlgebraalgebra () const
 Get compatible linear algebra.
KernelSolverimplem ()
 Get kernel solver implementation.
virtual void setNullSpaceConstantOption (bool flag)
 Option to add an extra-equation.
Public Member Functions inherited from Alien::ILinearSolver
 ILinearSolver ()
 Constructor.
virtual ~ILinearSolver ()
 Free resources.

Private Attributes

std::unique_ptr< KernelSolverm_solver
 The linear solver kernel.
SolverStater< KernelSolverm_stater

Detailed Description

template<class Tag>
class Alien::LinearSolver< Tag >

Linear solver interface.

Interface for all linear solver package

Template Parameters
TagThe tag of the type of solvers used

Definition at line 63 of file LinearSolver.h.

Member Typedef Documentation

◆ KernelSolver

template<class Tag>
typedef AlgebraTraits<Tag>::solver_type Alien::LinearSolver< Tag >::KernelSolver

The type of the solver.

Definition at line 67 of file LinearSolver.h.

Constructor & Destructor Documentation

◆ LinearSolver()

template<class Tag>
template<typename... T>
Alien::LinearSolver< Tag >::LinearSolver ( T... args)
inline

Creates a linear solver.

Creates a linear solver using traits and the linear solver factory

Template Parameters
TVariadics type of linear solver
Parameters
[in]argsLinear solvers

Definition at line 79 of file LinearSolver.h.

References m_solver.

◆ ~LinearSolver()

template<class Tag>
Alien::LinearSolver< Tag >::~LinearSolver ( )
virtual

Free resources.

Definition at line 43 of file LinearSolverT.h.

Member Function Documentation

◆ algebra()

template<class Tag>
std::shared_ptr< ILinearAlgebra > Alien::LinearSolver< Tag >::algebra ( ) const
virtual

Get compatible linear algebra.

Returns
Linear algebra pointer

Implements Alien::ILinearSolver.

Definition at line 157 of file LinearSolverT.h.

References m_solver.

◆ end()

template<class Tag>
void Alien::LinearSolver< Tag >::end ( )
virtual

Finalize the linear solver.

Implements Alien::ILinearSolver.

Definition at line 103 of file LinearSolverT.h.

References m_solver.

◆ getBackEndName()

template<class Tag>
String Alien::LinearSolver< Tag >::getBackEndName ( ) const
virtual

Get package back end name.

Returns
Package back end name

Implements Alien::ILinearSolver.

Definition at line 50 of file LinearSolverT.h.

◆ getSolverStat()

template<class Tag>
const SolverStat & Alien::LinearSolver< Tag >::getSolverStat ( ) const
virtual

Get statistics on the solve phase.

Get statistics on the solver phase, such as iteration count, initialization time, solve time, etc.

Returns
Solver statistics

Implements Alien::ILinearSolver.

Definition at line 118 of file LinearSolverT.h.

References m_solver.

◆ getStatus()

template<class Tag>
const SolverStatus & Alien::LinearSolver< Tag >::getStatus ( ) const
virtual

Get solver resolution status.

Returns
The solver status

Implements Alien::ILinearSolver.

Definition at line 137 of file LinearSolverT.h.

References m_solver.

◆ hasParallelSupport()

template<class Tag>
bool Alien::LinearSolver< Tag >::hasParallelSupport ( ) const
virtual

Indicates if the kernel is parallel.

Returns
Parallel support capability

Implements Alien::ILinearSolver.

Definition at line 127 of file LinearSolverT.h.

References m_solver.

◆ implem()

template<class Tag>
LinearSolver< Tag >::KernelSolver * Alien::LinearSolver< Tag >::implem ( )

Get kernel solver implementation.

Returns
Linear solver actual implementation

Definition at line 147 of file LinearSolverT.h.

References m_solver.

◆ init()

template<class Tag>
void Alien::LinearSolver< Tag >::init ( )
virtual

Initialize the linear solver.

Implements Alien::ILinearSolver.

Definition at line 93 of file LinearSolverT.h.

References m_solver.

◆ setNullSpaceConstantOption()

template<class Tag>
virtual void Alien::LinearSolver< Tag >::setNullSpaceConstantOption ( bool flag)
inlinevirtual

Option to add an extra-equation.

Option to add an extra-equation to the linear system such as a constraint equation

Parameters
[in]flagIf the option is activated
Todo
Implement this method

Implements Alien::ILinearSolver.

Definition at line 160 of file LinearSolver.h.

◆ solve()

template<class Tag>
bool Alien::LinearSolver< Tag >::solve ( const IMatrix & A,
const IVector & b,
IVector & x )
virtual

Solve the linear system A * x = b.

Parameters
[in]AThe matrix to invert
[in]bThe right hand side
[in,out]xThe solution
Returns
Solver success or failure
Todo
Check the comment below and fix if necessary

Implements Alien::ILinearSolver.

Definition at line 62 of file LinearSolverT.h.

References Alien::MultiMatrixImpl::distribution(), Alien::MultiMatrixImpl::get(), Alien::MultiVectorImpl::get(), Alien::IMatrix::impl(), Alien::IVector::impl(), m_solver, and Alien::MatrixDistribution::parallelMng().

Here is the call graph for this function:

◆ updateParallelMng()

template<class Tag>
void Alien::LinearSolver< Tag >::updateParallelMng ( Arccore::MessagePassing::IMessagePassingMng * pm)
virtual

update parallel_mng, required for redistribution For some solver libraries, Solver is kind of a global object and must be updated accordingly with Matrices and Vectors (Think PETScInit)

Parameters
[in]pm: new parallel mng

Implements Alien::ILinearSolver.

Definition at line 109 of file LinearSolverT.h.

References m_solver.

Member Data Documentation

◆ m_solver

template<class Tag>
std::unique_ptr<KernelSolver> Alien::LinearSolver< Tag >::m_solver
private

The linear solver kernel.

Definition at line 167 of file LinearSolver.h.

Referenced by algebra(), end(), getSolverStat(), getStatus(), hasParallelSupport(), implem(), init(), LinearSolver(), solve(), and updateParallelMng().

◆ m_stater

template<class Tag>
SolverStater<KernelSolver> Alien::LinearSolver< Tag >::m_stater
private

Definition at line 168 of file LinearSolver.h.


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