From 17f3607fbfe6c103451672f5e2d16ad26a24a63b Mon Sep 17 00:00:00 2001
From: Bernd Flemisch <bernd@iws.uni-stuttgart.de>
Date: Wed, 15 Oct 2014 13:56:26 +0000
Subject: [PATCH] [restart] revert usage of BackupRestoreFacility

The BackupRestoreFacility does not work with ALUGrid 1.52. It also does
not work with dune-alugrid in combination with Dumux due to
technicalities that are documented in FS#237.

Therefore, the restart with adaptive grids currently does only work with
ALUGrid 1.52, not with dune-alugrid.

Reviewed and approved by natalies.



git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@13495 2fb0f335-1f38-0410-981e-8018bf24f1b0
---
 dumux/io/adaptivegridrestart.hh | 31 ++++++++++++++++++++++++++-----
 1 file changed, 26 insertions(+), 5 deletions(-)

diff --git a/dumux/io/adaptivegridrestart.hh b/dumux/io/adaptivegridrestart.hh
index fa071f3ac0..c5e7c2064c 100644
--- a/dumux/io/adaptivegridrestart.hh
+++ b/dumux/io/adaptivegridrestart.hh
@@ -70,13 +70,21 @@ struct GridRestartCheck<Dune::SGrid<dim, dim>, dim>
 template<int dim>
 struct GridRestartCheck<Dune::ALUGrid<dim, dim, Dune::cube, Dune::nonconforming>, dim>
 {
+#if HAVE_ALUGRID
     static const bool allowRestart = true;
+#else
+    static const bool allowRestart = false;
+#endif
 };
 
 template<int dim>
 struct GridRestartCheck<Dune::ALUGrid<dim, dim, Dune::simplex, Dune::conforming>, dim>
 {
+#if HAVE_ALUGRID
     static const bool allowRestart = true;
+#else
+    static const bool allowRestart = false;
+#endif
 };
 #endif
 
@@ -110,13 +118,18 @@ public:
     template<class Problem>
     static void serializeGrid(Problem& problem)
     {
+        DUNE_THROW(Dune::NotImplemented,
+                   "Adaptive restart functionality currently only works for ALUGrid (not dune-alugrid).");
     }
+
     /*!
      * \brief Restart the grid from the file.
      */
     template<class Problem>
     static void restartGrid(Problem& problem)
     {
+        DUNE_THROW(Dune::NotImplemented,
+                   "Adaptive restart functionality currently only works for ALUGrid (not dune-alugrid).");
     }
 };
 
@@ -133,18 +146,26 @@ public:
     template<class Problem>
     static void serializeGrid(Problem& problem)
     {
-        Dune::BackupRestoreFacility<Grid>::backup(
-            problem.grid(), restartGridFileName_(problem));
+        std::string gridName = restartGridFileName_(problem);
+        double time = problem.timeManager().time();
+        problem.grid().template writeGrid<Dune::xdr> (gridName, time);
+        // TODO use the BackupRestoreFacility with dune-alugrid, see FS#237
+        //Dune::BackupRestoreFacility<Grid>::backup(
+        //    problem.grid(), restartGridFileName_(problem));
     }
+
     /*!
      * \brief Restart the grid from the file.
      */
-
     template<class Problem>
     static void restartGrid(Problem& problem)
     {
-        problem.setGrid(*Dune::BackupRestoreFacility<Grid>::restore(
-            restartGridFileName_(problem)));
+        std::string gridName = restartGridFileName_(problem);
+        double time = problem.timeManager().time();
+        problem.grid().template readGrid<Dune::xdr> (gridName, time);
+        // TODO use the BackupRestoreFacility with dune-alugrid, see FS#237
+        //problem.setGrid(*Dune::BackupRestoreFacility<Grid>::restore(
+        //    restartGridFileName_(problem)));
     }
 
 private:
-- 
GitLab