diff --git a/dune/istl/io.hh b/dune/istl/io.hh index 565b5fe2246ae0131fc55ec82df7b839b0c145f2..b01c049e97c184d00a037760ef429e9dec5a5247 100644 --- a/dune/istl/io.hh +++ b/dune/istl/io.hh @@ -248,6 +248,14 @@ namespace Dune { namespace Impl { + template<class B> + void printInnerMatrixElement(std::ostream& s, + const B& innerMatrixElement, + int innerrow, int innercol) + { + s<<innerMatrixElement<<" "; + } + template<class B, int n> void printInnerMatrixElement(std::ostream& s, const ScaledIdentityMatrix<B,n> innerMatrixElement, @@ -312,8 +320,8 @@ namespace Dune { typedef typename Matrix::ConstRowIterator Row; - int n = InnerMatrixType::rows; - int m = InnerMatrixType::cols; + constexpr int n = std::decay_t<decltype(Impl::asMatrix(std::declval<InnerMatrixType>()))>::rows; + constexpr int m = std::decay_t<decltype(Impl::asMatrix(std::declval<InnerMatrixType>()))>::cols; for(Row row=mat.begin(); row != mat.end(); ++row) { int skipcols=0; bool reachedEnd=false; diff --git a/dune/istl/test/iotest.cc b/dune/istl/test/iotest.cc index 35b354d9be7735345750234b8f5807e1f92f6644..1ae6efc0fffa3f9fe486fc11419786267546e282 100644 --- a/dune/istl/test/iotest.cc +++ b/dune/istl/test/iotest.cc @@ -95,6 +95,7 @@ int main(int argc, char** argv) Dune::BCRSMatrix<double> matrix; setupLaplacian(matrix, 3); Dune::printmatrix(std::cout, matrix, "BCRSMatrix<double>", "--"); + Dune::printSparseMatrix(std::cout, matrix, "BCRSMatrix<double>", "--"); } { Dune::BCRSMatrix<Dune::FieldMatrix<double,1,1> > matrix;