diff --git a/CHANGELOG.md b/CHANGELOG.md index 4a5d1c7066fcdd55447d17a9fe00bbe3944154d4..5746cb97dd0abb5a5f6084cbac13fc3b3930cabe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Master (will become release 2.8) -- ... +- CholmodSolver: Added `errorCode_` member to report errors and warnings during the matrix decomposition ## Deprecations and removals diff --git a/dune/solvers/solvers/cholmodsolver.hh b/dune/solvers/solvers/cholmodsolver.hh index 50114c64e15cc2daa39e1540c5a2f9211822c9cf..7cbe2fb8d043b8b5192b98a304c055267a80faa5 100644 --- a/dune/solvers/solvers/cholmodsolver.hh +++ b/dune/solvers/solvers/cholmodsolver.hh @@ -93,7 +93,12 @@ public: { // the apply() method doesn't like constant values auto mutableRhs = *rhs_; + + // setMatrix will decompose the matrix solver.setMatrix(*matrix_); + // get the error code from Cholmod in case something happened + errorCode_ = solver.cholmodCommonObject().status; + solver.apply(*x_, mutableRhs, statistics); } else @@ -102,6 +107,8 @@ public: // The setMatrix method stores only the selected entries of the matrix (determined by the ignore field) solver.setMatrix(*matrix_,&ignore); + // get the error code from Cholmod in case something happened + errorCode_ = solver.cholmodCommonObject().status; auto modifiedRhs = *rhs_; @@ -149,6 +156,19 @@ public: } } + /** \brief return the error code of the Cholmod factorize call + * + * In setMatrix() the matrix factorization takes place and Cholmod is + * able to communicate error codes of the factorization in the status + * field of the cholmodCommonObject. + * The return value 0 means "good" and the other values can be found + * in the Cholmod User Guide. + */ + int errorCode() const + { + return errorCode_; + } + //! Pointer to the system matrix const MatrixType* matrix_; @@ -157,6 +177,9 @@ public: //! Pointer to the right hand side const VectorType* rhs_; + + //! error code of Cholmod factorize call + int errorCode_ = 0; }; } // namespace Solvers