Skip to content
Snippets Groups Projects
Commit c204ff57 authored by Patrick Jaap's avatar Patrick Jaap
Browse files

CholmodSolver: Add error code member

Cholmod is able to report errors and warnings in the status entry of the
cholmodCommonObject.

Details about the possible integer values can be found in the Cholmod User Guide
parent 8ecddd67
No related branches found
No related tags found
No related merge requests found
Pipeline #30314 passed
# Master (will become release 2.8)
- ...
- CholmodSolver: Added `errorCode_` member to report errors and warnings during the matrix decomposition
## Deprecations and removals
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment