DUNE PDELab (2.8)

simpledofindex.hh
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2// vi: set et ts=4 sw=2 sts=2:
3#ifndef DUNE_PDELAB_COMMON_SIMPLEDOFINDEX_HH
4#define DUNE_PDELAB_COMMON_SIMPLEDOFINDEX_HH
5
7#include <dune/common/hash.hh>
8
9namespace Dune {
10 namespace PDELab {
11
12
13 template<typename F>
14 struct SimpleDOFIndex
15 : public FieldVector<F,1>
16 {
17
18 SimpleDOFIndex()
19 {}
20
21 SimpleDOFIndex(const F& v)
22 : FieldVector<F,1>(v)
23 {}
24
25 F& back()
26 {
27 return (*this)[0];
28 }
29
30 const F& back() const
31 {
32 return (*this)[0];
33 }
34
35 };
36
37
38 template<typename F>
39 struct SimpleContainerIndex
40 : public FieldVector<F,1>
41 {
42
43 SimpleContainerIndex()
44 {}
45
46 SimpleContainerIndex(const F& v)
47 : FieldVector<F,1>(v)
48 {}
49
50 F& back()
51 {
52 return (*this)[0];
53 }
54
55 const F& back() const
56 {
57 return (*this)[0];
58 }
59
60 };
61
62 template<typename F>
63 inline std::size_t hash_value(const SimpleDOFIndex<F>& di)
64 {
65 return di.back();
66 }
67
68 } // namespace PDELab
69} // namespace Dune
70
71DUNE_DEFINE_HASH(DUNE_HASH_TEMPLATE_ARGS(typename F),DUNE_HASH_TYPE(Dune::PDELab::SimpleDOFIndex<F>))
72
73
74#endif // DUNE_PDELAB_COMMON_SIMPLEDOFINDEX_HH
constexpr FieldVector()
Constructor making default-initialized vector.
Definition: fvector.hh:115
Implements a vector constructed from a given type representing a field and a compile-time given size.
constexpr auto back(const HybridTreePath< T... > &tp) -> decltype(treePathEntry< sizeof...(T) -1 >(tp))
Returns a copy of the last element of the HybridTreePath.
Definition: treepath.hh:254
Support for calculating hash values of objects.
#define DUNE_DEFINE_HASH(template_args, type)
Defines the required struct specialization to make type hashable via Dune::hash.
Definition: hash.hh:98
#define DUNE_HASH_TYPE(...)
Wrapper macro for the type to be hashed in DUNE_DEFINE_HASH.
Definition: hash.hh:115
#define DUNE_HASH_TEMPLATE_ARGS(...)
Wrapper macro for the template arguments in DUNE_DEFINE_HASH.
Definition: hash.hh:107
Dune namespace.
Definition: alignedallocator.hh:11
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Dec 22, 23:30, 2024)