DUNE-FEM (unstable)

mapgeomtype.hh
1#ifndef DUNE_FEM_MISC_MAPGEOMTYPE_HH
2#define DUNE_FEM_MISC_MAPGEOMTYPE_HH
3
4//- C++ includes
5#include <vector>
6
7//- dune-geometry includes
10
11
12namespace Dune
13{
14
15 namespace Fem
16 {
17
18 // MapGeometryType
19 // ---------------
20
21 template< int dim, class T >
22 struct MapGeometryType
23 {
25 static const int dimension = dim;
26
28 MapGeometryType ( const T &value = T() )
29 {
30 const size_t size = Dune::LocalGeometryTypeIndex::size( dimension - 1 );
31 data_.resize( size, 0 );
32 }
33
35 const int &operator[] ( const GeometryType &type ) const
36 {
37 const size_t index = Dune::LocalGeometryTypeIndex::index( type );
38 return data_[ index ];
39 }
40
42 int &operator[] ( const GeometryType &type )
43 {
44 return const_cast< int & >( static_cast< const MapGeometryType & >( *this ).operator[]( type ) );
45 }
46
47 private:
48 std::vector< T > data_;
49 };
50
51 } // namespace Fem
52
53} // namespace Dune
54
55#endif // #ifndef DUNE_FEM_MISC_MAPGEOMTYPE_HH
static constexpr std::size_t size(std::size_t dim)
Compute total number of geometry types for the given dimension.
Definition: typeindex.hh:61
static constexpr std::size_t index(const GeometryType &gt)
Compute the index for the given geometry type within its dimension.
Definition: typeindex.hh:73
Dune namespace.
Definition: alignedallocator.hh:13
constexpr std::integral_constant< std::size_t, sizeof...(II)> size(std::integer_sequence< T, II... >)
Return the size of the sequence.
Definition: integersequence.hh:75
A unique label for each type of element that can occur in a grid.
Helper classes to provide indices for geometrytypes for use in a vector.
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 13, 23:29, 2024)