1 #ifndef DUNE_GENERICGEOMETRY_REFERENCETOPOLOGIES_HH
2 #define DUNE_GENERICGEOMETRY_REFERENCETOPOLOGIES_HH
4 #warning This file is deprecated, and will be removed \
5 after the release of dune-grid-2.2.
7 #include <dune/geometry/genericgeometry/conversion.hh>
8 #include <dune/geometry/genericgeometry/subtopologies.hh>
13 namespace GenericGeometry
19 template<
unsigned int dim >
25 template<
class Topology >
struct Initialize;
30 unsigned int size (
unsigned int codim )
const
33 return info_[ codim ].size();
37 size (
unsigned int codim,
unsigned int i,
unsigned int subcodim )
const
39 assert( (codim <=
dimension) && (i < info_[ codim ].
size()) );
40 return info_[ codim ][ i ].size( subcodim );
43 unsigned int subEntity (
unsigned int codim,
unsigned int i,
44 unsigned int subcodim,
unsigned int j )
const
46 assert( (codim <=
dimension) && (i < info_[ codim ].
size()) );
47 return info_[ codim ][ i ].number( subcodim, j );
50 unsigned int topologyId (
unsigned int codim,
unsigned int i )
const
52 assert( (codim <=
dimension) && (i < info_[ codim ].
size()) );
53 return info_[ codim ][ i ].topologyId();
56 template<
class Topology >
59 typedef Initialize< Topology > Init;
60 ForLoop< Init::template Codim, 0, dimension >::apply( info_ );
64 std::vector< SubEntityInfo > info_[
dimension+1 ];
72 template<
unsigned int dim >
75 template<
class Topology,
unsigned int codim >
struct Initialize
81 unsigned int size (
unsigned int subcodim )
const
83 return numbering_[ subcodim ].size();
86 unsigned int number (
unsigned int subcodim,
unsigned int j )
const
88 return numbering_[ subcodim ][ j ];
96 template<
class Topology,
unsigned int codim,
unsigned int i >
100 typedef typename GenericGeometry::SubTopology< Topology, codim, i >::type SubTopology;
103 topologyId_ = SubTopology::id;
104 numbering_.resize( SubTopology::dimension+1 );
106 const unsigned int iVariable = i;
107 ForLoop< Init::template SubCodim, 0, SubTopology::dimension >::apply( iVariable, numbering_ );
112 unsigned int topologyId_;
113 std::vector< std::vector< unsigned int > > numbering_;
117 template<
unsigned int dim >
118 template<
class Topology,
unsigned int codim >
119 template<
int subcodim >
122 typedef SubTopologySize< Topology, codim, subcodim >
Size;
123 typedef SubTopologyNumbering< Topology, codim, subcodim >
Numbering;
126 apply (
unsigned int i, std::vector< std::vector< unsigned int > > &numbering )
128 const unsigned int size = Size::size( i );
129 numbering[ subcodim ].resize( size );
130 for(
unsigned int j = 0; j <
size; ++j )
131 numbering[ subcodim ][ j ] = Numbering::number( i, j );
139 template<
unsigned int dim >
140 template<
class Topology >
143 template<
int codim >
149 static void apply ( std::vector< SubEntityInfo > &info )
151 info[ i ].template initialize< Topology, codim, i >();
155 static void apply ( std::vector< SubEntityInfo > (&info)[ dim+1 ] )
157 const unsigned int size = Size< Topology, codim >::value;
158 info[ codim ].resize( size );
159 ForLoop< SubTopology, 0, size-1 >::apply( info[ codim ] );
168 template<
unsigned int dim >
173 template<
int topologyId >
185 return instance().refTopology_[ topologyId ];
191 ForLoop< Init, 0, numTopologies-1 >::apply( refTopology_ );
194 ReferenceTopologies (
const This & );
195 This &operator= (
const This & );
197 static const This &instance ()
199 static This instance;
207 template<
unsigned int dim >
208 template<
int topologyId >
209 struct ReferenceTopologies< dim >::Init
213 typedef typename GenericGeometry::Topology< topologyId, dimension >::type Topology;
214 refTopology[ topologyId ].template initialize< Topology >();
222 #endif // #ifndef DUNE_GENERICGEOMETRY_REFERENCETOPOLOGIES_HH