ParGeMSLR
Public Member Functions | List of all members
pargemslr::BlockJacobiClass< ParallelMatrixType, ParallelVectorType, LocalMatrixType, LocalVectorType, DataType > Class Template Reference

Block Jacobi preconditioner, only for parallel csr matrix. More...

#include <block_jacobi.hpp>

Inheritance diagram for pargemslr::BlockJacobiClass< ParallelMatrixType, ParallelVectorType, LocalMatrixType, LocalVectorType, DataType >:
pargemslr::SolverClass< ParallelMatrixType, ParallelVectorType, DataType >

Public Member Functions

 BlockJacobiClass ()
 The constructor of BlockJacobiClass. More...
 
virtual int Clear ()
 Free the current precondioner. More...
 
virtual ~BlockJacobiClass ()
 The destructor of BlockJacobiClass. More...
 
 BlockJacobiClass (const BlockJacobiClass< ParallelMatrixType, ParallelVectorType, LocalMatrixType, LocalVectorType, DataType > &solver)
 The copy constructor of BlockJacobiClass. Note that this is not the true copy. We only copy the pointer to the local preconditioner. More...
 
 BlockJacobiClass (BlockJacobiClass< ParallelMatrixType, ParallelVectorType, LocalMatrixType, LocalVectorType, DataType > &&solver)
 The move constructor of BlockJacobiClass. More...
 
BlockJacobiClass< ParallelMatrixType, ParallelVectorType, LocalMatrixType, LocalVectorType, DataType > & operator= (const BlockJacobiClass< ParallelMatrixType, ParallelVectorType, LocalMatrixType, LocalVectorType, DataType > &solver)
 The = operator of BlockJacobiClass. Note that this is not the true copy. We only copy the pointer to the local preconditioner. More...
 
BlockJacobiClass< ParallelMatrixType, ParallelVectorType, LocalMatrixType, LocalVectorType, DataType > & operator= (BlockJacobiClass< ParallelMatrixType, ParallelVectorType, LocalMatrixType, LocalVectorType, DataType > &&solver)
 The = operator of BlockJacobiClass. More...
 
virtual int Setup (ParallelVectorType &x, ParallelVectorType &rhs)
 Setup the precondioner phase. Will be called by the solver if not called directly. More...
 
virtual int Solve (ParallelVectorType &x, ParallelVectorType &rhs)
 Solve phase. Call this function after Setup. Solve with cusparse if unified memory/device memory is used. More...
 
virtual long int GetNumNonzeros ()
 Get the total number of nonzeros. More...
 
int SetLocalPreconditioner (SolverClass< LocalMatrixType, LocalVectorType, DataType > &local_precond)
 Set the local preconditioenr. More...
 
int SetLocalPreconditionerP (SolverClass< LocalMatrixType, LocalVectorType, DataType > *local_precond)
 Set the local preconditioenr. More...
 
SolverClass< LocalMatrixType, LocalVectorType, DataType > * GetLocalPreconditionerP ()
 Get the local preconditioenr. More...
 
int SetOwnLocalPreconditioner (bool own_local_preconditioner)
 Set the own preconditioenr. If set to true, the preconditioner will be freed when destrooy. More...
 
virtual int SetSolveLocation (const int &location)
 Set the data location that the preconditioner apply to. More...
 
virtual int MoveData (const int &location)
 Move the preconditioner to another location. Only can be called after Setup. More...
 
- Public Member Functions inherited from pargemslr::SolverClass< ParallelMatrixType, ParallelVectorType, DataType >
 SolverClass ()
 The constructor of solver class. More...
 
 SolverClass (const SolverClass< ParallelMatrixType, ParallelVectorType, DataType > &solver)
 The copy constructor of solver class. More...
 
 SolverClass (SolverClass< ParallelMatrixType, ParallelVectorType, DataType > &&solver)
 The move constructor of solver class. More...
 
