Skip to content
Snippets Groups Projects
Commit 038d9506 authored by Simon Praetorius's avatar Simon Praetorius
Browse files

Merge branch 'issue/wrong-warning-diagonalmatrix-assigner' into 'master'

Improve the error message in the DenseMatrixAssigner for DiagonalMatrix

See merge request !1480
parents dcf394af df57a51d
Branches
Tags
1 merge request!1480Improve the error message in the DenseMatrixAssigner for DiagonalMatrix
Pipeline #75402 waiting for manual action
......@@ -1106,8 +1106,11 @@ namespace Dune {
struct DenseMatrixAssigner<DenseMatrix, DiagonalMatrix<field, N>> {
static void apply(DenseMatrix& denseMatrix,
DiagonalMatrix<field, N> const& rhs) {
DUNE_ASSERT_BOUNDS(denseMatrix.M() == N);
DUNE_ASSERT_BOUNDS(denseMatrix.N() == N);
#ifdef DUNE_CHECK_BOUNDS
if (denseMatrix.M() != N || denseMatrix.N() != N)
DUNE_THROW(Dune::RangeError, "Incompatible matrix dimensions in assignment.");
#endif // DUNE_CHECK_BOUNDS
denseMatrix = field(0);
for (int i = 0; i < N; ++i)
denseMatrix[i][i] = rhs.diagonal()[i];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment