dune-geometry  2.2.0
codimtable.hh
Go to the documentation of this file.
1 // -*- tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 // vi: set et ts=8 sw=2 sts=2:
3 
4 #ifndef DUNE_GEOMETRY_GENERICGEOMETRY_CODIMTABLE_HH
5 #define DUNE_GEOMETRY_GENERICGEOMETRY_CODIMTABLE_HH
6 
7 #include <dune/common/typetraits.hh>
8 #include <dune/common/tupleutility.hh>
9 
10 namespace Dune
11 {
12 
13  namespace GenericGeometry
14  {
15 
16  template< template< int > class Element, int dim >
17  class CodimTable
18  {
19  friend class CodimTable< Element, dim+1 >;
20 
21  typedef typename PushBackTuple<
22  typename CodimTable< Element, dim-1 >::ElementTuple,
23  Element< dim > >::type ElementTuple;
24 
25  ElementTuple map_;
26 
27  public:
28 
29  template< int codim >
30  const Element< codim > &
31  operator[] ( const integral_constant< int, codim > codimVariable ) const
32  {
33  return Dune::get<codim>(map_);
34  }
35 
36  template< int codim >
37  Element< codim > &
38  operator[] ( const integral_constant< int, codim > codimVariable )
39  {
40  return Dune::get<codim>(map_);
41  }
42  };
43 
44 
45  template< template< int > class Element>
46  class CodimTable< Element, -1 >
47  {
48  friend class CodimTable< Element, 0 >;
49  typedef typename Dune::tuple<> ElementTuple;
50  };
51 
52  }
53 
54 }
55 
56 #endif // #ifndef DUNE_GEOMETRY_GENERICGEOMETRY_CODIMTABLE_HH