SolverClass< ParallelMatrixType, ParallelVectorType, DataType > & operator= (const SolverClass< ParallelMatrixType, ParallelVectorType, DataType > &solver)
 The = operator of solver class. More...
 
SolverClass< ParallelMatrixType, ParallelVectorType, DataType > & operator= (SolverClass< ParallelMatrixType, ParallelVectorType, DataType > &&solver)
 The = operator of solver class. More...
 
virtual ~SolverClass ()
 The destructor of solver class. More...
 
virtual int Solve (DenseMatrixClass< DataType > &x, DenseMatrixClass< DataType > &rhs)
 Solve phase with multiple right-hand-sides. Call this function after Setup. More...
 
ParallelMatrixType * GetMatrix ()
 Get pointer to the matrix. More...
 
SolverClass< ParallelMatrixType, ParallelVectorType, DataType > * GetPreconditioner ()
 Get pointer to the preconditioner. More...
 
virtual int SetWithParameterArray (double *params)
 Setup with parameter array. More...
 
int SetMatrix (ParallelMatrixType &matrix)
 Set the target matrix for the current solver. More...
 
int SetMatrixP (ParallelMatrixType *matrix)
 Set the target matrix for the current solver. More...
 
int SetPreconditioner (SolverClass< ParallelMatrixType, ParallelVectorType, DataType > &precond)
 Set the preconditioner for the current solver. More...
 
int SetPreconditionerP (SolverClass< ParallelMatrixType, ParallelVectorType, DataType > *precond)
 Set the preconditioner for the current solver. More...
 
bool IsReady () const
 Check if the solver is ready to be used. More...
 
int SetOwnMatrix (bool own_matrix)
 Set if the matrix is owned by this solver, if so, matrix is freed when free the solver. More...
 
int SetOwnPreconditioner (bool own_preconditioner)
 Set if the preconditioner is owned by this solver, if so, preconditioner is freed when free the solver. More...
 
int SetPrintOption (int print_option)
 Set the print option. More...
 
PrecisionEnum GerPrecision () const
 Get the precision. More...
 
SolverTypeEnum GetSolverType () const
 Get the solver type. More...
 

Additional Inherited Members

- Protected Member Functions inherited from pargemslr::SolverClass< ParallelMatrixType, ParallelVectorType, DataType >
int CheckReadySetups (const char *str) const
 Return error is the preconditioner is ready. More...
 
- Protected Attributes inherited from pargemslr::SolverClass< ParallelMatrixType, ParallelVectorType, DataType >
PrecisionEnum _solver_precision
 The precision of the solver. More...
 
SolverTypeEnum _solver_type
 The type of the solver. More...
 
bool _is_mixed
 Is the preconditioner a mixed precision preconditioner? More...
 
ParallelMatrixType * _matrix
 The matrix. More...
 
bool _own_matrix
 If the matrix is owned by this solver, default is false. More...
 
SolverClass< ParallelMatrixType, ParallelVectorType, DataType > * _preconditioner
 The preconditioner. More...
 
bool _own_preconditioner
 If the preconditioner is owned by this solver, default is false. More...
 
ParallelVectorType * _solution
 Pointer to the solution, note that this vector is not going to be freed. More...
 
ParallelVectorType * _right_hand_side
 Pointer to the right-hand-size, note that this vector is not going to be freed. More...
 
bool _ready
 If the solver is ready. More...
 
int _print_option
 The print option. More...
 

Detailed Description

template<class ParallelMatrixType, class ParallelVectorType, class LocalMatrixType, class LocalVectorType, typename DataType>
class pargemslr::BlockJacobiClass< ParallelMatrixType, ParallelVectorType, LocalMatrixType, LocalVectorType, DataType >

Block Jacobi preconditioner, only for parallel csr matrix.

Constructor & Destructor Documentation

◆ BlockJacobiClass() [1/3]

template<class ParallelMatrixType , class ParallelVectorType , class LocalMatrixType , class LocalVectorType , typename DataType >
template pargemslr::precond_bj_csr_par_complexd::BlockJacobiClass ( )

