Template Class LinearSolver
Defined in File LinearSolver.hpp
Inheritance Relationships
Derived Type
public GridKit::LinearAlgebra::ResolveSystemSolver< ScalarT, IdxT >(Template Class ResolveSystemSolver)
Class Documentation
-
template<class ScalarT, typename IdxT>
class LinearSolver Interface for linear solvers used by GridKit integrators, including Rosenbrock.
Subclassed by GridKit::LinearAlgebra::ResolveSystemSolver< ScalarT, IdxT >
Public Functions
-
virtual int configureSolver(GridKit::LinearAlgebra::CsrMatrix<RealT, IdxT> &matrix) = 0
Configure the solver by analyzing the given matrix. The sparsity pattern of the given matrix must be set, and future calls to other methods will use this sparsity pattern, as well as the data pointer of the given matrix.
- Parameters:
matrix – The matrix to configure the solver with.
- Returns:
int An error code, or 0 if none.
-
virtual int setupSolver(bool reuse_factors = false) = 0
Setup the solver with matrix data.
- Parameters:
reuse_factors – If true, factors from a previous call to
setupSolver()are reused.- Pre:
configureSolver() must be called first and every time the sparsity pattern of the matrix changes.
- Pre:
If
reuse_factorsis true, thensetupSolvermust have been called once before with the same sparsity pattern.- Returns:
int An error code, or 0 if none.
-
virtual int solve(GridKit::LinearAlgebra::Vector<ScalarT, IdxT> &rhs, GridKit::LinearAlgebra::Vector<ScalarT, IdxT> &lhs) = 0
Perform a linear solve using the configured matrix.
- Todo:
The data of the
rhsparameter doesn’t change, but we can’t mark as cosntant because ReSolve currently requires a non-constpointer for vectors, even if it will only read from that vector. In the future this might change, so this can be updated to beconst.
- Parameters:
rhs – The right-hand-side vector (input). No data is changed.
lhs – The left-hand-side vector (output).
- Pre:
setupSolver must be called first and every time the data of the matrix changes.
- Returns:
int An error code, or 0 if none.
-
virtual int configureSolver(GridKit::LinearAlgebra::CsrMatrix<RealT, IdxT> &matrix) = 0