[Dune] [Fwd: [Dune-Commit] dune-grid r4244 - in trunk/grid: albertagrid alugrid onedgrid sgrid uggrid utility yaspgrid]

Oliver Sander sander at mi.fu-berlin.de
Mon Jul 14 11:52:11 CEST 2008


Hi Martin, hi Dune!
I'm afraid to say I'd like to see this patch discussed on the mailing list.
It is a lot of code, and the added value is not clear to me.

--
Oliver

-------- Original-Nachricht --------
Betreff: 	[Dune-Commit] dune-grid r4244 - in trunk/grid: albertagrid 
alugrid onedgrid sgrid uggrid utility yaspgrid
Datum: 	Sun, 13 Jul 2008 15:14:32 +0200
Von: 	mnolte at dune-project.org
An: 	dune-commit at dune-project.org



Author: mnolte
Date: 2008-07-13 15:14:32 +0200 (Sun, 13 Jul 2008)
New Revision: 4244

Added:
   trunk/grid/albertagrid/gridtype.hh
   trunk/grid/alugrid/gridtype.hh
   trunk/grid/onedgrid/gridtype.hh
   trunk/grid/sgrid/gridtype.hh
   trunk/grid/uggrid/gridtype.hh
   trunk/grid/utility/griddim.hh
   trunk/grid/yaspgrid/gridtype.hh
Modified:
   trunk/grid/albertagrid/Makefile.am
   trunk/grid/alugrid/Makefile.am
   trunk/grid/onedgrid/Makefile.am
   trunk/grid/sgrid/Makefile.am
   trunk/grid/uggrid/Makefile.am
   trunk/grid/utility/Makefile.am
   trunk/grid/utility/gridtype.hh
   trunk/grid/yaspgrid/Makefile.am
Log:
* added compiler switch WORLDDIM for world dimension
* split utility/gridtype.hh into several grid dependent files
  
This allows for specific inclusion of grids and makes extension to grids
from other modules easier (Every grid simply has to have such an include
file).


Modified: trunk/grid/albertagrid/Makefile.am
===================================================================
--- trunk/grid/albertagrid/Makefile.am	2008-07-13 13:10:44 UTC (rev 4243)
+++ trunk/grid/albertagrid/Makefile.am	2008-07-13 13:14:32 UTC (rev 4244)
@@ -3,6 +3,7 @@
 albertadir = $(includedir)/dune/grid/albertagrid/
 alberta_HEADERS = agrid.hh agelementindex.cc albertagrid.cc \
   agmemory.hh albertaextra.hh albertaheader.hh \
-  alberta_undefs.hh indexsets.hh referencetopo.hh datahandle.hh
+  alberta_undefs.hh indexsets.hh referencetopo.hh datahandle.hh \
+  gridtype.hh
 
 include $(top_srcdir)/am/global-rules

Added: trunk/grid/albertagrid/gridtype.hh
===================================================================
--- trunk/grid/albertagrid/gridtype.hh	                        (rev 0)
+++ trunk/grid/albertagrid/gridtype.hh	2008-07-13 13:14:32 UTC (rev 4244)
@@ -0,0 +1,25 @@
+#ifndef DUNE_ALBERTAGRID_GRIDTYPE_HH
+#define DUNE_ALBERTAGRID_GRIDTYPE_HH
+
+#include <dune/grid/utility/griddim.hh>
+
+#if defined ALBERTAGRID
+  #if HAVE_GRIDTYPE
+    #error "Ambiguous definition of GRIDTYPE."
+  #endif
+  #if not HAVE_ALBERTA
+    #error "ALBERTAGRID defined but no ALBERTA version found!"  
+  #endif
+  #if (GRIDDIM < 2) || (GRIDDIM > 3)
+    #error "ALBERTAGRID is only available for GRIDDIM=2 and GRIDDIM=3."
+  #endif
+  #if (WORLDDIM != GRIDDIM)
+    #error "ALBERTAGRID currently only supports WORLDDIM=GRIDDIM."
+  #endif
+
+  #include <dune/grid/albertagrid.hh>
+  typedef Dune :: AlbertaGrid< dimgrid, dimworld > GridType;
+  #define HAVE_GRIDTYPE 1
+#endif
+
+#endif

Modified: trunk/grid/alugrid/Makefile.am
===================================================================
--- trunk/grid/alugrid/Makefile.am	2008-07-13 13:10:44 UTC (rev 4243)
+++ trunk/grid/alugrid/Makefile.am	2008-07-13 13:14:32 UTC (rev 4244)
@@ -1,5 +1,8 @@
 # $Id: Makefile.am 2549 2006-04-28 13:09:28Z christi $
 
