From 85e2aab37db1c36ac6c1f51686629ea0fc4d2f91 Mon Sep 17 00:00:00 2001
From: Elias Pipping <elias.pipping@fu-berlin.de>
Date: Fri, 11 Jul 2014 00:22:02 +0200
Subject: [PATCH] [Output]  Write out time steps

---
 src/sand-wedge.cc | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/sand-wedge.cc b/src/sand-wedge.cc
index c8a73172..b0a41e8d 100644
--- a/src/sand-wedge.cc
+++ b/src/sand-wedge.cc
@@ -28,6 +28,7 @@
 #include <exception>
 #include <fstream>
 #include <iostream>
+#include <iomanip>
 
 #include <dune/common/bitsetvector.hh>
 #include <dune/common/exceptions.hh>
@@ -300,6 +301,12 @@ int main(int argc, char *argv[]) {
                    functions.get("velocityDirichletCondition"),
                &neumannFunction = functions.get("neumannCondition");
 
+    std::fstream timeStepWriter("timeSteps", std::fstream::out);
+    timeStepWriter << std::fixed << std::setprecision(10);
+    auto const reportTimeStep = [&](double _relativeTime, double _relativeTau) {
+      timeStepWriter << _relativeTime << " " << _relativeTau << std::endl;
+    };
+
     using MyAssembler = MyAssembler<GridView, dims>;
     using Matrix = MyAssembler::Matrix;
     using LocalMatrix = Matrix::block_type;
@@ -597,6 +604,8 @@ int main(int argc, char *argv[]) {
         }
       }
 
+      reportTimeStep(relativeTime, relativeTau);
+
       stateUpdater = stateUpdaterR1;
       velocityUpdater = velocityUpdaterR1;
       stateUpdaterR1 = stateUpdaterR2;
@@ -628,6 +637,7 @@ int main(int argc, char *argv[]) {
       }
       timeStep++;
     }
+    timeStepWriter.close();
     Python::stop();
   }
   catch (Dune::Exception &e) {
-- 
GitLab