Base interface for linear solvers.
This interface define the generic API that linear solvers in Caribou must provide.
#include <LinearSolver.h>

virtual sofa::defaulttype::BaseMatrix *  create_new_matrix (unsigned int rows, unsigned int cols) const =0 
 Creates a new BaseMatrix of size rows x cols. More...


virtual sofa::defaulttype::BaseVector *  create_new_vector (unsigned int n) const =0 
 Creates a new BaseVector of size n. More...


virtual bool  solve (const sofa::defaulttype::BaseMatrix *A, const sofa::defaulttype::BaseVector *F, sofa::defaulttype::BaseVector *X) const =0 
 Solve the linear system A [X] = F. More...


◆ create_new_matrix()
virtual sofa::defaulttype::BaseMatrix* SofaCaribou::solver::LinearSolver::create_new_matrix 
( 
unsigned int 
rows, 


unsigned int 
cols 

) 
 const 

pure virtual 
Creates a new BaseMatrix of size rows x cols.
This will be used by the ODE to create system matrices (A = mM + bB + kK). Since it is up to the linear solver to use its matrix format (sparse, full, block, etc.), it must have an API to allow other components to create a compatible matrix that will later be used by this same linear solver.
 Parameters

rows  Number of rows of the matrix. 
cols  Number of columns of the matrix. 
 Returns
 A pointer to the newly created matrix.
 Note
 Important: The caller of this function (for example, the ODE component) is responsible to free the memory of this newly created matrix.
◆ create_new_vector()
virtual sofa::defaulttype::BaseVector* SofaCaribou::solver::LinearSolver::create_new_vector 
( 
unsigned int 
n  ) 
const 

pure virtual 
Creates a new BaseVector of size n.
This will be used by the ODE to create system vectors (both the lefthand side solution vector, and the right hand side force vector). Since it is up to the linear solver to use its vector format (sparse, full, block, etc.), it must have an API to allow other components to create a compatible vector that will later be used by this same linear solver.
 Parameters

n  The number of scalar stored inside this vector. 
 Returns
 A pointer to the newly created vector
 Note
 Important: The caller of this function (for example, the ODE component) is responsible to free the memory of this newly created vector.
◆ solve()
virtual bool SofaCaribou::solver::LinearSolver::solve 
( 
const sofa::defaulttype::BaseMatrix * 
A, 


const sofa::defaulttype::BaseVector * 
F, 


sofa::defaulttype::BaseVector * 
X 

) 
 const 

pure virtual 
Solve the linear system A [X] = F.
 Parameters

A  The assembled system matrix. 
F  The righthand side (RHS) vector. 
X  The lefthand side (LHS) solution vector. 
 Returns
 True when the system has been successfully solved, false otherwise.
 Note
 The system matrix and vectors are guaranteed to be of the same virtual type as the one returned by create_new_matrix() and create_new_vector, respectively, since it is these methods that created them in the first place.
The documentation for this class was generated from the following file: