LinSolver

This class is used to manage the Linear Solver. More…

#include "LinSolver.h"

Inherited by BiCGstab, GMRES, PCG, SQMR

Public Functions

Name
virtual ~LinSolver() =0
Deletes the object.
virtual void Set_Solver(MatrixProd & MAT, DDMat & RHS, MatrixProd & PREC) =0
Sets the solver for monolithic preconditioning.
virtual void Set_Solver(MatrixProd & MAT, DDMat & RHS, MatrixProd & PREC_L, MatrixProd & PREC_R) =0
Sets the solver for split preconditioning.
virtual void Solve(MatrixProd & MAT, DDMat & RHS, DDMat & SOL, MatrixProd & PREC, const string *restrict filename =nullptr) =0
Solves the linear system with monolithic preconditioning.
virtual void Solve(MatrixProd & MAT, DDMat & RHS, DDMat & SOL, MatrixProd & PREC_L, MatrixProd & PREC_R, const string *restrict filename =nullptr) =0
Solves the linear system with split preconditioning.
void Set_use_PrecRes(const bool input_use_PrecRes)
Sets the the use of preconditioned residual in controlling convergence.
void Set_maxITER(const int input_maxITER)
Sets the maximum number of iterations.
void Set_exitTOL(const double input_exitTOL)
Sets the exit tolerance.
void Set_initial_sol(const int input_initial_sol)
Sets the flag for initial solution.
void Set_printConvProfile(const bool input_printConvProfile)
Sets the flag for Convergence Profile printing.
void Set_restart(int const input_restart)
Sets the restart frequency.
void SetParms_from_XML(xml_document & input_xml)
Sets the parameters from the XML file.
int get_ITER() const
Returns the number of iterations performed in previous solution.
const rExt * get_ptr_normRES0() const
Returns an handle to the Euclidean norm of the initial residual for each RHS.
const rExt * get_ptr_normRESiter() const
Returns an handle to the Euclidean norm of the final iterative residual for each RHS.
const rExt * get_ptr_normRESreal() const
Returns an handle to the Euclidean norm of the final real residual for each RHS.
const rExt * get_ptr_normRHS() const
Returns an handle to the Euclidean norm of each RHS.

Protected Attributes

Name
bool Set_flag
flag for Set_Solver.
bool use_PrecRes
parameter to decide whether to use standard or preconditioned residual
int maxITER
maximum number of iterations.
double exitTOL
exit tolerance.
int initial_sol
flag to set the initial solution.
int restart
bool printConvProfile
flag for Convergence Profile printing.
DDMat * RES
residual array.
DDMat * SCR1
array for scratch 1.
int ITER
total number of iterations.
VEC_CPU< rExt > normRES0
euclidean norm of the initial residual.
VEC_CPU< rExt > normRESiter
euclidean norm of the final iterative residual.
VEC_CPU< rExt > normRESreal
euclidean norm of the final real residual.
VEC_CPU< rExt > normRHS
euclidean norm of the Right Hand Side.

Detailed Description

class LinSolver;

This class is used to manage the Linear Solver.

class LinSolver.

Public Functions Documentation

function ~LinSolver

virtual ~LinSolver() =0

Deletes the object.

function Set_Solver

virtual void Set_Solver(
    MatrixProd & MAT,
    DDMat & RHS,
    MatrixProd & PREC
) =0

Sets the solver for monolithic preconditioning.

Parameters:

  • MAT system matrix.
  • RHS Right Hand Sidde.
  • PREC preconditioner.

Reimplemented by: GMRES_CPU::Set_Solver, SQMR_CPU::Set_Solver, PCG_CPU::Set_Solver, BiCGstab_CPU::Set_Solver, BiCGstab::Set_Solver, PCG::Set_Solver, GMRES::Set_Solver, SQMR::Set_Solver

function Set_Solver

virtual void Set_Solver(
    MatrixProd & MAT,
    DDMat & RHS,
    MatrixProd & PREC_L,
    MatrixProd & PREC_R
) =0

Sets the solver for split preconditioning.

Parameters:

  • MAT system matrix.
  • RHS Right Hand Sidde.
  • PREC_L LEFT preconditioner.
  • PREC_R RIGHT preconditioner.

