1#ifndef DUNE_FEM_COMMON_GEOMETRYTYPEMAP_HH
2#define DUNE_FEM_COMMON_GEOMETRYTYPEMAP_HH
8#include <dune/geometry/type.hh>
9#include <dune/geometry/typeindex.hh>
41 template<
class T,
int dim,
class TypeIndex >
45 typedef std::array< T, TypeIndex::size( dim ) > Container;
55 typedef typename Container::pointer
pointer;
125 constexpr Size size () const noexcept {
return TypeIndex::size( dim ); }
129 constexpr bool empty () const noexcept {
return (
size() > 0); }
138 Value &
operator[] (
const GeometryType &type ) {
return container_[ TypeIndex::index( type ) ]; }
140 const Value &
operator[] (
const GeometryType &type )
const {
return container_[ TypeIndex::index( type ) ]; }
143 Value &
at (
const GeometryType &type ) {
return container_.at( TypeIndex::index( type ) ); }
145 const Value &
at (
const GeometryType &type )
const {
return container_.at( TypeIndex::index( type ) ); }
155 const Value &
back ()
const {
return container_.back(); }
160 const Value *
data () const noexcept {
return container_.data(); }
169 void fill (
const Value &value ) { container_.fill( value ); }
172 void swap (
This &other )
noexcept(
noexcept(
swap(std::declval<Value &>(), std::declval<Value &>())))
174 container_.swap( other.container_ );
180 Container container_;
196 template<
class T,
int dim >
212 template<
class T,
int maxdim >
Definition: bindguard.hh:11
associative container assigning values to each GeometryType
Definition: geometrytypemap.hh:43
iterator Iterator
iterator type
Definition: geometrytypemap.hh:70
const Value & back() const
access last element
Definition: geometrytypemap.hh:155
constexpr Size max_size() const noexcept
return maximum size
Definition: geometrytypemap.hh:127
Container::size_type size_type
size type
Definition: geometrytypemap.hh:63
Container::const_iterator const_iterator
const iterator type
Definition: geometrytypemap.hh:61
void fill(const Value &value)
fill container with value
Definition: geometrytypemap.hh:169
void swap(This &other) noexcept(noexcept(swap(std::declval< Value & >(), std::declval< Value & >())))
swap content
Definition: geometrytypemap.hh:172
GeometryTypeMap(const This &)=default
copy constructor
ConstIterator begin() const noexcept
return iterator to beginning
Definition: geometrytypemap.hh:108
value_type Value
value type
Definition: geometrytypemap.hh:68
This & operator=(const This &)=default
copy assignment
Container::const_reference const_reference
const reference type
Definition: geometrytypemap.hh:53
Iterator end() noexcept
return iterator to end
Definition: geometrytypemap.hh:106
Value & operator[](const GeometryType &type)
access element
Definition: geometrytypemap.hh:138
Value & front()
access first element
Definition: geometrytypemap.hh:148
Value & back()
access last element
Definition: geometrytypemap.hh:153
Value * data() noexcept
get pointer to data
Definition: geometrytypemap.hh:158
Iterator begin() noexcept
return iterator to beginning
Definition: geometrytypemap.hh:104
Container::const_pointer const_pointer
const pointer type
Definition: geometrytypemap.hh:57
Container::difference_type difference_type
difference type
Definition: geometrytypemap.hh:65
GeometryTypeMap(This &&)=default
move constructor
const Value * data() const noexcept
get pointer to data
Definition: geometrytypemap.hh:160
constexpr bool empty() const noexcept
test whether container is empty
Definition: geometrytypemap.hh:129
Container::iterator iterator
iterator type
Definition: geometrytypemap.hh:59
constexpr Size size() const noexcept
return size
Definition: geometrytypemap.hh:125
GeometryTypeMap()
default constructor
Definition: geometrytypemap.hh:82
const Value & front() const
access first element
Definition: geometrytypemap.hh:150
ConstIterator cbegin() const noexcept
return const_iterator to beginning
Definition: geometrytypemap.hh:113
const_iterator ConstIterator
iterator type
Definition: geometrytypemap.hh:72
Container::pointer pointer
pointer type
Definition: geometrytypemap.hh:55
Container::reference reference
reference type
Definition: geometrytypemap.hh:51
size_type Size
size type
Definition: geometrytypemap.hh:74
ConstIterator end() const noexcept
return iterator to end
Definition: geometrytypemap.hh:110
Container::value_type value_type
value type
Definition: geometrytypemap.hh:49
const Value & at(const GeometryType &type) const
access element
Definition: geometrytypemap.hh:145
Value & at(const GeometryType &type)
access element
Definition: geometrytypemap.hh:143
ConstIterator cend() const noexcept
return const_iterator to end
Definition: geometrytypemap.hh:115