WarpX
Loading...
Searching...
No Matches
LinearSolver< Vec, Ops > Class Template Referenceabstract

Top-level class for the linear solver. More...

#include <LinearSolver.H>

Inheritance diagram for LinearSolver< Vec, Ops >:
AMReXGMRES< Vec, Ops >

Public Types

using RT = typename Ops::RT
 

Public Member Functions

 LinearSolver ()=default
 
virtual ~LinearSolver ()=default
 
 LinearSolver (const LinearSolver &)=delete
 
LinearSolveroperator= (const LinearSolver &)=delete
 
 LinearSolver (LinearSolver &&) noexcept=delete
 
LinearSolveroperator= (LinearSolver &&) noexcept=delete
 
virtual void define (Ops &linop)=0
 
virtual void solve (Vec &a_sol, Vec const &a_rhs, RT a_tol_rel, RT a_tol_abs, int a_its=-1)=0
 Solve the linear system.
 
virtual void setVerbose (int v)=0
 Sets verbosity.
 
virtual void setRestartLength (int rl)
 
virtual void setMaxIters (int niters)=0
 Sets the max number of iterations.
 
virtual int getNumIters () const =0
 Gets the number of iterations.
 
virtual int getStatus () const =0
 Gets the solver status.
 
virtual RT getResidualNorm () const =0
 Gets the 2-norm of the residual.
 

Detailed Description

template<typename Vec, typename Ops>
class LinearSolver< Vec, Ops >

Top-level class for the linear solver.

This class is templated on a vector class Vec, and an operator class Ops.

The Ops class must have the following function: ComputeRHS( R_vec, U_vec, time, nl_iter, from_jacobian ), where U_vec and R_vec are of type Vec.

The Vec class must have basic math operators, such as Copy, +=, -=, increment(), linComb(), scale(), etc.. See WarpXSolverVec.H for an example.

Member Typedef Documentation

◆ RT

template<typename Vec, typename Ops>
using LinearSolver< Vec, Ops >::RT = typename Ops::RT

Constructor & Destructor Documentation

◆ LinearSolver() [1/3]

template<typename Vec, typename Ops>
LinearSolver< Vec, Ops >::LinearSolver ( )
default

◆ ~LinearSolver()

template<typename Vec, typename Ops>
virtual LinearSolver< Vec, Ops >::~LinearSolver ( )
virtualdefault

◆ LinearSolver() [2/3]

template<typename Vec, typename Ops>
LinearSolver< Vec, Ops >::LinearSolver ( const LinearSolver< Vec, Ops > & )
delete

◆ LinearSolver() [3/3]

template<typename Vec, typename Ops>
LinearSolver< Vec, Ops >::LinearSolver ( LinearSolver< Vec, Ops > && )
deletenoexcept

Member Function Documentation

◆ define()

template<typename Vec, typename Ops>
virtual void LinearSolver< Vec, Ops >::define ( Ops & linop)
pure virtual

Defines with a reference to Ops. It's the user's responsibility to keep the Ops object alive for linear solver to be functional. This function must be called before solve() can be called.

Implemented in AMReXGMRES< Vec, Ops >.

◆ getNumIters()

template<typename Vec, typename Ops>
virtual int LinearSolver< Vec, Ops >::getNumIters ( ) const
pure virtual

Gets the number of iterations.

Implemented in AMReXGMRES< Vec, Ops >.

◆ getResidualNorm()

template<typename Vec, typename Ops>
virtual RT LinearSolver< Vec, Ops >::getResidualNorm ( ) const
pure virtual

Gets the 2-norm of the residual.

Implemented in AMReXGMRES< Vec, Ops >.

◆ getStatus()

template<typename Vec, typename Ops>
virtual int LinearSolver< Vec, Ops >::getStatus ( ) const
pure virtual

Gets the solver status.

Implemented in AMReXGMRES< Vec, Ops >.

◆ operator=() [1/2]

template<typename Vec, typename Ops>
LinearSolver & LinearSolver< Vec, Ops >::operator= ( const LinearSolver< Vec, Ops > & )
delete

◆ operator=() [2/2]

template<typename Vec, typename Ops>
LinearSolver & LinearSolver< Vec, Ops >::operator= ( LinearSolver< Vec, Ops > && )
deletenoexcept

◆ setMaxIters()

template<typename Vec, typename Ops>
virtual void LinearSolver< Vec, Ops >::setMaxIters ( int niters)
pure virtual

Sets the max number of iterations.

Implemented in AMReXGMRES< Vec, Ops >.

◆ setRestartLength()

template<typename Vec, typename Ops>
virtual void LinearSolver< Vec, Ops >::setRestartLength ( int rl)
inlinevirtual

Sets restart length for GMRES-like solvers. Base implementation provided for solvers that don't need this.

Reimplemented in AMReXGMRES< Vec, Ops >.

◆ setVerbose()

template<typename Vec, typename Ops>
virtual void LinearSolver< Vec, Ops >::setVerbose ( int v)
pure virtual

Sets verbosity.

Implemented in AMReXGMRES< Vec, Ops >.

◆ solve()

template<typename Vec, typename Ops>
virtual void LinearSolver< Vec, Ops >::solve ( Vec & a_sol,
Vec const & a_rhs,
RT a_tol_rel,
RT a_tol_abs,
int a_its = -1 )
pure virtual

Solve the linear system.

Parameters
a_solunknowns, i.e., x in A x = b.
a_rhsRHS, i.e., b in A x = b.
a_tol_relrelative tolerance.
a_tol_absabsolute tolerance.
a_itsoptional argument specifying the maximum number of iterations.

Implemented in AMReXGMRES< Vec, Ops >.


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