[Dune] Problems concerning GridTraits
Peter Bastian
Peter.Bastian at iwr.uni-heidelberg.de
Fri Sep 9 15:51:41 CEST 2005
Robert Kloefkorn schrieb:
> Adrian Burri wrote:
>
>>Hi,
>>
>>I support the proposed idea. Maybe it's a good idea to export the type
>>of the new external grid traits class under the name "Traits" in the
>>grid class as well. (That was probably the intention anyway, but it
>>isn't listed in the code snippet.)
>>Just a note regarding the naming: the access methods should be called
>>{leaf,level}IndexSet according to the Dune naming conventions.
>
>
> This is a very good idea. This feature is also supported by the IBM
> Compiler which might then compile the Dune code.
>
This might be a little to optimistic :-)
OK, we have done it and that is what you have to do:
STEP 1
======
Create a class "FooGridFamily" in front of your grid. For yaspgrid this
looks like
template<int dim, int dimworld>
struct YaspGridFamily
{
typedef GridTraits<dim,dimworld,Dune::YaspGrid<dim,dimworld>,
YaspGeometry,YaspEntity,YaspBoundaryEntity,
YaspEntityPointer,YaspLevelIterator,
YaspIntersectionIterator,YaspHierarchicIterator,
YaspLevelIterator,
YaspLevelIndexSet<YaspGrid<dim,dimworld> >,
YaspLevelIndexSet<YaspGrid<dim,dimworld> >,
YaspGlobalIdSet<YaspGrid<dim,dimworld> >,
yaspgrid_persistentindextype,
YaspGlobalIdSet<YaspGrid<dim,dimworld> >,
yaspgrid_persistentindextype> Traits;
};
This class collects all types related to a grid implementation.
Note the last 6 parameters are for the index and id sets.
STEP 2
======
In the public derivation of your grid from GridDefault use the
GridFamily instead of the grid (example for yaspgrid):
template<int dim, int dimworld>
class YaspGrid :
public
GridDefault<dim,dimworld,yaspgrid_ctype,YaspGridFamily<dim,dimworld> >,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
public MultiYGrid<dim,yaspgrid_ctype>
{
...
STEP 3
======
In your grid implementation keep the Traits typedef for backward
compatibility which now reads
typedef typename YaspGridFamily<dim,dimworld>::Traits Traits;
Thats all!
Please be patient the next minutes because we have to check in these things.
Peter & Christian
--
------------------------------------------------------------------
Peter Bastian, IWR,Uni Heidelberg, INF 348,R 020, 69120 Heidelberg
email: Peter.Bastian at iwr.uni-heidelberg.de Tel: +49 6221 54 4984
WWW: http://www.iwr.uni-heidelberg.de/~Peter.Bastian Fax: ... 8860
More information about the Dune
mailing list