Skip to content

Commit

Permalink
..
Browse files Browse the repository at this point in the history
  • Loading branch information
dweindl committed Sep 30, 2024
1 parent 0870ba3 commit 8eb0a9c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
4 changes: 2 additions & 2 deletions include/amici/sundials_linsol_wrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ class SUNLinSolWrapper {
* @brief Get the matrix A (matrix solvers only).
* @return A
*/
virtual SUNMatrix getMatrix() const;
virtual SUNMatrixWrapper& getMatrix();

protected:
/**
Expand Down Expand Up @@ -195,7 +195,7 @@ class SUNLinSolKLU : public SUNLinSolWrapper {
* @param ordering
*/
SUNLinSolKLU(
AmiVector const& x, int nnz, int sparsetype, StateOrdering ordering
AmiVector const& x, int nnz, int sparsetype, StateOrdering ordering = StateOrdering::COLAMD
);

/**
Expand Down
9 changes: 8 additions & 1 deletion src/sundials_linsol_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ SUNLinSolWrapper::~SUNLinSolWrapper() {

SUNLinSolWrapper::SUNLinSolWrapper(SUNLinSolWrapper&& other) noexcept {
std::swap(solver_, other.solver_);
std::swap(A_, other.A_);
}

SUNLinSolWrapper& SUNLinSolWrapper::operator=(SUNLinSolWrapper&& other) noexcept {
std::swap(solver_, other.solver_);
std::swap(A_, other.A_);
return *this;
}

SUNLinearSolver SUNLinSolWrapper::get() const { return solver_; }
Expand Down Expand Up @@ -55,7 +62,7 @@ int SUNLinSolWrapper::space(long* lenrwLS, long* leniwLS) const {
return SUNLinSolSpace(solver_, lenrwLS, leniwLS);
}

SUNMatrix SUNLinSolWrapper::getMatrix() const { return A_.get(); }
SUNMatrixWrapper& SUNLinSolWrapper::getMatrix() { return A_; }

SUNNonLinSolWrapper::SUNNonLinSolWrapper(SUNNonlinearSolver sol)
: solver(sol) {}
Expand Down

0 comments on commit 8eb0a9c

Please sign in to comment.