+alugriddir = $(includedir)/dune/grid/alugrid/
+alugrid_HEADERS = gridtype.hh
+
 SUBDIRS = 2d 3d 
 
 noinst_LTLIBRARIES = libalu.la
@@ -10,4 +13,5 @@
 # construct only from sub-libraries
 libalu_la_SOURCES =
 libalu_la_LIBADD = $(ALULIB)
+
 include $(top_srcdir)/am/global-rules

Added: trunk/grid/alugrid/gridtype.hh
===================================================================
--- trunk/grid/alugrid/gridtype.hh	                        (rev 0)
+++ trunk/grid/alugrid/gridtype.hh	2008-07-13 13:14:32 UTC (rev 4244)
@@ -0,0 +1,56 @@
+#ifndef DUNE_ALUGRID_GRIDTYPE_HH
+#define DUNE_ALUGRID_GRIDTYPE_HH
+
+#include <dune/grid/utility/griddim.hh>
+
+#if defined ALUGRID_CUBE
+  #if HAVE_GRIDTYPE
+    #error "Ambiguous definition of GRIDTYPE."
+  #endif
+  #if not HAVE_ALUGRID
+    #error "ALUGRID_CUBE defined but no ALUGRID version found!"
+  #endif
+  #if (GRIDDIM != 3) || (WORLDDIM != GRIDDIM)
+    #error "ALUGRID_CUBE is only available for GRIDDIM=3 and WORLDDIM=GRIDDIM."
+  #endif
+
+  #include <dune/grid/alugrid.hh>
+  typedef Dune :: ALUCubeGrid< dimgrid, dimworld > GridType;
+  #define HAVE_GRIDTYPE 1
+#endif
+
+#if defined ALUGRID_SIMPLEX
+  #if HAVE_GRIDTYPE
+    #error "Ambiguous definition of GRIDTYPE."
+  #endif
+  #if not HAVE_ALUGRID
+    #error "ALUGRID_SIMPLEX defined but no ALUGRID version found!"
+  #endif
+  #if (GRIDDIM < 2) || (GRIDDIM > 3)
+    #error "ALUGRID_SIMPLEX is only available for GRIDDIM=2 and GRIDDIM=3."
+  #endif
+  #if (WORLDDIM != GRIDDIM)
+    #error "ALUGRID_SIMPLEX is only available for WORLDDIM=GRIDDIM."
+  #endif
+
+  #include <dune/grid/alugrid.hh>
+  typedef Dune :: ALUSimplexGrid< dimgrid, dimworld > GridType;
+  #define HAVE_GRIDTYPE 1
+#endif
+
+#if defined ALUGRID_CONFORM
+  #if HAVE_GRIDTYPE
+    #error "Ambiguous definition of GRIDTYPE."
+  #endif
+  #if not HAVE_ALUGRID
+    #error "ALUGRID_CONFORM defined but no ALUGRID version found!"
+  #endif
+  #if (GRIDDIM != 2) || (WORLDDIM != GRIDDIM)
+    #error "ALUGRID_CONFORM is only available for GRIDDIM=2 and WORLDDIM=GRIDDIM."
+  #endif
+  #include <dune/grid/alugrid.hh>
+  typedef Dune :: ALUConformGrid< dimgrid, dimworld > GridType;
+  #define HAVE_GRIDTYPE 1
+#endif
+
+#endif

Modified: trunk/grid/onedgrid/Makefile.am
===================================================================
--- trunk/grid/onedgrid/Makefile.am	2008-07-13 13:10:44 UTC (rev 4243)
+++ trunk/grid/onedgrid/Makefile.am	2008-07-13 13:14:32 UTC (rev 4244)
@@ -9,6 +9,6 @@
 onedgrid_HEADERS = \
    onedgridgeometry.hh onedgridentity.hh onedgridhieriterator.hh \
    onedgridleveliterator.hh onedintersectionit.hh onedgridentitypointer.hh \
-   onedgridindexsets.hh onedgridleafiterator.hh
+   onedgridindexsets.hh onedgridleafiterator.hh gridtype.hh
 
 include $(top_srcdir)/am/global-rules

