1#ifndef DUNE_GEOMETRY_TYPEINDEXSET_HH
2#define DUNE_GEOMETRY_TYPEINDEXSET_HH
6#include <dune/geometry/type.hh>
24 template<
int dim,
bool regular = false >
33 inline static constexpr std::size_t
size () noexcept
35 return (1 << dim) - ((1 << dim) >> 1);
38 inline static constexpr std::size_t
index (
const GeometryType &type )
noexcept
40 return (type.id() >> 1);
43 inline static constexpr bool contains (
const GeometryType &type )
noexcept
45 return ((type.dim() == dim) && !type.isNone());
48 inline static GeometryType
type ( std::size_t index )
noexcept
50 return GeometryType(
static_cast< unsigned int >( index ) << 1, dim );
61 inline static constexpr std::size_t
size () noexcept
63 return (RegularTypeIndexSet::size() + 1);
66 inline static constexpr std::size_t
index (
const GeometryType &type )
noexcept
68 return (type.isNone() ? RegularTypeIndexSet::size() : type.id() >> 1);
71 inline static constexpr bool contains (
const GeometryType &type )
noexcept
73 return (type.dim() == dim);
76 inline static GeometryType
type ( std::size_t index )
noexcept
78 return (index < RegularTypeIndexSet::size() ? RegularTypeIndexSet::type( index ) : GeometryType( 0, dim,
true ));
94 template<
int maxdim,
bool regular = false >
97 template<
int maxdim >
103 inline static constexpr std::size_t
size () noexcept
105 return (1 << maxdim);
108 inline static constexpr std::size_t
index (
const GeometryType &type )
noexcept
110 return ((1 << type.dim()) + type.id()) >> 1;
113 inline static constexpr bool contains (
const GeometryType &type )
noexcept
115 return ((type.dim() <= maxdim) && !type.isNone());
118 inline static GeometryType
type ( std::size_t index )
noexcept
120 return GeometryType( (index << 1) & ~(1 << dim( index )), dim( index ) );
124 inline static constexpr int dim ( std::size_t index,
int d = maxdim )
126 return ((d <= 0) || ((index & (1 << (d-1))) != 0) ? d : dim( index, d-1 ));
130 template<
int maxdim >
137 inline static constexpr std::size_t
size () noexcept
139 return RegularTypeIndexSet::size() + (maxdim + 1);
142 inline static constexpr std::size_t
index (
const GeometryType &type )
noexcept
144 return (type.isNone() ? RegularTypeIndexSet::size() + type.dim() : RegularTypeIndexSet::index( type ));
147 inline static constexpr bool contains (
const GeometryType &type )
noexcept
149 return (type.dim() <= maxdim);
152 inline static GeometryType
type ( std::size_t index )
noexcept
154 return (index < RegularTypeIndexSet::size() ? RegularTypeIndexSet::type( index ) : GeometryType( 0,
static_cast< int >( index - RegularTypeIndexSet::size() ),
true ));
170 template<
unsigned int topologyId,
int dim >
176 inline static constexpr std::size_t
size () noexcept
181 inline static constexpr std::size_t
index (
const GeometryType &
type )
noexcept
186 inline static constexpr bool contains (
const GeometryType &
type )
noexcept
188 return (
type == GeometryType( topologyId, dim ));
191 inline static GeometryType
type ( std::size_t
index )
noexcept
193 return GeometryType( topologyId, dim );
202 template<
class TypeIndexSet >
Definition: bindguard.hh:11
Please doc me.
Definition: typeindexset.hh:25
Definition: typeindexset.hh:29
static constexpr std::size_t index(const GeometryType &type) noexcept
Definition: typeindexset.hh:38
static GeometryType type(std::size_t index) noexcept
Definition: typeindexset.hh:48
static constexpr std::size_t size() noexcept
Definition: typeindexset.hh:33
static constexpr bool contains(const GeometryType &type) noexcept
Definition: typeindexset.hh:43
Definition: typeindexset.hh:56
static GeometryType type(std::size_t index) noexcept
Definition: typeindexset.hh:76
static constexpr bool contains(const GeometryType &type) noexcept
Definition: typeindexset.hh:71
static constexpr std::size_t index(const GeometryType &type) noexcept
Definition: typeindexset.hh:66
static constexpr std::size_t size() noexcept
Definition: typeindexset.hh:61
Please doc me.
Definition: typeindexset.hh:95
Definition: typeindexset.hh:99
static constexpr bool contains(const GeometryType &type) noexcept
Definition: typeindexset.hh:113
static GeometryType type(std::size_t index) noexcept
Definition: typeindexset.hh:118
static constexpr std::size_t index(const GeometryType &type) noexcept
Definition: typeindexset.hh:108
static constexpr std::size_t size() noexcept
Definition: typeindexset.hh:103
Definition: typeindexset.hh:132
static GeometryType type(std::size_t index) noexcept
Definition: typeindexset.hh:152
static constexpr std::size_t size() noexcept
Definition: typeindexset.hh:137
static constexpr std::size_t index(const GeometryType &type) noexcept
Definition: typeindexset.hh:142
static constexpr bool contains(const GeometryType &type) noexcept
Definition: typeindexset.hh:147
Please doc me.
Definition: typeindexset.hh:172
static constexpr std::size_t index(const GeometryType &type) noexcept
Definition: typeindexset.hh:181
static GeometryType type(std::size_t index) noexcept
Definition: typeindexset.hh:191
static constexpr std::size_t size() noexcept
Definition: typeindexset.hh:176
static constexpr bool contains(const GeometryType &type) noexcept
Definition: typeindexset.hh:186
Definition: typeindexset.hh:204
Iterator end() const
Definition: typeindexset.hh:218
Iterator begin() const
Definition: typeindexset.hh:217
Definition: typeindexset.hh:206
bool operator!=(const Iterator &other) const
Definition: typeindexset.hh:208
bool operator==(const Iterator &other) const
Definition: typeindexset.hh:207
Iterator & operator++()
Definition: typeindexset.hh:212
GeometryType operator*() const
Definition: typeindexset.hh:210
std::size_t index
Definition: typeindexset.hh:214