The constructor of BlockJacobiClass.

◆ ~BlockJacobiClass()

template<class ParallelMatrixType , class ParallelVectorType , class LocalMatrixType , class LocalVectorType , typename DataType >
template pargemslr::precond_bj_csr_par_complexd::~BlockJacobiClass ( )
virtual

The destructor of BlockJacobiClass.

◆ BlockJacobiClass() [2/3]

template<class ParallelMatrixType , class ParallelVectorType , class LocalMatrixType , class LocalVectorType , typename DataType >
pargemslr::BlockJacobiClass< ParallelMatrixType, ParallelVectorType, LocalMatrixType, LocalVectorType, DataType >::BlockJacobiClass ( const BlockJacobiClass< ParallelMatrixType, ParallelVectorType, LocalMatrixType, LocalVectorType, DataType > &  solver)

The copy constructor of BlockJacobiClass. Note that this is not the true copy. We only copy the pointer to the local preconditioner.
The onwer is not this preconditioner.

Parameters
[in]solveThe target solver.

◆ BlockJacobiClass() [3/3]

template<class ParallelMatrixType , class ParallelVectorType , class LocalMatrixType , class LocalVectorType , typename DataType >
pargemslr::BlockJacobiClass< ParallelMatrixType, ParallelVectorType, LocalMatrixType, LocalVectorType, DataType >::BlockJacobiClass ( BlockJacobiClass< ParallelMatrixType, ParallelVectorType, LocalMatrixType, LocalVectorType, DataType > &&  solver)

The move constructor of BlockJacobiClass.

Parameters
[in]solveThe target solver.

Member Function Documentation

◆ Clear()

template<class ParallelMatrixType , class ParallelVectorType , class LocalMatrixType , class LocalVectorType , typename DataType >
template int pargemslr::precond_bj_csr_par_complexd::Clear ( )
virtual

Free the current precondioner.

Returns
Return error message.

Reimplemented from pargemslr::SolverClass< ParallelMatrixType, ParallelVectorType, DataType >.

◆ GetLocalPreconditionerP()

template<class ParallelMatrixType , class ParallelVectorType , class LocalMatrixType , class LocalVectorType , typename DataType >
template solver_csr_seq_complexd * pargemslr::precond_bj_csr_par_complexd::GetLocalPreconditionerP ( )

Get the local preconditioenr.

Returns
Return the local preconditioner.

◆ GetNumNonzeros()

template<class ParallelMatrixType , class ParallelVectorType , class LocalMatrixType , class LocalVectorType , typename DataType >
template long int pargemslr::precond_bj_csr_par_complexd::GetNumNonzeros ( )
virtual

Get the total number of nonzeros.

Returns
Return the total number of nonzeros.

Reimplemented from pargemslr::SolverClass< ParallelMatrixType, ParallelVectorType, DataType >.

◆ MoveData()

template<class ParallelMatrixType , class ParallelVectorType , class LocalMatrixType , class LocalVectorType , typename DataType >
template int pargemslr::precond_bj_csr_par_complexd::MoveData ( const int &  location)
virtual

Move the preconditioner to another location. Only can be called after Setup.

Parameters
[in]locationThe target solver location.
Returns
Return error message.

◆ operator=() [1/2]

template<class ParallelMatrixType , class ParallelVectorType , class LocalMatrixType , class LocalVectorType , typename DataType >
BlockJacobiClass< ParallelMatrixType, ParallelVectorType, LocalMatrixType, LocalVectorType, DataType > & pargemslr::BlockJacobiClass< ParallelMatrixType, ParallelVectorType, LocalMatrixType, LocalVectorType, DataType >::operator= ( BlockJacobiClass< ParallelMatrixType, ParallelVectorType, LocalMatrixType, LocalVectorType, DataType > &&  solver)

The = operator of BlockJacobiClass.

Parameters
[in]solveThe target solver.
Returns
Return the solver.

◆ operator=() [2/2]

