[Dune] [#771] configure generated gridtype.hh / dgfgridtype.hh

Dune flyspray at dune-project.org
Tue Apr 13 13:53:15 CEST 2010


THIS IS AN AUTOMATED MESSAGE, DO NOT REPLY.

The following task has a new comment added:

FS#771 - configure generated gridtype.hh / dgfgridtype.hh
User who did this - Robert Klöfkorn (robertk)

----------
@Christian & Olvier:

Maybe you need some extra explanation. I cannot understand your arguments (if we like to call uneasy feelings arguments, no offense here). The gridtype header (an the dgfgridtype when using DGF parser) was designed to allow easy change of grid types in a program code. Without that header code would look like foolows (see also FS#760 an many others):

#define DIMENSION 2

#if HAVE_ALUGRID
    #include <dune/grid/alugrid.hh>
#endif
#if HAVE_UG
    #include <dune/grid/uggrid.hh>
#endif

/// somewhere below 
typedef ALUSimplexGrid<DIMENSION,DIMENSION> GridType;
//typedef UGGrid< DIMENSION > GridType;
.....

So the change of GridType used has to be done manually in the source code. This becomes very uggly when one wants to use more than 2 different grids, which we do by the way.

With the use of gridtype.hh the code looks as follows: 

#include <gridtype.hh>
// this defines GridSelector :: GridType according to defined type and dimension

which is ALUSimplexGrid when using `make GRIDTYPE=ALUGRID_SIMPLEX`
and UGGrid when calling `make GRIDTYPE=UGGRID`

The source code is not changed when changing the GridType. This is very useful when one wants to use for example all available grids in dune-grid. I have to assume that you don't do that, otherwise, you would have stumbled upon the same problem. We in Freiburg, and I guess also Münster, want to use more than 2 grids and we don't want to change the source code for changing the grid type. Another point is, that with this feature program compilation can be automated by using shell scripts. We use this feature when performing EOC analysis of algorithms under development. It helped us a lot to speed up these things. Another thing is, that with packages like ALBERTA you can automaically choose the right library depending on the griddim selected, and so on.

This was all convered by the existing gridtype.hh and dgfgridtype.hh. Now the following problem arises when an external grid is used, e.g. PrismGrid and other grids developed at our institute. To also use this GridType technique the types for PrismGrid have to be added before the original gridtype.hh is included (because at the end of this file there is a check that would fail otherwise). This is very unsatisfying and caused a lot of problems because for every new grid one has to extra include a gridtype file. So the patch we are talking about solves this problem, because for every grid sugested in the dune.module file (also of other projects that can use the macro to generate these files) the grid type definitions are included into the one gridtype.hh header. Furthermore, it increases maintainability of the code because there is only one code for all grids and one can debug by using one grid and does not have to check all grids. Also, if a grid is not available, there is no grid
type definition, which was not possible before and leaded to some strange errors. 
But the best thing of all, if YOU don't like it, you DON'T HAVE TO USE IT. It will never interfere with other stuff. And why, because WE don't like to patronize other users.

To sum up, this patchs gives us: 

- more flexibility of an existing and widely used feature
- better (easier) maintainability because of 
  - centralization of code to one file (two because we excluded the DGF stuff)
  - removal of redundant code

So please tell me why you don't like one of the four points mentioned above, or why you have uneasy feelings about improvemnts (maybe it's a typlical german thing ;) ).  

Best 

R


----------

More information can be found at the following URL:
http://www.dune-project.org/flyspray/index.php?do=details&task_id=771#comment1889

You are receiving this message because you have requested it from the Flyspray bugtracking system.  If you did not expect this message or don't want to receive mails in future, you can change your notification settings at the URL shown above.




More information about the Dune mailing list