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

CHOLMOD: introduce bool nIsZero_

It can happen that we work on a 0 times 0 matrix due to ignore fields or other reasons.
This leads to undefined behavior in the cholmod lib.

We simply catch this case by introducing a bool value.
parent 00bd625f
No related branches found
No related tags found
1 merge request!329CHOLMOD: introduce bool nIsZero_
......@@ -93,6 +93,12 @@ public:
*/
void apply(X& x, B& b, InverseOperatorResult& res)
{
// do nothing if N=0
if ( nIsZero_ )
{
return;
}
if (x.size() != b.size())
DUNE_THROW(Exception, "Error in apply(): sizes of x and b do not match!");
......@@ -186,6 +192,13 @@ public:
if ( ignore )
N -= ignore->count();
nIsZero_ = (N <= 0);
if ( nIsZero_ )
{
return;
}
// number of nonzeroes
const int nnz = blocksize * blocksize * matrix.nonzeroes();
// number of diagonal entries
......@@ -309,6 +322,9 @@ private:
cholmod_common c_;
cholmod_factor* L_ = nullptr;
// indicator for a 0x0 problem (due to ignore dof's)
bool nIsZero_ = false;
// mapping from the not ignored indices in flat order to all indices in flat order
// it also holds the info about ignore nodes: if it is empty => no ignore field
std::vector<std::size_t> inverseSubIndices_;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment