From 4d295ef25a1fe37ace8d5a09185142329e9939c8 Mon Sep 17 00:00:00 2001
From: Rene Milk <r_milk01@DUNE-PROJECT.uni-muenster.de>
Date: Mon, 13 Jul 2009 19:08:41 +0200
Subject: [PATCH] fix eoc calc

---
 stuff/misc.hh     | 10 +++++-----
 stuff/profiler.hh |  6 ++++++
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/stuff/misc.hh b/stuff/misc.hh
index 6d6bf202a..567975610 100644
--- a/stuff/misc.hh
+++ b/stuff/misc.hh
@@ -106,11 +106,11 @@ public:
   }
 
   void putErrorCol(std::ofstream& outputFile_, const double prevError_, const double error_, const double prevh_,
-                   const bool initial)
+                   const bool /*initial*/)
   {
     current_h_    = info_.grid_width;
-    double factor = prevh_ / current_h_;
-    double eoc    = std::log(prevError_ / error_) / log(factor);
+    double factor = current_h_ / prevh_;
+    double eoc    = std::log(error_ / prevError_) / std::log(factor);
     outputFile_ << " & " << error_ << " & " << eoc;
   }
 
@@ -142,8 +142,8 @@ public:
 
   void putStaticCols(std::ofstream& outputFile_)
   {
-    outputFile_ << std::setw(4) << info_.grid_width << " & " << info_.codim0 << " & " << info_.c11 << " & " << info_.d11
-                << " & " << info_.c12 << " & " << info_.d12;
+    outputFile_ << std::setw(4) << info_.grid_width << " & " << info_.codim0 << " & " << info_.run_time << " & "
+                << info_.c11 << " & " << info_.d11 << " & " << info_.c12 << " & " << info_.d12;
   }
 
   void endTable(std::ofstream& outputFile_)
diff --git a/stuff/profiler.hh b/stuff/profiler.hh
index b7acda385..88b25235d 100644
--- a/stuff/profiler.hh
+++ b/stuff/profiler.hh
@@ -56,6 +56,12 @@ public:
     (m_timings[m_cur_run_num])[section_name].end = clock();
   }
 
+  inline long GetTiming(const std::string section_name)
+  {
+    clock_t diff = (m_timings[m_cur_run_num])[section_name].end - (m_timings[m_cur_run_num])[section_name].start;
+    return long(diff / double(CLOCKS_PER_SEC));
+  }
+
   /** output to currently pre-defined (csv) file
    * \param comm used to gather and average the runtime data over all processes
    * \tparam CollectiveCommunication should be Dune::CollectiveCommunication< MPI_Comm / double >
-- 
GitLab