PetIBM 0.5.4
Toolbox and applications of the immersed-boundary method for distributed-memory architectures
petibm::linsolver::LinSolverAmgX Class Reference

Iterative solver using wrapper of AmgX. More...

#include <linsolveramgx.h>

Inheritance diagram for petibm::linsolver::LinSolverAmgX:
[legend]

Public Member Functions

 LinSolverAmgX (const std::string &solverName, const std::string &file)
 Constructor. More...
 
virtual ~LinSolverAmgX ()
 Default destructor. More...
 
virtual PetscErrorCode destroy ()
 Manually destroy the data in the current instance. More...
 
virtual PetscErrorCode setMatrix (const Mat &A)
 Set the coefficient matrix of the linear system. More...
 
virtual PetscErrorCode solve (Vec &x, Vec &b)
 Solve the linear system. More...
 
virtual PetscErrorCode getIters (PetscInt &iters)
 Get the number of iterations of the solver. More...
 
virtual PetscErrorCode getResidual (PetscReal &res)
 Get the final residual of the solver. More...
 
PetscErrorCode printInfo () const
 Print information to standard output. More...
 
PetscErrorCode getType (std::string &_type) const
 Get the type of this instance. More...
 

Protected Member Functions

virtual PetscErrorCode init ()
 Private initialization function. More...
 

Protected Attributes

AmgXSolver amgx
 the underlying AmgX wrapper solver. More...
 
std::string name
 Name of the linear solver. More...
 
std::string config
 Path of the solver configuration file to read. More...
 
std::string type
 Type of the linear solver. More...
 

Detailed Description

Iterative solver using wrapper of AmgX.

This class holds a AmgXSolver from AmgXWrapper package. Users must enable AmgX and AmgXWrapper when building PetIBM in order to use this class.

See also
petibm::type::LinSolver, petibm::linsolver::createLinSolver.

Definition at line 28 of file linsolveramgx.h.

Constructor & Destructor Documentation

◆ LinSolverAmgX()

petibm::linsolver::LinSolverAmgX::LinSolverAmgX ( const std::string &  solverName,
const std::string &  file 
)

Constructor.

Parameters
solverName[in] Name of the solver.
file[in] Path of the configuration file for the solver.

Definition at line 20 of file linsolveramgx.cpp.

◆ ~LinSolverAmgX()

petibm::linsolver::LinSolverAmgX::~LinSolverAmgX ( )
virtual

Default destructor.

Definition at line 28 of file linsolveramgx.cpp.

Member Function Documentation

◆ destroy()

PetscErrorCode petibm::linsolver::LinSolverAmgX::destroy ( )
virtual

Manually destroy the data in the current instance.

Reimplemented from petibm::linsolver::LinSolverBase.

Definition at line 41 of file linsolveramgx.cpp.

◆ getIters()

PetscErrorCode petibm::linsolver::LinSolverAmgX::getIters ( PetscInt &  iters)
virtual

Get the number of iterations of the solver.

Parameters
iters[out] Number of iterations.

Implements petibm::linsolver::LinSolverBase.

Definition at line 102 of file linsolveramgx.cpp.

◆ getResidual()

PetscErrorCode petibm::linsolver::LinSolverAmgX::getResidual ( PetscReal &  res)
virtual

Get the final residual of the solver.

Parameters
res[out] Residual.

Implements petibm::linsolver::LinSolverBase.

Definition at line 114 of file linsolveramgx.cpp.

◆ getType()

PetscErrorCode petibm::linsolver::LinSolverBase::getType ( std::string &  _type) const
inherited

Get the type of this instance.

Parameters
_type[out] String representing the type.

Possible returns for _type are NVIDIA AmgX or PETSc KSP.

Definition at line 49 of file linsolver.cpp.

◆ init()

PetscErrorCode petibm::linsolver::LinSolverAmgX::init ( )
protectedvirtual

Private initialization function.

The design of linear solver classes is that only the factory function can initialize the instances, and it doesn't allow user to declare instance first and initialize the instance later. So it seems not necessary to make initialization function public.

Implements petibm::linsolver::LinSolverBase.

Definition at line 54 of file linsolveramgx.cpp.

◆ printInfo()

PetscErrorCode petibm::linsolver::LinSolverBase::printInfo ( ) const
inherited

Print information to standard output.

Definition at line 29 of file linsolver.cpp.

◆ setMatrix()

PetscErrorCode petibm::linsolver::LinSolverAmgX::setMatrix ( const Mat &  A)
virtual

Set the coefficient matrix of the linear system.

Parameters
A[in] Coefficient matrix.

Implements petibm::linsolver::LinSolverBase.

Definition at line 78 of file linsolveramgx.cpp.

◆ solve()

PetscErrorCode petibm::linsolver::LinSolverAmgX::solve ( Vec &  x,
Vec &  b 
)
virtual

Solve the linear system.

Parameters
x[in, out] Vector of unknowns.
b[in] Right-hand side of the linear system.

Implements petibm::linsolver::LinSolverBase.

Definition at line 90 of file linsolveramgx.cpp.

Member Data Documentation

◆ amgx

AmgXSolver petibm::linsolver::LinSolverAmgX::amgx
protected

the underlying AmgX wrapper solver.

Definition at line 54 of file linsolveramgx.h.

◆ config

std::string petibm::linsolver::LinSolverBase::config
protectedinherited

Path of the solver configuration file to read.

Definition at line 132 of file linsolver.h.

◆ name

std::string petibm::linsolver::LinSolverBase::name
protectedinherited

Name of the linear solver.

The name should match the prefix used for to configure the solver from the command line or from a configuration file. For example, if the name is "velocity", the prefix should be "_velocity".

Definition at line 129 of file linsolver.h.

◆ type

std::string petibm::linsolver::LinSolverBase::type
protectedinherited

Type of the linear solver.

Definition at line 135 of file linsolver.h.


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