PTEMS  0.1.0-dev+git.81fd0e4
PolyTopic Element Method Solver
ptems::LinearSolver< T, Ref, ConstRef > Struct Template Referenceabstract

Base type for a linear solver, allowing the underlying matrix to be sparse. More...

#include <ptems/linearsolver.hpp>

Inheritance diagram for ptems::LinearSolver< T, Ref, ConstRef >:

Public Types

typedef T value_type
 Defines the type of a matrix entry in the linear system. More...
 
typedef Ref reference
 Defines the type of a reference to a matrix entry in the linear system. More...
 
typedef ConstRef const_reference
 Defines the type of a const reference to a matrix entry in the linear system. More...
 
typedef std::optional< typename detail::ReferenceWrapper< reference >::type > optional_reference
 Defines the type of a reference to a matrix entry in the linear system. More...
 
typedef std::optional< typename detail::ReferenceWrapper< const_reference >::type > optional_const_reference
 Defines the type of a const reference to a matrix entry in the linear system. More...
 

Public Member Functions

virtual bool DistributedConstruction () const =0
 Gets if the matrix and right hand side should be constructed distributed (for MPI) More...
 
virtual optional_reference Entry (std::size_t i, std::size_t j)=0
 Gets a reference to the specified matrix entry. More...
 
virtual optional_const_reference Entry (std::size_t i, std::size_t j) const =0
 Gets a const reference to the specified matrix entry. More...
 
virtual void Clear ()=0
 Clear the matrix of the linear system. More...
 
virtual std::size_t size () const =0
 Gets the size of the linear system. More...
 
virtual std::vector< T > Solve (const std::vector< T > &rhs, std::size_t offsetRHS=0, std::size_t lenRHS=-1)=0
 Solves the linear system with the specified right-hand side. More...
 
virtual reference operator() (std::size_t i, std::size_t j)
 Gets a reference to the specified matrix entry. More...
 
virtual const_reference operator() (std::size_t i, std::size_t j) const
 Gets a const reference to the specified matrix entry. More...
 
virtual std::vector< T > operator() (const std::vector< T > &rhs, std::size_t offsetRHS=0, std::size_t lenRHS=-1)
 Solves the linear system with the specified right-hand side. More...
 

Detailed Description

template<typename T, typename Ref = T&, typename ConstRef = const T&>
struct ptems::LinearSolver< T, Ref, ConstRef >

Base type for a linear solver, allowing the underlying matrix to be sparse.

May only represent PART of the linear system if the underlying linear system supports distributed construction.

Template Parameters
TThe type of the matrix entries
RefThe type of a reference to the matrix entries (can be proxy object)
ConstRefThe type of a const reference to the matrix entries (can be proxy object)

Member Typedef Documentation

◆ const_reference

template<typename T , typename Ref = T&, typename ConstRef = const T&>
typedef ConstRef ptems::LinearSolver< T, Ref, ConstRef >::const_reference

Defines the type of a const reference to a matrix entry in the linear system.

Can be a proxy object in some cases.

◆ optional_const_reference

template<typename T , typename Ref = T&, typename ConstRef = const T&>
typedef std::optional<typename detail::ReferenceWrapper<const_reference>::type> ptems::LinearSolver< T, Ref, ConstRef >::optional_const_reference

Defines the type of a const reference to a matrix entry in the linear system.

Can be a proxy object in some cases.

◆ optional_reference

template<typename T , typename Ref = T&, typename ConstRef = const T&>
typedef std::optional<typename detail::ReferenceWrapper<reference>::type> ptems::LinearSolver< T, Ref, ConstRef >::optional_reference

Defines the type of a reference to a matrix entry in the linear system.

Can be a proxy object in some cases.

◆ reference

template<typename T , typename Ref = T&, typename ConstRef = const T&>
typedef Ref ptems::LinearSolver< T, Ref, ConstRef >::reference

Defines the type of a reference to a matrix entry in the linear system.

Can be a proxy object in some cases.

◆ value_type

template<typename T , typename Ref = T&, typename ConstRef = const T&>
typedef T ptems::LinearSolver< T, Ref, ConstRef >::value_type

Defines the type of a matrix entry in the linear system.

Member Function Documentation

◆ Clear()

template<typename T , typename Ref = T&, typename ConstRef = const T&>
virtual void ptems::LinearSolver< T, Ref, ConstRef >::Clear ( )
pure virtual

Clear the matrix of the linear system.

Implemented in ptems::MumpsSolver< T >, and ptems::GMRESSolver< T >.

◆ DistributedConstruction()

template<typename T , typename Ref = T&, typename ConstRef = const T&>
virtual bool ptems::LinearSolver< T, Ref, ConstRef >::DistributedConstruction ( ) const
pure virtual

Gets if the matrix and right hand side should be constructed distributed (for MPI)

Returns
true yo distribute construction across processes, false otherwise

Implemented in ptems::MumpsSolver< T >, and ptems::GMRESSolver< T >.

◆ Entry() [1/2]

template<typename T , typename Ref = T&, typename ConstRef = const T&>
virtual optional_const_reference ptems::LinearSolver< T, Ref, ConstRef >::Entry ( std::size_t  i,
std::size_t  j 
) const
pure virtual

Gets a const reference to the specified matrix entry.

Exceptions
std::out_of_rangeIf the row or column index are not less than the linear system size
Parameters
iThe row index
jThe column index
Returns
A const reference to the element if its a non-zero entry, or an empty optional if the entry is a zero entry in the sparse matrix

Implemented in ptems::MumpsSolver< T >, and ptems::GMRESSolver< T >.

◆ Entry() [2/2]

template<typename T , typename Ref = T&, typename ConstRef = const T&>
virtual optional_reference ptems::LinearSolver< T, Ref, ConstRef >::Entry ( std::size_t  i,
std::size_t  j 
)
pure virtual

Gets a reference to the specified matrix entry.

Exceptions
std::out_of_rangeIf the row or column index are not less than the linear system size
Parameters
iThe row index
jThe column index
Returns
A reference to the element if its a non-zero entry, or an empty optional if the entry is a zero entry in the sparse matrix

Implemented in ptems::MumpsSolver< T >, and ptems::GMRESSolver< T >.

◆ operator()() [1/3]

template<typename T , typename Ref = T&, typename ConstRef = const T&>
virtual std::vector<T> ptems::LinearSolver< T, Ref, ConstRef >::operator() ( const std::vector< T > &  rhs,
std::size_t  offsetRHS = 0,
std::size_t  lenRHS = -1 
)
inlinevirtual

Solves the linear system with the specified right-hand side.

Parameters
rhsThe right hand side vector
offsetRHSIf using distributed matrix/rhs construction specifies the offset to the start of the right hand side vector populated by this process
lenRHSIf using distributed matrix/rhs construction specifies the length of the right hand side vector populated by this process (or greater than size() for all)
Returns
std::vector<T>

◆ operator()() [2/3]

template<typename T , typename Ref = T&, typename ConstRef = const T&>
virtual reference ptems::LinearSolver< T, Ref, ConstRef >::operator() ( std::size_t  i,
std::size_t  j 
)
inlinevirtual

Gets a reference to the specified matrix entry.

Exceptions
std::out_of_rangeIf the row or column index are not less than the linear system size
std::invalid_argumentIf the entry is not a non-zero entry of the sparse matrix
Parameters
iThe row index
jThe column index
Returns
A reference to the element if its a non-zero entry

◆ operator()() [3/3]

template<typename T , typename Ref = T&, typename ConstRef = const T&>
virtual const_reference ptems::LinearSolver< T, Ref, ConstRef >::operator() ( std::size_t  i,
std::size_t  j 
) const
inlinevirtual

Gets a const reference to the specified matrix entry.

Exceptions
std::out_of_rangeIf the row or column index are not less than the linear system size
std::invalid_argumentIf the entry is not a non-zero entry of the sparse matrix
Parameters
iThe row index
jThe column index
Returns
A const reference to the element if its a non-zero entry

◆ size()

template<typename T , typename Ref = T&, typename ConstRef = const T&>
virtual std::size_t ptems::LinearSolver< T, Ref, ConstRef >::size ( ) const
pure virtual

Gets the size of the linear system.

Returns
The number of rows and columns in the sparse matrix

Implemented in ptems::MumpsSolver< T >, and ptems::GMRESSolver< T >.

◆ Solve()

template<typename T , typename Ref = T&, typename ConstRef = const T&>
virtual std::vector<T> ptems::LinearSolver< T, Ref, ConstRef >::Solve ( const std::vector< T > &  rhs,
std::size_t  offsetRHS = 0,
std::size_t  lenRHS = -1 
)
pure virtual

Solves the linear system with the specified right-hand side.

Parameters
rhsThe right hand side vector
offsetRHSIf using distributed matrix/rhs construction specifies the offset to the start of the right hand side vector populated by this process
lenRHSIf using distributed matrix/rhs construction specifies the length of the right hand side vector populated by this process (or greater than size() for all)
Returns
std::vector<T>

Implemented in ptems::MumpsSolver< T >, and ptems::GMRESSolver< T >.


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