template<class ParallelMatrixType , class ParallelVectorType , class LocalMatrixType , class LocalVectorType , typename DataType >
BlockJacobiClass< ParallelMatrixType, ParallelVectorType, LocalMatrixType, LocalVectorType, DataType > & pargemslr::BlockJacobiClass< ParallelMatrixType, ParallelVectorType, LocalMatrixType, LocalVectorType, DataType >::operator= ( const BlockJacobiClass< ParallelMatrixType, ParallelVectorType, LocalMatrixType, LocalVectorType, DataType > &  solver)

The = operator of BlockJacobiClass. Note that this is not the true copy. We only copy the pointer to the local preconditioner.
The onwer is not this preconditioner.

Parameters
[in]solveThe target solver.
Returns
Return the solver.

◆ SetLocalPreconditioner()

template<class ParallelMatrixType , class ParallelVectorType , class LocalMatrixType , class LocalVectorType , typename DataType >
int pargemslr::BlockJacobiClass< ParallelMatrixType, ParallelVectorType, LocalMatrixType, LocalVectorType, DataType >::SetLocalPreconditioner ( SolverClass< LocalMatrixType, LocalVectorType, DataType > &  local_precond)

Set the local preconditioenr.

Returns
Return error message.

◆ SetLocalPreconditionerP()

template<class ParallelMatrixType , class ParallelVectorType , class LocalMatrixType , class LocalVectorType , typename DataType >
int pargemslr::BlockJacobiClass< ParallelMatrixType, ParallelVectorType, LocalMatrixType, LocalVectorType, DataType >::SetLocalPreconditionerP ( SolverClass< LocalMatrixType, LocalVectorType, DataType > *  local_precond)

Set the local preconditioenr.

Returns
Return error message.

◆ SetOwnLocalPreconditioner()

template<class ParallelMatrixType , class ParallelVectorType , class LocalMatrixType , class LocalVectorType , typename DataType >
template int pargemslr::precond_bj_csr_par_complexd::SetOwnLocalPreconditioner ( bool  own_local_preconditioner)

Set the own preconditioenr.

Returns
Return the total number of nonzeros the ILU.

◆ SetSolveLocation()

template<class ParallelMatrixType , class ParallelVectorType , class LocalMatrixType , class LocalVectorType , typename DataType >
template int pargemslr::precond_bj_csr_par_complexd::SetSolveLocation ( const int &  location)
virtual

Set the data location that the preconditioner apply to.

Parameters
[in]locationThe target solver location.
Returns
Return error message.

Implements pargemslr::SolverClass< ParallelMatrixType, ParallelVectorType, DataType >.

◆ Setup()

template<class ParallelMatrixType , class ParallelVectorType , class LocalMatrixType , class LocalVectorType , typename DataType >
int pargemslr::BlockJacobiClass< ParallelMatrixType, ParallelVectorType, LocalMatrixType, LocalVectorType, DataType >::Setup ( ParallelVectorType &  x,
ParallelVectorType &  rhs 
)
virtual

Setup the precondioner phase. Will be called by the solver if not called directly.

Parameters
[in]xThe initial guess.
[in]rhsThe right-hand-side.
Returns
Return error message.

Implements pargemslr::SolverClass< ParallelMatrixType, ParallelVectorType, DataType >.

◆ Solve()

template<class ParallelMatrixType , class ParallelVectorType , class LocalMatrixType , class LocalVectorType , typename DataType >
int pargemslr::BlockJacobiClass< ParallelMatrixType, ParallelVectorType, LocalMatrixType, LocalVectorType, DataType >::Solve ( ParallelVectorType &  x,
ParallelVectorType &  rhs 
)
virtual

Solve phase. Call this function after Setup. Solve with cusparse if unified memory/device memory is used.

Parameters
[in,out]xThe initial guess.
[in]rhsThe right-hand-side.
Returns
Return error message.

Implements pargemslr::SolverClass< ParallelMatrixType, ParallelVectorType, DataType >.


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