1 #ifndef DUNE_DYNAMICCODIMSUBINDEXID_HH
2 #define DUNE_DYNAMICCODIMSUBINDEXID_HH
4 #include <dune/common/forloop.hh>
5 #include <dune/common/typetraits.hh>
6 #include <dune/geometry/genericgeometry/conversion.hh>
8 #warning This file is deprecated and will be removed after the release of dune-grid 2.2.
16 template<
class Gr
id,
class IndexSet >
21 typedef typename remove_const< Grid >::type::Traits Traits;
23 static const unsigned int dimension = remove_const< Grid >::type::dimension;
25 typedef typename Traits::template Codim< 0 >::Entity Element;
37 subIndex (
const IndexSet &indexSet,
const Element &e,
int i )
const = 0;
45 subIndex (
const IndexSet &indexSet,
const Element &e,
int i )
const
47 typedef GenericGeometry::MapNumberingProvider< dimension > Numbering;
48 const unsigned int tid = GenericGeometry::topologyId( e.type() );
49 const int j = Numbering::template generic2dune< codim >( tid, i );
50 return indexSet.template subIndex< codim >( e, j );
53 static void apply (
const Caller *(&caller)[ dimension+1 ] )
55 caller[ codim ] =
new CallerImpl< codim >;
60 DynamicSubIndex (
const This & );
61 This &operator= (
const This & );
65 : indexSet_( indexSet )
67 Dune::ForLoop< CallerImpl, 0, dimension >::apply( caller_ );
72 for(
unsigned int codim = 0; codim <= dimension; ++codim )
73 delete caller_[ codim ];
78 assert( codim <= dimension );
79 return caller_[ codim ]->subIndex( indexSet_, e, i );
84 const Caller *caller_[ dimension+1 ];
92 template<
class Gr
id,
class IdSet >
97 typedef typename remove_const< Grid >::type::Traits Traits;
99 static const unsigned int dimension = remove_const< Grid >::type::dimension;
101 typedef typename Traits::template Codim< 0 >::Entity Element;
113 subId (
const IdSet &idSet,
const Element &e,
int i )
const = 0;
116 template<
int codim >
121 subId (
const IdSet &idSet,
const Element &e,
int i )
const
123 typedef GenericGeometry::MapNumberingProvider< dimension > Numbering;
124 const unsigned int tid = GenericGeometry::topologyId( e.type() );
125 const int j = Numbering::template generic2dune< codim >( tid, i );
126 return idSet.template subId< codim >( e, j );
129 static void apply (
const Caller *(&caller)[ dimension+1 ] )
131 caller[ codim ] =
new CallerImpl< codim >;
136 DynamicSubId (
const This & );
137 This &operator= (
const This & );
143 Dune::ForLoop< CallerImpl, 0, dimension >::apply( caller_ );
148 for(
unsigned int codim = 0; codim <= dimension; ++codim )
149 delete caller_[ codim ];
154 assert( codim <= dimension );
155 return caller_[ codim ]->subId( idSet_, e, i );
160 const Caller *caller_[ dimension+1 ];
165 #endif // #ifndef DUNE_DYNAMICCODIMSUBINDEXID_HH