Reimplemented by: GMRES_CPU::Set_Solver, SQMR_CPU::Set_Solver, PCG_CPU::Set_Solver, BiCGstab_CPU::Set_Solver, BiCGstab::Set_Solver, PCG::Set_Solver, GMRES::Set_Solver, SQMR::Set_Solver

function Solve

virtual void Solve(
    MatrixProd & MAT,
    DDMat & RHS,
    DDMat & SOL,
    MatrixProd & PREC,
    const string *__restrict__ filename =nullptr
) =0

Solves the linear system with monolithic preconditioning.

Parameters:

  • MAT system matrix.
  • RHS system Right Hand Side.
  • SOL solution array.
  • PREC preconditioner.
  • filename file name where the convergence profile is printed (optional).

Reimplemented by: PCG::Solve, BiCGstab_CPU::Solve, SQMR::Solve, BiCGstab::Solve

function Solve

virtual void Solve(
    MatrixProd & MAT,
    DDMat & RHS,
    DDMat & SOL,
    MatrixProd & PREC_L,
    MatrixProd & PREC_R,
    const string *__restrict__ filename =nullptr
) =0

Solves the linear system with split preconditioning.

Parameters:

  • MAT system matrix.
  • RHS system Right Hand Side.
  • SOL solution array.
  • PREC_L LEFT preconditioner.
  • PREC_R RIGHT preconditioner.
  • filename file name where the convergence profile is printed (optional).

Reimplemented by: PCG::Solve, BiCGstab_CPU::Solve, SQMR::Solve, BiCGstab::Solve

function Set_use_PrecRes

void Set_use_PrecRes(
    const bool input_use_PrecRes
)

Sets the the use of preconditioned residual in controlling convergence.

function Set_maxITER

void Set_maxITER(
    const int input_maxITER
)

Sets the maximum number of iterations.

function Set_exitTOL

void Set_exitTOL(
    const double input_exitTOL
)

Sets the exit tolerance.

function Set_initial_sol

void Set_initial_sol(
    const int input_initial_sol
)

Sets the flag for initial solution.

function Set_printConvProfile

void Set_printConvProfile(
    const bool input_printConvProfile
)

Sets the flag for Convergence Profile printing.

function Set_restart

void Set_restart(
    int const input_restart
)

Sets the restart frequency.

function SetParms_from_XML

void SetParms_from_XML(
    xml_document & input_xml
)

Sets the parameters from the XML file.

function get_ITER

int get_ITER() const

Returns the number of iterations performed in previous solution.

function get_ptr_normRES0

const rExt * get_ptr_normRES0() const

Returns an handle to the Euclidean norm of the initial residual for each RHS.

function get_ptr_normRESiter

const rExt * get_ptr_normRESiter() const

Returns an handle to the Euclidean norm of the final iterative residual for each RHS.

function get_ptr_normRESreal

const rExt * get_ptr_normRESreal() const

Returns an handle to the Euclidean norm of the final real residual for each RHS.

function get_ptr_normRHS

const rExt * get_ptr_normRHS() const

Returns an handle to the Euclidean norm of each RHS.

Protected Attributes Documentation

variable Set_flag

bool Set_flag = false;

flag for Set_Solver.

variable use_PrecRes

bool use_PrecRes = false;

parameter to decide whether to use standard or preconditioned residual

variable maxITER

int maxITER;

maximum number of iterations.

variable exitTOL

double exitTOL;

exit tolerance.

variable initial_sol

int initial_sol;

flag to set the initial solution.

0 → initial solution not available : sol0 = Prec x rhs 1 → initial solution not available : sol0 = 0 2 → initial solution available : sol0 = input

variable restart

int restart;

@breif restart frequency (for GMRES)

variable printConvProfile

bool printConvProfile;

flag for Convergence Profile printing.

variable RES

DDMat * RES = nullptr;

residual array.

variable SCR1

DDMat * SCR1 = nullptr;

array for scratch 1.

variable ITER

int ITER = 0;

total number of iterations.

variable normRES0

VEC_CPU< rExt > normRES0;

euclidean norm of the initial residual.

variable normRESiter

VEC_CPU< rExt > normRESiter;

euclidean norm of the final iterative residual.

variable normRESreal

VEC_CPU< rExt > normRESreal;

euclidean norm of the final real residual.

variable normRHS

VEC_CPU< rExt > normRHS;

euclidean norm of the Right Hand Side.


Updated on 19 November 2024 at 10:20:48 CET