From 764506db0e1823ec3af077742dfb7836bacf90a7 Mon Sep 17 00:00:00 2001
From: Elias Pipping <elias.pipping@fu-berlin.de>
Date: Tue, 3 Jan 2012 16:37:07 +0100
Subject: [PATCH] Implement getOutput()

---
 dune/tectonic/myblockproblem.hh | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/dune/tectonic/myblockproblem.hh b/dune/tectonic/myblockproblem.hh
index e5e75088..f226fd70 100644
--- a/dune/tectonic/myblockproblem.hh
+++ b/dune/tectonic/myblockproblem.hh
@@ -60,8 +60,14 @@ template <class MyConvexProblemTypeTEMPLATE> class MyBlockProblem {
   }
 
   std::string getOutput(bool header = false) const {
-    // TODO: implement (not urgent)
-    return std::string();
+    if (header) {
+      outStream.str("");
+      for (int j = 0; j < block_size; ++j)
+        outStream << "  trunc" << std::setw(2) << j;
+    }
+    std::string s = outStream.str();
+    outStream.str("");
+    return s;
   }
 
   void projectCoarseCorrection(VectorType const &u,
@@ -186,8 +192,8 @@ template <class MyConvexProblemTypeTEMPLATE> class MyBlockProblem {
           linearization.b[row][j] = 0.0;
     }
 
-    // for(int j=0; j<block_size; ++j)
-    //   outStream << std::setw(9) << linearization.truncation.countmasked(j);
+    for (int j = 0; j < block_size; ++j)
+      outStream << std::setw(9) << linearization.truncation.countmasked(j);
   }
 
   /** \brief Constructs and returns an iterate object */
@@ -203,6 +209,8 @@ template <class MyConvexProblemTypeTEMPLATE> class MyBlockProblem {
   Bisection bisection;
 
   Dune::ParameterTree const &parset;
+
+  mutable std::ostringstream outStream;
 };
 
 /** \brief Solves one local system using a scalar Gauss-Seidel method */
-- 
GitLab