dune-geometry
2.2.0
|
00001 // -*- tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- 00002 // vi: set et ts=8 sw=2 sts=2: 00003 00004 #ifndef DUNE_GEOMETRY_GENERICGEOMETRY_CODIMTABLE_HH 00005 #define DUNE_GEOMETRY_GENERICGEOMETRY_CODIMTABLE_HH 00006 00007 #include <dune/common/typetraits.hh> 00008 #include <dune/common/tupleutility.hh> 00009 00010 namespace Dune 00011 { 00012 00013 namespace GenericGeometry 00014 { 00015 00016 template< template< int > class Element, int dim > 00017 class CodimTable 00018 { 00019 friend class CodimTable< Element, dim+1 >; 00020 00021 typedef typename PushBackTuple< 00022 typename CodimTable< Element, dim-1 >::ElementTuple, 00023 Element< dim > >::type ElementTuple; 00024 00025 ElementTuple map_; 00026 00027 public: 00028 00029 template< int codim > 00030 const Element< codim > & 00031 operator[] ( const integral_constant< int, codim > codimVariable ) const 00032 { 00033 return Dune::get<codim>(map_); 00034 } 00035 00036 template< int codim > 00037 Element< codim > & 00038 operator[] ( const integral_constant< int, codim > codimVariable ) 00039 { 00040 return Dune::get<codim>(map_); 00041 } 00042 }; 00043 00044 00045 template< template< int > class Element> 00046 class CodimTable< Element, -1 > 00047 { 00048 friend class CodimTable< Element, 0 >; 00049 typedef typename Dune::tuple<> ElementTuple; 00050 }; 00051 00052 } 00053 00054 } 00055 00056 #endif // #ifndef DUNE_GEOMETRY_GENERICGEOMETRY_CODIMTABLE_HH