From 849843e9107bff945838b5777f791a30d5836f9e Mon Sep 17 00:00:00 2001
From: Oliver Sander <oliver.sander@tu-dresden.de>
Date: Sat, 10 Feb 2024 16:40:48 +0100
Subject: [PATCH] Fix printSparseMatrix for matrix entry type
 FieldMatrix<double,1,1>

Also, add a test for this.  It seems that not many people use this
method.  Otherwise the bug would have been noticed much earlier.
---
 dune/istl/io.hh          | 2 +-
 dune/istl/test/iotest.cc | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/dune/istl/io.hh b/dune/istl/io.hh
index 966cea4ad..4c8beac0b 100644
--- a/dune/istl/io.hh
+++ b/dune/istl/io.hh
@@ -357,7 +357,7 @@ namespace Dune {
       s<<"-";
   }
 
-  template<class B, int n, int m, class A>
+  template<class B, int n, int m>
   void printInnerMatrixElement(std::ostream& s,
                          const FieldMatrix<B,n,m> innerMatrixElement,
                          int innerrow, int innercol)
diff --git a/dune/istl/test/iotest.cc b/dune/istl/test/iotest.cc
index 8704bb85a..35b354d9b 100644
--- a/dune/istl/test/iotest.cc
+++ b/dune/istl/test/iotest.cc
@@ -89,7 +89,7 @@ int main(int argc, char** argv)
   v3.push_back(2);
   Dune::writeVectorToMatlabHelper(v3, std::cout);
 
-  // Test the printmatrix method
+  // Test the printmatrix and printSparseMatrix methods
   // BCRSMatrix
   {
     Dune::BCRSMatrix<double> matrix;
@@ -100,6 +100,7 @@ int main(int argc, char** argv)
     Dune::BCRSMatrix<Dune::FieldMatrix<double,1,1> > matrix;
     setupLaplacian(matrix, 3);
     Dune::printmatrix(std::cout, matrix, "BCRSMatrix<FieldMatrix<double,1,1> >", "--");
+    Dune::printSparseMatrix(std::cout, matrix, "BCRSMatrix<FieldMatrix<double,1,1> >", "--");
   }
   {
     Dune::BCRSMatrix<Dune::FieldMatrix<double,2,3> > matrix;
-- 
GitLab