openCARP
Doxygen code documentation for the open cardiac electrophysiology simulator openCARP
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | List of all members
SF::abstract_linear_solver< T, S > Struct Template Referenceabstract

#include <SF_abstract_lin_solver.h>

Collaboration diagram for SF::abstract_linear_solver< T, S >:

Public Types

enum  norm_t {
  absPreResidual, absUnpreResidual, relResidual, absPreRelResidual,
  norm_unset
}
 

Public Member Functions

virtual void operator() (abstract_vector< T, S > &x, const abstract_vector< T, S > &b)=0
 
virtual ~abstract_linear_solver ()=default
 
virtual void setup_solver (abstract_matrix< T, S > &mat, double tol, int max_it, short norm, std::string name, bool has_nullspace, void *logger, const char *solver_opts_file, const char *default_opts)=0
 

Public Attributes

std::string name
 the solver name More...
 
const char * options_file
 the file containing the solver options More...
 
norm_t norm = norm_unset
 
double final_residual = -1.0
 Holds the residual after convergence. More...
 
int niter = -1
 number of iterations More...
 
int max_it = 0
 max number of iterations More...
 
int reason = 0
 number of iterations More...
 
double time = 0.0
 solver runtime More...
 

Protected Member Functions

virtual void set_stopping_criterion (norm_t normtype, double tol, int max_it, bool verbose, void *logger)=0
 
norm_t convert_param_norm_type (short param_norm_type) const
 

Detailed Description

template<class T, class S>
struct SF::abstract_linear_solver< T, S >

Simple struct holding informations and operations related to linear solvers.

Template Parameters
TInteger type (indices).
SFloating point type (values).
See also
ginkgo_solver
petsc_solver
Note
The initialization of solvers varies hugely, so we provide a generic setup function containing redundant information for some solvers.

Definition at line 40 of file SF_abstract_lin_solver.h.

Member Enumeration Documentation

◆ norm_t

template<class T, class S>
enum SF::abstract_linear_solver::norm_t

Enum representing the residual norm stopping criterion type.

Enumerator
absPreResidual 
absUnpreResidual 
relResidual 
absPreRelResidual 
norm_unset 

Definition at line 46 of file SF_abstract_lin_solver.h.

Constructor & Destructor Documentation

◆ ~abstract_linear_solver()

template<class T, class S>
virtual SF::abstract_linear_solver< T, S >::~abstract_linear_solver ( )
virtualdefault

Default destructor.

Member Function Documentation

◆ convert_param_norm_type()

template<class T, class S>
norm_t SF::abstract_linear_solver< T, S >::convert_param_norm_type ( short  param_norm_type) const
inlineprotected

Simple helper function converting a short (number) to norm_t

Parameters
param_norm_typea short number representing the norm type
Returns
the norm type as a norm_t enum

Definition at line 104 of file SF_abstract_lin_solver.h.

◆ operator()()

template<class T, class S>
virtual void SF::abstract_linear_solver< T, S >::operator() ( abstract_vector< T, S > &  x,
const abstract_vector< T, S > &  b 
)
pure virtual

Solve the system Ax=b.

Parameters
xThe solution vector
bThe right hand side

◆ set_stopping_criterion()

template<class T, class S>
virtual void SF::abstract_linear_solver< T, S >::set_stopping_criterion ( norm_t  normtype,
double  tol,
int  max_it,
bool  verbose,
void *  logger 
)
protectedpure virtual

Set the stopping criterion parameters for the solver.

Parameters
normtypeThe type of residual norm.
tolThe tolerance to which the solver should converge.
mat_itThe maximum number of iterations for the solver.
verboseWhether to print detailed informations.
loggerA generic pointer to the logger object.

◆ setup_solver()

template<class T, class S>
virtual void SF::abstract_linear_solver< T, S >::setup_solver ( abstract_matrix< T, S > &  mat,
double  tol,
int  max_it,
short  norm,
std::string  name,
bool  has_nullspace,
void *  logger,
const char *  solver_opts_file,
const char *  default_opts 
)
pure virtual

Setup the solver characteristics.

Parameters
matThe system matrix.
tolThe tolerance to which the solver should converge.
mat_itThe maximum number of iterations for the solver.
nameThe solver name.
has_nullspaceWhether there is a constant nullspace or not.
loggerA generic pointer to the logger object.
default_optsA string representing default PETSc options. Used by petsc only.

Member Data Documentation

◆ final_residual

template<class T, class S>
double SF::abstract_linear_solver< T, S >::final_residual = -1.0

Holds the residual after convergence.

Definition at line 50 of file SF_abstract_lin_solver.h.

◆ max_it

template<class T, class S>
int SF::abstract_linear_solver< T, S >::max_it = 0

max number of iterations

Definition at line 52 of file SF_abstract_lin_solver.h.

◆ name

template<class T, class S>
std::string SF::abstract_linear_solver< T, S >::name

the solver name

Definition at line 42 of file SF_abstract_lin_solver.h.

◆ niter

template<class T, class S>
int SF::abstract_linear_solver< T, S >::niter = -1

number of iterations

Definition at line 51 of file SF_abstract_lin_solver.h.

◆ norm

template<class T, class S>
norm_t SF::abstract_linear_solver< T, S >::norm = norm_unset

Definition at line 47 of file SF_abstract_lin_solver.h.

◆ options_file

template<class T, class S>
const char* SF::abstract_linear_solver< T, S >::options_file

the file containing the solver options

Definition at line 43 of file SF_abstract_lin_solver.h.

◆ reason

template<class T, class S>
int SF::abstract_linear_solver< T, S >::reason = 0

number of iterations

Definition at line 53 of file SF_abstract_lin_solver.h.

◆ time

template<class T, class S>
double SF::abstract_linear_solver< T, S >::time = 0.0

solver runtime

Definition at line 54 of file SF_abstract_lin_solver.h.


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