Added: trunk/grid/onedgrid/gridtype.hh
===================================================================
--- trunk/grid/onedgrid/gridtype.hh	                        (rev 0)
+++ trunk/grid/onedgrid/gridtype.hh	2008-07-13 13:14:32 UTC (rev 4244)
@@ -0,0 +1,19 @@
+#ifndef DUNE_ONEDGRID_GRIDTYPE_HH
+#define DUNE_ONEDGRID_GRIDTYPE_HH
+
+#include <dune/grid/utility/griddim.hh>
+
+#if defined ONEDGRID
+  #if HAVE_GRIDTYPE
+    #error "Ambiguous definition of GRIDTYPE."
+  #endif
+  #if (GRIDDIM != 1) || (WORLDDIM != GRIDDIM)
+    #error "ONEDGRID is only available for GRIDDIM=1 and WORLDDIM=GRIDDIM."
+  #endif
+
+  #include <dune/grid/onedgrid.hh>
+  typedef Dune :: OneDGrid GridType;
+  #define HAVE_GRIDTYPE 1
+#endif
+
+#endif

Modified: trunk/grid/sgrid/Makefile.am
===================================================================
--- trunk/grid/sgrid/Makefile.am	2008-07-13 13:10:44 UTC (rev 4243)
+++ trunk/grid/sgrid/Makefile.am	2008-07-13 13:14:32 UTC (rev 4244)
@@ -1,7 +1,7 @@
 # $Id$
 
 sgriddir = $(includedir)/dune/grid/sgrid/
-sgrid_HEADERS = numbering.cc numbering.hh sgrid.cc
+sgrid_HEADERS = numbering.cc numbering.hh sgrid.cc gridtype.hh
 
 EXTRA_DIST = sgridclasses.fig sgridclasses.eps sgridclasses.png
 

Added: trunk/grid/sgrid/gridtype.hh
===================================================================
--- trunk/grid/sgrid/gridtype.hh	                        (rev 0)
+++ trunk/grid/sgrid/gridtype.hh	2008-07-13 13:14:32 UTC (rev 4244)
@@ -0,0 +1,19 @@
+#ifndef DUNE_SGRID_GRIDTYPE_HH
+#define DUNE_SGRID_GRIDTYPE_HH
+
+#include <dune/grid/utility/griddim.hh>
+
+#if defined SGRID
+  #if HAVE_GRIDTYPE
+    #error "Ambiguous definition of GRIDTYPE."
+  #endif
+  #if (GRIDDIM != WORLDDIM)
+    #error "SGRID is only available for GRIDDIM=WORLDDIM."
+  #endif
+
+  #include <dune/grid/sgrid.hh>
+  typedef Dune :: SGrid< dimgrid, dimworld > GridType;
+  #define HAVE_GRIDTYPE 1
+#endif
+
+#endif

Modified: trunk/grid/uggrid/Makefile.am
===================================================================
--- trunk/grid/uggrid/Makefile.am	2008-07-13 13:10:44 UTC (rev 4243)
+++ trunk/grid/uggrid/Makefile.am	2008-07-13 13:14:32 UTC (rev 4244)
@@ -5,7 +5,7 @@
 noinst_LTLIBRARIES = libuggrid.la
 
 libuggrid_la_SOURCES  = uggrid.cc uggridentity.cc boundaryextractor.cc boundaryextractor.hh \
-                        uggridindexsets.cc ugintersectionit.cc uggridfactory.cc
+                        uggridindexsets.cc ugintersectionit.cc uggridfactory.cc gridtype.hh
 
 libuggrid_la_CXXFLAGS = $(AM_CPPFLAGS) $(UG_CPPFLAGS) 
 libuggrid_la_LIBADD   = $(UG_LDFLAGS) $(UG_LIBS) $(DUNE_COMMON_LIBS)

Added: trunk/grid/uggrid/gridtype.hh
===================================================================
--- trunk/grid/uggrid/gridtype.hh	                        (rev 0)
+++ trunk/grid/uggrid/gridtype.hh	2008-07-13 13:14:32 UTC (rev 4244)
@@ -0,0 +1,25 @@
+#ifndef DUNE_UGGRID_GRIDTYPE_HH
+#define DUNE_UGGRID_GRIDTYPE_HH
+
+#include <dune/grid/utility/griddim.hh>
+
+#if defined UGGRID
+  #if HAVE_GRIDTYPE
+    #error "Ambiguous definition of GRIDTYPE."
+  #endif
+  #if not HAVE_UG
+    #error "UGGRID defined but no UG version found!"
+  #endif
+  #if (GRIDDIM < 2) || (GRIDDIM > 3)
+    #error "UGGRID is only available for GRIDDIM=2 and GRIDDIM=3."
+  #endif
+  #if (GRIDDIM != WORLDDIM)
+    #error "UGGRID only supports GRIDDIM=WORLDDIM."
+  #endif
+
+  #include <dune/grid/uggrid.hh>
+  typedef Dune :: UGGrid< dimgrid > GridType;
+  #define HAVE_GRIDTYPE 1
+#endif
+
+#endif

