From 4b684b7fe0d7e96be82d9f6dc1ff86ede35d03ed Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ren=C3=A9=20Fritze?= <rene.fritze@wwu.de>
Date: Thu, 13 Dec 2018 09:30:53 +0100
Subject: [PATCH] [py] emit bindings for all available_grid_types

closes #56
---
 .gitsuper                                 |  4 ++--
 cmake/modules/DuneXtFunctionsMacros.cmake |  1 -
 python/dune/xt/bindings.cc                | 27 ++++++++++++++---------
 3 files changed, 18 insertions(+), 14 deletions(-)

diff --git a/.gitsuper b/.gitsuper
index 221b29195..7d042eb00 100644
--- a/.gitsuper
+++ b/.gitsuper
@@ -14,7 +14,7 @@ status = 1a3bcab04b011a5d6e44f9983cae6ff89fa695e8 bin (heads/master)
 	 07f9700459c616186737a9a34277f2edee76f475 dune-uggrid (v2.6.0-1-g07f97004)
 	+bf48b2929a26dc043925c41672570600b936f032 dune-xt-common (heads/fix_issue_149)
 	 cad4071f7722374d5131c21244970e93c98ad6ba dune-xt-data (remotes/origin/HEAD)
-	+0bdb4e53bdc193530299611b01c35ed152b4cc8d dune-xt-functions (heads/update_license)
+	+88f54b8bf6e02817cc9ac082bfb1fcd54a3efd7e dune-xt-functions (heads/dailywork-tim)
 	 08242248ae7d1e79018fc2e91e85bccdd453107a dune-xt-grid (remotes/origin/HEAD)
 	 0c3b93e32d48b7b389db1c3572d567bff272190c dune-xt-la (remotes/origin/HEAD)
 	 09d0378f616b94d68bcdd9fc6114813181849ec0 scripts (heads/master)
@@ -93,7 +93,7 @@ commit = cad4071f7722374d5131c21244970e93c98ad6ba
 [submodule.dune-xt-functions]
 remote = https://github.com/dune-community/dune-xt-functions.git
 status = c0b1735fab0ecbd4bb4f1eaa27cb65fe813e98f0 .vcsetup (remotes/origin/HEAD)
-commit = 0bdb4e53bdc193530299611b01c35ed152b4cc8d
+commit = 88f54b8bf6e02817cc9ac082bfb1fcd54a3efd7e
 
 [submodule.dune-xt-grid]
 remote = https://github.com/dune-community/dune-xt-grid.git
diff --git a/cmake/modules/DuneXtFunctionsMacros.cmake b/cmake/modules/DuneXtFunctionsMacros.cmake
index a85324bd5..877bedfec 100644
--- a/cmake/modules/DuneXtFunctionsMacros.cmake
+++ b/cmake/modules/DuneXtFunctionsMacros.cmake
@@ -12,4 +12,3 @@
 #
 # File for module specific CMake tests.
 # ~~~
-
diff --git a/python/dune/xt/bindings.cc b/python/dune/xt/bindings.cc
index 9b72f83c9..1f6e5a437 100644
--- a/python/dune/xt/bindings.cc
+++ b/python/dune/xt/bindings.cc
@@ -31,6 +31,7 @@
 #include <python/dune/xt/functions/indicator.hh>
 
 #include <python/dune/xt/common/exceptions.bindings.hh>
+#include <python/dune/xt/grid/available_types.hh>
 
 template <class G>
 void addbind_for_Grid(pybind11::module& m)
@@ -59,6 +60,19 @@ void addbind_for_Grid(pybind11::module& m)
 } // ... addbind_for_Grid(...)
 
 
+template <class Tuple = Dune::XT::Grid::bindings::AvailableTypes>
+void all_grids(pybind11::module& m)
+{
+  addbind_for_Grid<typename Tuple::head_type>(m);
+  all_grids<typename Tuple::tail_type>(m);
+} // ... addbind_for_Grid(...)
+
+
+template <>
+void all_grids<boost::tuples::null_type>(pybind11::module&)
+{}
+
+
 PYBIND11_MODULE(_functions, m)
 {
   namespace py = pybind11;
@@ -135,17 +149,8 @@ PYBIND11_MODULE(_functions, m)
   bind_ExpressionFunction<3, 2, 2>(m);
   bind_ExpressionFunction<3, 3, 3>(m);
 
-  addbind_for_Grid<Dune::YaspGrid<1, Dune::EquidistantOffsetCoordinates<double, 1>>>(m);
-  addbind_for_Grid<Dune::YaspGrid<2, Dune::EquidistantOffsetCoordinates<double, 2>>>(m);
-#if HAVE_DUNE_ALUGRID
-  addbind_for_Grid<Dune::ALUGrid<2, 2, Dune::simplex, Dune::conforming>>(m);
-#endif
-#if HAVE_UG
-  addbind_for_Grid<Dune::UGGrid<2>>(m);
-#endif
-  //#if HAVE_ALBERTA
-  //  addbind_for_Grid<Dune::AlbertaGrid<2, 2>>(m, "2d_simplex_albertagrid");
-  //#endif
+
+  all_grids(m);
 
   Dune::XT::Common::bindings::add_initialization(m, "dune.xt.functions");
 }
-- 
GitLab