From 90c8424a0517ea084d1217471c55190804e43b61 Mon Sep 17 00:00:00 2001
From: Elias Pipping <elias.pipping@fu-berlin.de>
Date: Mon, 21 Jul 2014 17:01:17 +0200
Subject: [PATCH] [Build  ] Allow UG to be used

---
 src/Makefile.am     | 3 +++
 src/gridselector.hh | 9 +++++++++
 2 files changed, 12 insertions(+)

diff --git a/src/Makefile.am b/src/Makefile.am
index fa6b6598..22d8a236 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -39,6 +39,7 @@ AM_CPPFLAGS = \
 	$(DUNE_CPPFLAGS) \
 	$(PYTHON_CPPFLAGS) \
 	$(ALUGRID_CPPFLAGS) \
+	$(UG_CPPFLAGS) \
 	-I$(top_srcdir)
 
 # The libraries have to be given in reverse order (most basic libraries
@@ -46,10 +47,12 @@ AM_CPPFLAGS = \
 LDADD = \
 	$(DUNE_LDFLAGS) $(DUNE_LIBS) \
 	$(ALUGRID_LIBS) \
+	$(UG_LIBS) \
 	$(PYTHON_LIBS)
 AM_LDFLAGS = \
 	$(DUNE_LDFLAGS) \
 	$(ALUGRID_LDFLAGS) \
+	$(UG_LDFLAGS) \
 	$(PYTHON_LDFLAGS)
 
 if CAIROMM
diff --git a/src/gridselector.hh b/src/gridselector.hh
index 0940e87a..0e27a54f 100644
--- a/src/gridselector.hh
+++ b/src/gridselector.hh
@@ -3,6 +3,7 @@
 #endif
 
 #define WANT_ALUGRID 0
+#define WANT_UG 1
 
 #define WANT_GRID WANT_ALUGRID
 
@@ -17,6 +18,14 @@
 #pragma clang diagnostic pop
 using Grid = Dune::ALUGrid<MY_DIM, MY_DIM, Dune::simplex, Dune::nonconforming>;
 
+#elif WANT_GRID == WANT_UG
+
+#if !HAVE_UG
+#error UG was requested but not found
+#endif
+#include <dune/grid/uggrid.hh>
+using Grid = Dune::UGGrid<MY_DIM>;
+
 #else
 
 #error requested a grid that does not exist
-- 
GitLab