Modified: trunk/grid/utility/Makefile.am
===================================================================
--- trunk/grid/utility/Makefile.am	2008-07-13 13:10:44 UTC (rev 4243)
+++ trunk/grid/utility/Makefile.am	2008-07-13 13:14:32 UTC (rev 4244)
@@ -2,6 +2,6 @@
 
 gridutilitydir =  $(includedir)/dune/grid/utility
 gridutility_HEADERS = hierarchicsearch.hh \
-  grapedataioformattypes.hh intersectiongetter.hh gridtype.hh
+  grapedataioformattypes.hh intersectiongetter.hh gridtype.hh griddim.hh
 
 include $(top_srcdir)/am/global-rules

Copied: trunk/grid/utility/griddim.hh (from rev 4239, trunk/grid/utility/gridtype.hh)
===================================================================
--- trunk/grid/utility/griddim.hh	                        (rev 0)
+++ trunk/grid/utility/griddim.hh	2008-07-13 13:14:32 UTC (rev 4244)
@@ -0,0 +1,22 @@
+#ifndef DUNE_GRIDDIM_HH
+#define DUNE_GRIDDIM_HH
+
+#ifndef GRIDDIM 
+  #warning "GRIDDIM not defined, defaulting to GRIDDIM=3"
+  #define GRIDDIM 3
+#endif
+#if not (GRIDDIM > 0)
+  #error "GRIDDIM must be a positive integer."
+#endif
+
+#ifndef WORLDDIM
+  #define WORLDDIM GRIDDIM
+#endif
+#if (WORLDDIM < GRIDDIM)
+  #error "WORLDDIM < GRIDDIM does not make sense."
+#endif
+
+const int dimgrid = GRIDDIM;
+const int dimworld = WORLDDIM;
+
+#endif

Modified: trunk/grid/utility/gridtype.hh
===================================================================
--- trunk/grid/utility/gridtype.hh	2008-07-13 13:10:44 UTC (rev 4243)
+++ trunk/grid/utility/gridtype.hh	2008-07-13 13:14:32 UTC (rev 4244)
@@ -81,76 +81,27 @@
  * 
  */
 
-#ifndef GRIDDIM 
-  #warning --- No GRIDDIM defined, defaulting to 3
-  const int dimworld = 3;
-  #define GRIDDIM 3
-#else 
-  const int dimworld = GRIDDIM;
-#endif
+#include <dune/grid/utility/griddim.hh>
 
-#if defined ALBERTAGRID
-  #if not HAVE_ALBERTA
-    #error "ALBERTAGRID defined but no ALBERTA version found!"  
+#include <dune/grid/albertagrid/gridtype.hh>
+#include <dune/grid/alugrid/gridtype.hh>
+#include <dune/grid/onedgrid/gridtype.hh>
+#include <dune/grid/sgrid/gridtype.hh>
+#include <dune/grid/uggrid/gridtype.hh>
+#include <dune/grid/yaspgrid/gridtype.hh>
+
+// default grid type
+#ifndef HAVE_GRIDTYPE
+  #if (GRIDDIM != WORLDDIM)
+    #error "No default grid available for GRIDDIM<WORLDDIM."
+    #define HAVE_GRIDTYPE 0
+  #else
+    #warning "No GRIDTYPE defined, defaulting to YASPGRID."
+
+    #include <dune/grid/yaspgrid.hh>
+    typedef Dune :: YaspGrid< dimgrid > GridType;
+    #define HAVE_GRIDTYPE 1
   #endif
