From ed2747db1c2c828a4efe022d57a863fddcac1ec2 Mon Sep 17 00:00:00 2001 From: Kjetil Olsen Lye Date: Tue, 30 May 2023 10:28:29 +0200 Subject: [PATCH] Added sanity check. --- opm/simulators/linalg/cuistl/CuSparseMatrix.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/opm/simulators/linalg/cuistl/CuSparseMatrix.cpp b/opm/simulators/linalg/cuistl/CuSparseMatrix.cpp index 30d64cdf1..f478e51d0 100644 --- a/opm/simulators/linalg/cuistl/CuSparseMatrix.cpp +++ b/opm/simulators/linalg/cuistl/CuSparseMatrix.cpp @@ -75,6 +75,9 @@ CuSparseMatrix::CuSparseMatrix(const T* nonZeroElements, , m_matrixDescription(detail::createMatrixDescription()) , m_cusparseHandle(detail::CuSparseHandle::getInstance()) { + if (detail::to_size_t(rowIndices[numberOfRows]) != numberOfNonzeroBlocks) { + OPM_THROW(std::invalid_argument, "Wrong sparsity format. Needs to be CSR compliant. "); + } } template