From e3760a23e6737d4641d4e3629d0498a1ebce8620 Mon Sep 17 00:00:00 2001
From: Oliver Sander <oliver.sander@tu-dresden.de>
Date: Wed, 20 Jan 2016 10:17:05 +0100
Subject: [PATCH] Use FoamGrid if dim < dimworld

---
 src/cosserat-continuum.cc | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/cosserat-continuum.cc b/src/cosserat-continuum.cc
index fba07571..c2126be1 100644
--- a/src/cosserat-continuum.cc
+++ b/src/cosserat-continuum.cc
@@ -15,11 +15,14 @@
 #include <dune/common/parametertreeparser.hh>
 
 #include <dune/grid/uggrid.hh>
-#include <dune/grid/onedgrid.hh>
 #include <dune/grid/utility/structuredgridfactory.hh>
 
 #include <dune/grid/io/file/gmshreader.hh>
 
+#if HAVE_DUNE_FOAMGRID
+#include <dune/foamgrid/foamgrid.hh>
+#endif
+
 #include <dune/functions/functionspacebases/pqknodalbasis.hh>
 
 #include <dune/fufem/boundarypatch.hh>
@@ -120,7 +123,12 @@ int main (int argc, char *argv[]) try
     // ///////////////////////////////////////
     //    Create the grid
     // ///////////////////////////////////////
-    typedef std::conditional<dim==1,OneDGrid,UGGrid<dim> >::type GridType;
+#if HAVE_DUNE_FOAMGRID
+    typedef std::conditional<dim==dimworld,UGGrid<dim>, FoamGrid<dim,dimworld> >::type GridType;
+#else
+    static_assert(dim==dimworld, "FoamGrid needs to be installed to allow problems with dim != dimworld.");
+    typedef UGGrid<dim> GridType;
+#endif
 
     shared_ptr<GridType> grid;
 
-- 
GitLab