From 2ab057f2d4075dceef64842ccb8797d9d8d661b7 Mon Sep 17 00:00:00 2001
From: Elias Pipping <elias.pipping@fu-berlin.de>
Date: Fri, 31 May 2013 11:43:41 +0200
Subject: [PATCH] Take the gridview from the basis

---
 src/one-body-sample.cc |  5 ++---
 src/vtk.cc             |  8 ++++----
 src/vtk.hh             |  5 ++---
 src/vtk_tmpl.cc        | 12 ++++--------
 4 files changed, 12 insertions(+), 18 deletions(-)

diff --git a/src/one-body-sample.cc b/src/one-body-sample.cc
index 1e9863a1..334c3403 100644
--- a/src/one-body-sample.cc
+++ b/src/one-body-sample.cc
@@ -506,9 +506,8 @@ int main(int argc, char *argv[]) {
             E, nu, gridDisplacement);
         p0Assembler.assembleFunctional(localStressAssembler, vonMisesStress);
 
-        writeVtk<P1Basis, P0Basis, VectorType, SingletonVectorType, GridView>(
-            p1Basis, u, alpha, p0Basis, vonMisesStress, leafView,
-            (boost::format("obs%d") % run).str());
+        writeVtk(p1Basis, u, alpha, p0Basis, vonMisesStress,
+                 (boost::format("obs%d") % run).str());
       }
     }
     if (parset.get<bool>("enableTimer"))
diff --git a/src/vtk.cc b/src/vtk.cc
index b92b0616..e2520307 100644
--- a/src/vtk.cc
+++ b/src/vtk.cc
@@ -5,12 +5,12 @@
 #include "vtk.hh"
 
 template <class VertexBasis, class CellBasis, class VectorType,
-          class SingletonVectorType, class GridView>
+          class SingletonVectorType>
 void writeVtk(VertexBasis const &vertexBasis, VectorType const &displacement,
               SingletonVectorType const &state, CellBasis const &cellBasis,
-              SingletonVectorType const &stress, GridView const &gridView,
-              std::string const &filename) {
-  Dune::VTKWriter<GridView> writer(gridView);
+              SingletonVectorType const &stress, std::string const &filename) {
+  Dune::VTKWriter<typename VertexBasis::GridView> writer(
+      vertexBasis.getGridView());
 
   auto const displacement_ptr =
       Dune::make_shared<VTKBasisGridFunction<VertexBasis, VectorType> const>(
diff --git a/src/vtk.hh b/src/vtk.hh
index 9986fe90..250de25b 100644
--- a/src/vtk.hh
+++ b/src/vtk.hh
@@ -7,10 +7,9 @@
 #include <dune/fufem/functions/vtkbasisgridfunction.hh>
 
 template <class VertexBasis, class CellBasis, class VectorType,
-          class SingletonVectorType, class GridView>
+          class SingletonVectorType>
 void writeVtk(VertexBasis const &vertexBasis, VectorType const &displacement,
               SingletonVectorType const &state, CellBasis const &cellBasis,
-              SingletonVectorType const &stress, GridView const &gridView,
-              std::string const &filename);
+              SingletonVectorType const &stress, std::string const &filename);
 
 #endif
diff --git a/src/vtk_tmpl.cc b/src/vtk_tmpl.cc
index 4f85e063..9347e7b5 100644
--- a/src/vtk_tmpl.cc
+++ b/src/vtk_tmpl.cc
@@ -21,11 +21,7 @@ using GridView = GridType::LeafGridView;
 using P1Basis = P1NodalBasis<GridView, double>;
 using MyP0Basis = P0Basis<GridView, double>;
 
-template void writeVtk<P1Basis, MyP0Basis, VectorType, SingletonVectorType,
-                       GridView>(P1Basis const &vertexBasis,
-                                 VectorType const &displacement,
-                                 SingletonVectorType const &state,
-                                 MyP0Basis const &cellBasis,
-                                 SingletonVectorType const &stress,
-                                 GridView const &gridView,
-                                 std::string const &filename);
+template void writeVtk<P1Basis, MyP0Basis, VectorType, SingletonVectorType>(
+    P1Basis const &vertexBasis, VectorType const &displacement,
+    SingletonVectorType const &state, MyP0Basis const &cellBasis,
+    SingletonVectorType const &stress, std::string const &filename);
-- 
GitLab