[Dune] Problems concerning GridTraits
Christian Engwer
christi at uni-hd.de
Fri Sep 9 14:04:43 CEST 2005
Hi,
Peter and me are currently discussing the changes in the Grid
interface class needed for the indexsets. We wanted to add the methods
leafindexset, levelindexset, etc. to the interface class. These
methods should return a reference to an indexset object and the type
of this indexset object must be implementation specific.
This leads to a problem:
FooGrid is derived from Grid<FooGrid>.
Grid uses FooGrid::Traits::LeafIndexSetType as the returntype of
leafIndexSet(), but when Grid<FooGrid> gets instaciated, FooGrid
isn't a complete class. so that it is impossible to extract
FooGrid::Traits::LeafIndexSetType. The reason this worked till now
is, that ann methods that nedded type information from
FooGrid::Traits were template methods. All non template methods can't
use FooGrid::Traits in their declaration.
We propose the following small change to deal with this problem:
We parametrize GridDefault/Grid with the GridTraits struct instead
of the FooGrid class itself. This results in only very small
changes in the Grid implementations and few changes in common/grid.hh.
Currently the Grid class keeps all associated information:
template<int dim, int dimw>
class FooGrid: public GridDefault<dim,dimworld,ctype,FooGrid<dim,dimw> >
{
typedef GridTraits<.....> Traits;
...
}
We propose to move these Informations to an external Traits structs
and use these traits to parametrize the interface class:
typedef GridTraits<.....> FooGridTraits;
template<int dim, int dimw>
class FooGrid: public GridDefault<dim,dimworld,FooGridTraits>
{
...
}
This should be sufficient to solve all described problems. Are there
any comments, any objections? We would try to get this running and
report on the results.
Cheers Christian and Peter
More information about the Dune
mailing list