[Dune] An issue with the new GridViews

Markus Blatt Markus.Blatt at ipvs.uni-stuttgart.de
Fri Aug 1 10:04:45 CEST 2008


Hi,

On Thu, Jul 31, 2008 at 02:34:38PM +0200, Martin Nolte wrote:
> 
> My suggestion is to return an object because I think this concept is more 
> flexible. But this has two consequences:
>    1) You may not store the reference as you usually do in Dune.
>    2) If the GridView is large, we should use an additional wrapper.
> Personally, I think the problem of storing references is the more important one.
> 
> Maybe, we should also consider a third alternative: We could introduce a 
> GridViewPointer, similar to the EntityPointer. While this may be the clearest 
> concept, it also means a lot of overhead for the implementor of a grid (and 
> this overhead is already very large).
> 

I have a fourth solution:

Why not let the grid implementor decide whether to use a reference or
an object?

We just need a traits class specifying the grids return type. The
default implementation says it is an object and the implementor might
specialize it to his needs.

template<class Grid>
struct LevelViewReturnType{
  typedef typename Grid::LevelViewType type;
};

class MyGrid{
  ...
  LevelViewReturnType<MyGrid>::type levelView(int level);
};

Same functionlity as with a ViePointer and IMHO much clearer.

Cheers,

Markus




More information about the Dune mailing list