From ac8afc68d32d289c12e4103b575eb5d89bb4ea0f Mon Sep 17 00:00:00 2001
From: Elias Pipping <elias.pipping@fu-berlin.de>
Date: Tue, 8 May 2012 15:35:35 +0200
Subject: [PATCH] Do not print the state evolution; write it

---
 src/Makefile.am                      |  4 ++--
 src/one-body-sample.cc               |  6 +++---
 src/one-body-sample.parset           |  2 +-
 src/{print.cc => write.cc}           | 10 +++-------
 src/{print.hh => write.hh}           |  6 +++---
 src/{print_tmpl.cc => write_tmpl.cc} |  4 ++--
 6 files changed, 14 insertions(+), 18 deletions(-)
 rename src/{print.cc => write.cc} (71%)
 rename src/{print.hh => write.hh} (80%)
 rename src/{print_tmpl.cc => write_tmpl.cc} (87%)

diff --git a/src/Makefile.am b/src/Makefile.am
index 7649f800..a428d857 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -28,8 +28,8 @@ one_body_sample_SOURCES = \
 	compute_state_ruina.cc \
 	mysolver.cc \
 	one-body-sample.cc \
-	print.cc \
-	vtk.cc
+	vtk.cc \
+	write.cc
 one_body_sample_CPPFLAGS = \
 	$(AM_CPPFLAGS) -Dsrcdir=\"$(srcdir)\"
 
diff --git a/src/one-body-sample.cc b/src/one-body-sample.cc
index 04e210dc..a99aeb13 100644
--- a/src/one-body-sample.cc
+++ b/src/one-body-sample.cc
@@ -65,8 +65,8 @@
 #include "compute_state.hh"
 #include "compute_state_ruina.hh"
 #include "mysolver.hh"
-#include "print.hh"
 #include "vtk.hh"
+#include "write.hh"
 
 int const dim = 2;
 
@@ -298,8 +298,8 @@ int main(int argc, char *argv[]) {
             break;
         }
 
-        if (parset.get<bool>("printEvolution"))
-          print_evolution<SingletonVectorType, VectorType>(
+        if (parset.get<bool>("writeEvolution"))
+          write_evolution<SingletonVectorType, VectorType>(
               frictionalNodes, *s4_new, u4, functions.get("neumannCondition"),
               run, h * run, octave_writer);
 
diff --git a/src/one-body-sample.parset b/src/one-body-sample.parset
index fd2acefc..360d2333 100644
--- a/src/one-body-sample.parset
+++ b/src/one-body-sample.parset
@@ -3,10 +3,10 @@ timesteps = 600
 
 verbose = false
 printCoefficient = true
-printEvolution = false
 printFrictionalBoundary = false
 printProgress = false
 
+writeEvolution = false
 writeVTK = true
 
 [grid]
diff --git a/src/print.cc b/src/write.cc
similarity index 71%
rename from src/print.cc
rename to src/write.cc
index dcafd65b..593bea26 100644
--- a/src/print.cc
+++ b/src/write.cc
@@ -2,12 +2,10 @@
 #include "config.h"
 #endif
 
-#include <boost/format.hpp>
-
-#include "print.hh"
+#include "write.hh"
 
 template <class SingletonVectorType, class VectorType>
-void print_evolution(Dune::BitSetVector<1> const &frictionalNodes,
+void write_evolution(Dune::BitSetVector<1> const &frictionalNodes,
                      SingletonVectorType const &state,
                      VectorType const &displacement,
                      Dune::VirtualFunction<double, double> const &function,
@@ -19,12 +17,10 @@ void print_evolution(Dune::BitSetVector<1> const &frictionalNodes,
 
     double out;
     function.evaluate(time, out);
-    std::cout << boost::format("s[%03d] = %+3e, %|20t|u[%03d] = %+3e") % run %
-                     state[i] % run % displacement[i][0] << std::endl;
     octave_writer << state[i][0] << " " << displacement[i][0] * 1e6 << " "
                   << out << std::endl;
     break;
   }
 }
 
-#include "print_tmpl.cc"
+#include "write_tmpl.cc"
diff --git a/src/print.hh b/src/write.hh
similarity index 80%
rename from src/print.hh
rename to src/write.hh
index 79d52066..6b0d8f92 100644
--- a/src/print.hh
+++ b/src/write.hh
@@ -1,11 +1,11 @@
-#ifndef PRINT_HH
-#define PRINT_HH
+#ifndef WRITE_HH
+#define WRITE_HH
 
 #include <dune/common/function.hh>
 #include <dune/common/bitsetvector.hh>
 
 template <class SingletonVectorType, class VectorType>
-void print_evolution(Dune::BitSetVector<1> const &frictionalNodes,
+void write_evolution(Dune::BitSetVector<1> const &frictionalNodes,
                      SingletonVectorType const &state,
                      VectorType const &displacement,
                      Dune::VirtualFunction<double, double> const &function,
diff --git a/src/print_tmpl.cc b/src/write_tmpl.cc
similarity index 87%
rename from src/print_tmpl.cc
rename to src/write_tmpl.cc
index ae475a81..5727f345 100644
--- a/src/print_tmpl.cc
+++ b/src/write_tmpl.cc
@@ -7,7 +7,7 @@ typedef Dune::BlockVector<Dune::FieldVector<double, 1>> SingletonVectorType;
 typedef Dune::FieldVector<double, 2> SmallVector2;
 typedef Dune::BlockVector<SmallVector2> VectorType2;
 
-template void print_evolution<SingletonVectorType, VectorType2>(
+template void write_evolution<SingletonVectorType, VectorType2>(
     Dune::BitSetVector<1> const &frictionalNodes,
     SingletonVectorType const &state, VectorType2 const &displacement,
     Dune::VirtualFunction<double, double> const &function, int run, double time,
@@ -18,7 +18,7 @@ template void print_evolution<SingletonVectorType, VectorType2>(
 typedef Dune::FieldVector<double, 3> SmallVector3;
 typedef Dune::BlockVector<SmallVector3> VectorType3;
 
-template void print_evolution<SingletonVectorType, VectorType3>(
+template void write_evolution<SingletonVectorType, VectorType3>(
     Dune::BitSetVector<1> const &frictionalNodes,
     SingletonVectorType const &state, VectorType3 const &displacement,
     Dune::VirtualFunction<double, double> const &function, int run, double time,
-- 
GitLab