ParGeMSLR
|
The base solver class. More...
#include <solver.hpp>
Public Member Functions | |
SolverClass () | |
The constructor of solver class. More... | |
SolverClass (const SolverClass< MatrixType, VectorType, DataType > &solver) | |
The copy constructor of solver class. More... | |
SolverClass (SolverClass< MatrixType, VectorType, DataType > &&solver) | |
The move constructor of solver class. More... | |
SolverClass< MatrixType, VectorType, DataType > & | operator= (const SolverClass< MatrixType, VectorType, DataType > &solver) |
The = operator of solver class. More... | |
SolverClass< MatrixType, VectorType, DataType > & | operator= (SolverClass< MatrixType, VectorType, DataType > &&solver) |
The = operator of solver class. More... | |
virtual int | Clear () |
Free the current solver. More... | |
virtual | ~SolverClass () |
The destructor of solver class. More... | |
virtual int | Setup (VectorType &x, VectorType &rhs)=0 |
Setup the solver phase, include building the preconditioner. Call this function before Solve, after SetPreconditioner. More... | |
virtual int | Solve (VectorType &x, VectorType &rhs)=0 |
Solve phase. Call this function after Setup. More... | |
virtual int | Solve (DenseMatrixClass< DataType > &x, DenseMatrixClass< DataType > &rhs) |
Solve phase with multiple right-hand-sides. Call this function after Setup. More... | |
virtual long int | GetNumNonzeros () |
Get the total number of nonzeros. More... | |
MatrixType * | GetMatrix () |
Get pointer to the matrix. More... | |
SolverClass< MatrixType, VectorType, DataType > * | GetPreconditioner () |
Get pointer to the preconditioner. More... | |
virtual int | SetWithParameterArray (double *params) |
Setup with parameter array. More... | |
virtual int | SetSolveLocation (const int &location)=0 |
Set the data location that the solver apply to. Will also be applied to the preconditioner. More... | |
int | SetMatrix (MatrixType &matrix) |
Set the target matrix for the current solver. More... | |
int | SetMatrixP (MatrixType *matrix) |
Set the target matrix for the current solver. More... | |
int | SetPreconditioner (SolverClass< MatrixType, VectorType, DataType > &precond) |
Set the preconditioner for the current solver. More... | |
int | SetPreconditionerP (SolverClass< MatrixType, VectorType, 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... | |
Protected Member Functions | |
int | CheckReadySetups (const char *str) const |
Return error is the preconditioner is ready. More... | |
Protected Attributes | |
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... | |
MatrixType * | _matrix |
The matrix. More... | |
bool | _own_matrix |
If the matrix is owned by this solver, default is false. More... | |
SolverClass< MatrixType, VectorType, DataType > * | _preconditioner |
The preconditioner. More... | |
bool | _own_preconditioner |
If the preconditioner is owned by this solver, default is false. More... | |
VectorType * | _solution |
Pointer to the solution, note that this vector is not going to be freed. More... | |
VectorType * | _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... | |
The base solver class. Matrix type is the type of the matrix, PreconditionerType is the type of the preconditioner, VectorType is the type of the vector, DataType is the data type.
To develope a new solver type, user typically needs to implement the following:
_location, MoveData() or SetSolveLocation() function: to control the solver location (host/device).
Setup() function: setup the solver.
Solve() function: apply the solve.
|
inline |
The constructor of solver class.
|
inline |
The copy constructor of solver class.
[in] | solver | The solver. |
|
inline |
The move constructor of solver class.
[in] | solver | The solver. |
|
inlinevirtual |
The destructor of solver class.
|
inlineprotected |
Return error is the preconditioner is ready.
|
inlinevirtual |
Free the current solver.
Reimplemented in pargemslr::IluClass< MatrixType, VectorType, DataType >, pargemslr::GemslrSchurSolveClass< MatrixType, VectorType, DataType >, pargemslr::GemslrSchurSolveClass< pargemslr::GemslrSchurMatrixClass< MatrixType, VectorType, DataType >, VectorType, DataType >, pargemslr::ParallelGemslrSchurSolveClass< MatrixType, VectorType, DataType >, pargemslr::ParallelGemslrSchurSolveClass< pargemslr::ParallelGemslrSchurMatrixClass< MatrixType, VectorType, DataType >, VectorType, DataType >, pargemslr::FlexGmresClass< MatrixType, VectorType, DataType >, pargemslr::FlexGmresClass< pargemslr::GemslrSchurMatrixClass< MatrixType, VectorType, DataType >, VectorType, DataType >, pargemslr::FlexGmresClass< pargemslr::ParallelGemslrSchurMatrixClass< MatrixType, VectorType, DataType >, VectorType, DataType >, and pargemslr::BlockJacobiClass< ParallelMatrixType, ParallelVectorType, LocalMatrixType, LocalVectorType, DataType >.
|
inline |
Get the precision.
|
inline |
Get pointer to the matrix.
|
inlinevirtual |
Get the total number of nonzeros.
Reimplemented in pargemslr::IluClass< MatrixType, VectorType, DataType >, pargemslr::GemslrSchurSolveClass< MatrixType, VectorType, DataType >, pargemslr::GemslrSchurSolveClass< pargemslr::GemslrSchurMatrixClass< MatrixType, VectorType, DataType >, VectorType, DataType >, pargemslr::ParallelGemslrSchurSolveClass< MatrixType, VectorType, DataType >, pargemslr::ParallelGemslrSchurSolveClass< pargemslr::ParallelGemslrSchurMatrixClass< MatrixType, VectorType, DataType >, VectorType, DataType >, and pargemslr::BlockJacobiClass< ParallelMatrixType, ParallelVectorType, LocalMatrixType, LocalVectorType, DataType >.
|
inline |
Get pointer to the preconditioner.
|
inline |
Get the solver type.
|
inline |
Check if the solver is ready to be used.
|
inline |
The = operator of solver class.
[in] | solver | The solver. |
|
inline |
The = operator of solver class.
[in] | solver | The solver. |
|
inline |
Set the target matrix for the current solver.
[in] | matrix | The target matrix. |
|
inline |
Set the target matrix for the current solver.
[in] | matrix | The pointer to the target matrix. |
|
inline |
Set if the matrix is owned by this solver, if so, matrix is freed when free the solver.
[in] | own_matrix | The boolean value. |
|
inline |
Set if the preconditioner is owned by this solver, if so, preconditioner is freed when free the solver.
[in] | own_preconditioner | The boolean value. |
|
inline |
Set the preconditioner for the current solver.
[in] | precond | The preconditioner. |
|
inline |
Set the preconditioner for the current solver.
[in] | precond | The pointer to the preconditioner. |
|
inline |
Set the print option. 0: minimal output. 1: detailed output.
[in] | print_option | The print option. |
|
pure virtual |
Set the data location that the solver apply to. Will also be applied to the preconditioner.
[in] | location | The target solver location. |
Implemented in pargemslr::IluClass< MatrixType, VectorType, DataType >, pargemslr::GemslrSchurSolveClass< MatrixType, VectorType, DataType >, pargemslr::GemslrSchurSolveClass< pargemslr::GemslrSchurMatrixClass< MatrixType, VectorType, DataType >, VectorType, DataType >, pargemslr::FlexGmresClass< MatrixType, VectorType, DataType >, pargemslr::FlexGmresClass< pargemslr::GemslrSchurMatrixClass< MatrixType, VectorType, DataType >, VectorType, DataType >, pargemslr::FlexGmresClass< pargemslr::ParallelGemslrSchurMatrixClass< MatrixType, VectorType, DataType >, VectorType, DataType >, pargemslr::ParallelGemslrSchurSolveClass< MatrixType, VectorType, DataType >, pargemslr::ParallelGemslrSchurSolveClass< pargemslr::ParallelGemslrSchurMatrixClass< MatrixType, VectorType, DataType >, VectorType, DataType >, and pargemslr::BlockJacobiClass< ParallelMatrixType, ParallelVectorType, LocalMatrixType, LocalVectorType, DataType >.
|
pure virtual |
Setup the solver phase, include building the preconditioner. Call this function before Solve, after SetPreconditioner.
[in] | x | The initial guess. |
[in] | rhs | The right-hand-side. |
Implemented in pargemslr::IluClass< MatrixType, VectorType, DataType >, pargemslr::GemslrSchurSolveClass< MatrixType, VectorType, DataType >, pargemslr::GemslrSchurSolveClass< pargemslr::GemslrSchurMatrixClass< MatrixType, VectorType, DataType >, VectorType, DataType >, pargemslr::ParallelGemslrSchurSolveClass< MatrixType, VectorType, DataType >, pargemslr::ParallelGemslrSchurSolveClass< pargemslr::ParallelGemslrSchurMatrixClass< MatrixType, VectorType, DataType >, VectorType, DataType >, pargemslr::FlexGmresClass< MatrixType, VectorType, DataType >, pargemslr::FlexGmresClass< pargemslr::GemslrSchurMatrixClass< MatrixType, VectorType, DataType >, VectorType, DataType >, pargemslr::FlexGmresClass< pargemslr::ParallelGemslrSchurMatrixClass< MatrixType, VectorType, DataType >, VectorType, DataType >, and pargemslr::BlockJacobiClass< ParallelMatrixType, ParallelVectorType, LocalMatrixType, LocalVectorType, DataType >.
|
inlinevirtual |
Setup with parameter array.
[in] | params | The parameter array. |
Reimplemented in pargemslr::IluClass< MatrixType, VectorType, DataType >, pargemslr::FlexGmresClass< MatrixType, VectorType, DataType >, pargemslr::FlexGmresClass< pargemslr::GemslrSchurMatrixClass< MatrixType, VectorType, DataType >, VectorType, DataType >, pargemslr::FlexGmresClass< pargemslr::ParallelGemslrSchurMatrixClass< MatrixType, VectorType, DataType >, VectorType, DataType >, pargemslr::GemslrSchurSolveClass< MatrixType, VectorType, DataType >, pargemslr::GemslrSchurSolveClass< pargemslr::GemslrSchurMatrixClass< MatrixType, VectorType, DataType >, VectorType, DataType >, pargemslr::ParallelGemslrSchurSolveClass< MatrixType, VectorType, DataType >, and pargemslr::ParallelGemslrSchurSolveClass< pargemslr::ParallelGemslrSchurMatrixClass< MatrixType, VectorType, DataType >, VectorType, DataType >.
|
inlinevirtual |
Solve phase with multiple right-hand-sides. Call this function after Setup.
[in,out] | x | The initial guess. |
[in] | rhs | The right-hand-side. |
|
pure virtual |
Solve phase. Call this function after Setup.
[in,out] | x | The initial guess. |
[in] | rhs | The right-hand-side. |
Implemented in pargemslr::IluClass< MatrixType, VectorType, DataType >, pargemslr::GemslrSchurSolveClass< MatrixType, VectorType, DataType >, pargemslr::GemslrSchurSolveClass< pargemslr::GemslrSchurMatrixClass< MatrixType, VectorType, DataType >, VectorType, DataType >, pargemslr::ParallelGemslrSchurSolveClass< MatrixType, VectorType, DataType >, pargemslr::ParallelGemslrSchurSolveClass< pargemslr::ParallelGemslrSchurMatrixClass< MatrixType, VectorType, DataType >, VectorType, DataType >, pargemslr::FlexGmresClass< MatrixType, VectorType, DataType >, pargemslr::FlexGmresClass< pargemslr::GemslrSchurMatrixClass< MatrixType, VectorType, DataType >, VectorType, DataType >, pargemslr::FlexGmresClass< pargemslr::ParallelGemslrSchurMatrixClass< MatrixType, VectorType, DataType >, VectorType, DataType >, and pargemslr::BlockJacobiClass< ParallelMatrixType, ParallelVectorType, LocalMatrixType, LocalVectorType, DataType >.
|
protected |
Is the preconditioner a mixed precision preconditioner?
|
protected |
The matrix.
|
protected |
If the matrix is owned by this solver, default is false.
|
protected |
If the preconditioner is owned by this solver, default is false.
|
protected |
The preconditioner.
|
protected |
The print option.
|
protected |
If the solver is ready.
|
protected |
Pointer to the right-hand-size, note that this vector is not going to be freed.
|
protected |
Pointer to the solution, note that this vector is not going to be freed.
|
protected |
The precision of the solver.
|
protected |
The type of the solver.