WarpX
Loading...
Searching...
No Matches
Preconditioner< T, Ops > Class Template Referenceabstract

Base class for preconditioners. More...

#include <Preconditioner.H>

Inheritance diagram for Preconditioner< T, Ops >:
CurlCurlMLMGPC< T, Ops > JacobiPC< T, Ops > MatrixPC< T, Ops >

Public Types

using RT = typename T::value_type
 

Public Member Functions

 Preconditioner ()=default
 Default constructor.
 
virtual ~Preconditioner ()=default
 Default destructor.
 
 Preconditioner (const Preconditioner &)=default
 
Preconditioneroperator= (const Preconditioner &)=default
 
 Preconditioner (Preconditioner &&) noexcept=default
 
Preconditioneroperator= (Preconditioner &&) noexcept=default
 
virtual void Define (const T &, Ops *const)=0
 Define the preconditioner.
 
virtual void Update (const T &a_U)=0
 Update the preconditioner.
 
virtual void Apply (T &a_x, const T &a_b)=0
 Apply (solve) the preconditioner given a RHS.
 
virtual void getPCMatrix (amrex::Gpu::DeviceVector< int > &, amrex::Gpu::DeviceVector< int > &, amrex::Gpu::DeviceVector< int > &, amrex::Gpu::DeviceVector< RT > &, int &, int &)
 Get the sparse matrix form of the preconditioner.
 
virtual bool IsDefined () const =0
 Check if the nonlinear solver has been defined.
 
virtual void setName (const std::string &)
 Set the name for screen output and parsing inputs.
 
virtual void printParameters () const
 Print parameters.
 
void CurTime (const RT a_time)
 Set the current time.
 
void CurTimeStep (const RT a_dt)
 Set the current time step size.
 

Protected Attributes

RT m_time = 0.0
 
RT m_dt = 0.0
 

Detailed Description

template<class T, class Ops>
class Preconditioner< T, Ops >

Base class for preconditioners.

This class is templated on a solution-type class T and an operator class Ops.

The Ops class must have the following function: (this will depend on the specific preconditioners inheriting from this class)

The T class must have the following functions: (this will depend on the specific preconditioners inheriting from this class)

Member Typedef Documentation

◆ RT

template<class T, class Ops>
using Preconditioner< T, Ops >::RT = typename T::value_type

Constructor & Destructor Documentation

◆ Preconditioner() [1/3]

template<class T, class Ops>
Preconditioner< T, Ops >::Preconditioner ( )
default

Default constructor.

◆ ~Preconditioner()

template<class T, class Ops>
virtual Preconditioner< T, Ops >::~Preconditioner ( )
virtualdefault

Default destructor.

◆ Preconditioner() [2/3]

template<class T, class Ops>
Preconditioner< T, Ops >::Preconditioner ( const Preconditioner< T, Ops > & )
default

◆ Preconditioner() [3/3]

template<class T, class Ops>
Preconditioner< T, Ops >::Preconditioner ( Preconditioner< T, Ops > && )
defaultnoexcept

Member Function Documentation

◆ Apply()

template<class T, class Ops>
virtual void Preconditioner< T, Ops >::Apply ( T & a_x,
const T & a_b )
pure virtual

Apply (solve) the preconditioner given a RHS.

Given a right-hand-side b, solve: A x = b where A is a linear operator.

Implemented in CurlCurlMLMGPC< T, Ops >, JacobiPC< T, Ops >, and MatrixPC< T, Ops >.

◆ CurTime()

template<class T, class Ops>
void Preconditioner< T, Ops >::CurTime ( const RT a_time)
inline

Set the current time.

◆ CurTimeStep()

template<class T, class Ops>
void Preconditioner< T, Ops >::CurTimeStep ( const RT a_dt)
inline

Set the current time step size.

◆ Define()

template<class T, class Ops>
virtual void Preconditioner< T, Ops >::Define ( const T & ,
Ops * const  )
pure virtual

Define the preconditioner.

Implemented in CurlCurlMLMGPC< T, Ops >, JacobiPC< T, Ops >, and MatrixPC< T, Ops >.

◆ getPCMatrix()

template<class T, class Ops>
virtual void Preconditioner< T, Ops >::getPCMatrix ( amrex::Gpu::DeviceVector< int > & ,
amrex::Gpu::DeviceVector< int > & ,
amrex::Gpu::DeviceVector< int > & ,
amrex::Gpu::DeviceVector< RT > & ,
int & ,
int &  )
inlinevirtual

Get the sparse matrix form of the preconditioner.

If the preconditioner is based on constructing and solving the sparse matrix form, this function will return the sparse matrix form. Base class implementation aborts with an error message to ensure this function is not called for operator-form preconditioners

Reimplemented in MatrixPC< T, Ops >.

◆ IsDefined()

template<class T, class Ops>
virtual bool Preconditioner< T, Ops >::IsDefined ( ) const
nodiscardpure virtual

Check if the nonlinear solver has been defined.

Implemented in CurlCurlMLMGPC< T, Ops >, JacobiPC< T, Ops >, and MatrixPC< T, Ops >.

◆ operator=() [1/2]

template<class T, class Ops>
Preconditioner & Preconditioner< T, Ops >::operator= ( const Preconditioner< T, Ops > & )
default

◆ operator=() [2/2]

template<class T, class Ops>
Preconditioner & Preconditioner< T, Ops >::operator= ( Preconditioner< T, Ops > && )
defaultnoexcept

◆ printParameters()

template<class T, class Ops>
virtual void Preconditioner< T, Ops >::printParameters ( ) const
inlinevirtual

Print parameters.

Reimplemented in CurlCurlMLMGPC< T, Ops >, JacobiPC< T, Ops >, and MatrixPC< T, Ops >.

◆ setName()

template<class T, class Ops>
virtual void Preconditioner< T, Ops >::setName ( const std::string & )
inlinevirtual

Set the name for screen output and parsing inputs.

Reimplemented in MatrixPC< T, Ops >.

◆ Update()

template<class T, class Ops>
virtual void Preconditioner< T, Ops >::Update ( const T & a_U)
pure virtual

Update the preconditioner.

Implemented in CurlCurlMLMGPC< T, Ops >, JacobiPC< T, Ops >, and MatrixPC< T, Ops >.

Member Data Documentation

◆ m_dt

template<class T, class Ops>
RT Preconditioner< T, Ops >::m_dt = 0.0
protected

◆ m_time

template<class T, class Ops>
RT Preconditioner< T, Ops >::m_time = 0.0
protected

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