#1318 Make GridView implementations arguments to the GridFamily class
Metadata
Property | Value |
---|---|
Reported by | Oliver Sander (oliver.sander@tu-dresden.de) |
Reported at | Jun 27, 2013 14:15 |
Type | Feature Request |
Version | Git (pre2.4) [autotools] |
Operating System | Unspecified / All |
Description
The GridFamily
class in dune/grid/common/grid.h centralizes all types exported by a Dune grid. It has a long list of template parameters (20, at the moment), all of which are implementation classes (For example, GeometryImp
-- the class type that will implement a grid's geometry). GridFamily
then adds the interface wrappers around these types.
An exception to this rule, however, are LeafGridView
and LevelGridView
. There, GridFamily
expects not the implementation class, but a traits class. The wrapper class GridView
is then instantiated with the traits instead of the implementation class. And the wrapper then extract the actual implementation type from the traits.
This exceptional behavior is undesirable because
- it makes the
GridFamily
interface inconsistent - the type propagation is more difficult to understand: the wrapper class
has to ask the
Traits
class for the implementation type - it is more difficult to write a grid-specific implementation of a grid view, because one is forced to provide a traits class even if there is nothing I would want to parametrize with it.
My proposal: reverse the order. The GridFamily
gets the GridViewImp
classes.
The DefaultGridView
classes take their Traits
classes as arguments.
This change would be visible only to maintainers of grid implementation. A bit of judicious
template magic could probably even make GridFamily
accept both imp classes and traits
for a transition period.