From ddf49c23ebf628ede87758248f0ab0c23a4c2933 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Carsten=20Gr=C3=A4ser?= <graeser@dune-project.org>
Date: Mon, 12 Sep 2016 11:02:49 +0200
Subject: [PATCH] [test] Test if implicit build works for correct average

If the correct average is provided, compress() may still
fail if more than the average numebr of entries are added
to an early row (e.g. the first one)
---
 dune/istl/test/bcrsimplicitbuild.cc | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/dune/istl/test/bcrsimplicitbuild.cc b/dune/istl/test/bcrsimplicitbuild.cc
index e53e3140b..0b74016e5 100644
--- a/dune/istl/test/bcrsimplicitbuild.cc
+++ b/dune/istl/test/bcrsimplicitbuild.cc
@@ -331,6 +331,24 @@ void testImplicitMatrixBuilderExtendedConstructor()
   setMatrix(m);
 }
 
+
+void testAverageStorage()
+{
+  using M = Dune::BCRSMatrix<Dune::FieldMatrix<double,1,1>>;
+  for(auto j : {5, 0})
+  {
+    std::cout << j << std::endl;
+    M m(6, 6, 1, 0.0, M::implicit);
+
+    for(std::size_t i=0; i<6; ++i)
+      m.entry(j,i) = i;
+
+    m.compress();
+  }
+}
+
+
+
 int main()
 {
   int ret=0;
@@ -353,6 +371,7 @@ int main()
     ret+=testConstBracketOperatorBeforeCompress();
     testImplicitMatrixBuilder();
     testImplicitMatrixBuilderExtendedConstructor();
+    testAverageStorage();
   }catch(Dune::Exception& e) {
     std::cerr << e <<std::endl;
     return 1;
-- 
GitLab