5#include <cgv/data/ref_ptr.h>
12class CGV_API sparse_les;
61 static const std::vector<sparse_les_factory_ptr>& get_solver_factories();
63 static sparse_les_ptr create_by_name(
const std::string& solver_name,
int n,
int nr_rhs,
int nr_nze = -1);
65 static sparse_les_ptr create_by_cap(SparseLesCaps caps,
int n,
int nr_rhs,
int nr_nze = -1);
72 virtual void set_b_entry(
int i,
double val);
76 virtual double& ref_b_entry(
int i);
81 virtual bool solve(
bool analyze_residual =
false) = 0;
85 virtual double get_x_entry(
int i)
const;
96 std::string solver_name;
100 solver_name(_solver_name), caps(_caps) {}
125#include <cgv/config/lib_end.h>
if you derive your class from this class, a ref_ptr will do reference counting in the inhereted ref_c...
reference counted pointer, which can work together with types that are derived from ref_counted,...
implementation of factory class for sparse linear system solvers
std::string get_solver_name() const
return the name of the solver
SparseLesCaps get_caps() const
return the supported capabilities of the solver
sparse_les_ptr create(int n, int nr_rhs, int nr_nze)
create an instance of the solver.
factory class for sparse linear system solvers
virtual SparseLesCaps get_caps() const =0
return the supported capabilities of the solver
virtual std::string get_solver_name() const =0
return the name of the solver
virtual sparse_les_ptr create(int n, int nr_rhs, int nr_nze=-1)=0
create an instance of the solver.
interface for implementations of solvers for sparse linear systems of the form A * x = b with a squar...
virtual void set_mat_entry(int r, int c, double val)=0
set entry in row r and column c in the sparse matrix A
virtual ~sparse_les()
virtual destructor since class is abstract
virtual bool solve(bool analyze_residual=false)=0
try to solve system - in case of success analyze residuals if demanded by the optional parameter
static void register_solver_factory(sparse_les_factory_ptr sls_fac)
register a factory for a new type of linear equation solver
virtual void set_b_entry(int i, int j, double val)=0
set i-th entry in the j-th right hand side
virtual double get_x_entry(int i, int j) const =0
return the i-th component of the j-th solution vector
virtual double & ref_b_entry(int i, int j)=0
set i-th entry in j-th right hand side
helper template to register a sparse les solver