-  #if GRIDDIM < 2 || GRIDDIM > 3
-    #error "ALBERTAGRID is only available for GRIDDIM=2 and GRIDDIM=3"
-  #endif
-  #include <dune/grid/albertagrid.hh>
-  typedef Dune::AlbertaGrid<dimworld,dimworld> GridType;
-#elif defined ALUGRID_CUBE
-  #if not HAVE_ALUGRID
-    #error "ALUGRID_CUBE defined but no ALUGRID version found!"
-  #endif
-  #if GRIDDIM != 3
-    #error ALUGRID_CUBE is only available for GRIDDIM=3
-  #endif
-  #include <dune/grid/alugrid.hh>
-  typedef Dune::ALUCubeGrid<dimworld,dimworld> GridType;
-#elif defined ALUGRID_SIMPLEX
-  #if not HAVE_ALUGRID
-    #error "ALUGRID_SIMPLEX defined but no ALUGRID version found!"
-  #endif
-  #if GRIDDIM < 2 || GRIDDIM > 3
-    #error ALUGRID_SIMPLEX is only available for GRIDDIM=2 and GRIDDIM=3
-  #endif
-  #include <dune/grid/alugrid.hh>
-  typedef Dune::ALUSimplexGrid<dimworld,dimworld> GridType;
-#elif defined ALUGRID_CONFORM && HAVE_ALUGRID
-  #if not HAVE_ALUGRID
-    #error "ALUGRID_CONFORM defined but no ALUGRID version found!"
-  #endif
-  #if GRIDDIM != 2
-    #error ALUGRID_CONFORM is only available for GRIDDIM=2
-  #endif
-  #include <dune/grid/alugrid.hh>
-  typedef Dune::ALUConformGrid<dimworld,dimworld> GridType;
-#elif defined ONEDGRID
-  #if GRIDDIM != 1
-    #error ONEDGRID is only available for GRIDDIM=1
-  #endif
-  #include <dune/grid/onedgrid.hh>
-  typedef Dune::OneDGrid GridType;
-#elif defined SGRID
-  #include <dune/grid/sgrid.hh>
-  typedef Dune::SGrid<dimworld,dimworld> GridType;
-#elif defined UGGRID
-  #if not HAVE_UG
-    #error "UGGRID defined but no UG version found!"
-  #endif
-  #if GRIDDIM < 2 || GRIDDIM > 3
-    #error UGGRID is only available for GRIDDIM=2 and GRIDDIM=3
-  #endif
-  #include <dune/grid/uggrid.hh>
-  typedef Dune::UGGrid<dimworld> GridType;
-#elif defined YASPGRID
-  #include <dune/grid/yaspgrid.hh>
-  typedef Dune::YaspGrid<dimworld> GridType;
-#else
-  // fallback
-  #include <dune/grid/yaspgrid.hh>
-  typedef Dune::YaspGrid<dimworld> GridType;
-  #warning --- No GRIDTYPE defined, defaulting to YASPGRID
 #endif
-#undef GRIDDIM
+
 #endif

Modified: trunk/grid/yaspgrid/Makefile.am
===================================================================
--- trunk/grid/yaspgrid/Makefile.am	2008-07-13 13:10:44 UTC (rev 4243)
+++ trunk/grid/yaspgrid/Makefile.am	2008-07-13 13:14:32 UTC (rev 4244)
@@ -1,7 +1,7 @@
 # $Id$
 
 yaspgriddir = $(includedir)/dune/grid/yaspgrid/
-yaspgrid_HEADERS = grids.hh
+yaspgrid_HEADERS = grids.hh gridtype.hh
 
 EXTRA_DIST = grid.fig grid.eps grid.png subgrid.fig subgrid.eps subgrid.png
 

Added: trunk/grid/yaspgrid/gridtype.hh
===================================================================
--- trunk/grid/yaspgrid/gridtype.hh	                        (rev 0)
+++ trunk/grid/yaspgrid/gridtype.hh	2008-07-13 13:14:32 UTC (rev 4244)
@@ -0,0 +1,19 @@
+#ifndef DUNE_YASPGRID_GRIDTYPE_HH
+#define DUNE_YASPGRID_GRIDTYPE_HH
+
+#include <dune/grid/utility/griddim.hh>
+
+#if defined YASPGRID
+  #if HAVE_GRIDTYPE
+    #error "Ambiguous definition of GRIDTYPE."
+  #endif
+  #if (GRIDDIM != WORLDDIM)
+    #error "YASPGRID only supports GRIDDIM=WORLDDIM."
+  #endif
+
+  #include <dune/grid/yaspgrid.hh>
+  typedef Dune :: YaspGrid< dimgrid > GridType;
+  #define HAVE_GRIDTYPE 1
+#endif
+
+#endif


_______________________________________________
Dune-Commit mailing list
Dune-Commit at dune-project.org
http://lists.dune-project.org/mailman/listinfo/dune-commit


-- 
************************************************************************
* Oliver Sander                ** email: sander at mi.fu-berlin.de        *
* Freie Universität Berlin     ** phone: + 49 (30) 838 75217           *
* Institut für Mathematik II   ** URL  : page.mi.fu-berlin.de/~sander  *
* Arnimallee 6                 ** -------------------------------------*
* 14195 Berlin, Germany        ** Member of MATHEON (www.matheon.de)   *
************************************************************************





More information about the Dune mailing list