Dune Core Modules (2.6.0)

localkey.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_LOCALKEY_HH
4#define DUNE_LOCALKEY_HH
5
6#include <array>
7#include <cstddef>
8#include <ostream>
9
10namespace Dune
11{
21 {
22 public:
23
25 enum {
35 };
36
39 {}
40
46 LocalKey (unsigned int s, unsigned int c, unsigned int i)
47 {
48 values_[0] = s;
49 values_[1] = c;
50 values_[2] = i;
51 }
52
54 inline unsigned int subEntity () const
55 {
56 return values_[0];
57 }
58
60 inline unsigned int codim () const
61 {
62 return values_[1];
63 }
64
66 inline unsigned int index () const
67 {
68 return values_[2];
69 }
70
72 void index (unsigned int i)
73 {
74 values_[2] = i;
75 }
76
78 bool operator< (const LocalKey& other) const
79 {
80 return values_ < other.values_;
81 }
82
84 friend std::ostream& operator<< (std::ostream& s, const LocalKey& localKey)
85 {
86 return s << "[ subEntity: " << localKey.subEntity()
87 << ", codim: " << localKey.codim()
88 << ", index: " << localKey.index() << " ]";
89 }
90
91 private:
92
93 // We use an array to store the values in order to be able to use the array::operator< implementation
94 std::array<unsigned int,3> values_;
95
96 };
97
98}
99#endif
Describe position of one degree of freedom.
Definition: localkey.hh:21
LocalKey()
Standard constructor for uninitialized local index.
Definition: localkey.hh:38
unsigned int index() const
Return offset within subentity.
Definition: localkey.hh:66
unsigned int codim() const
Return codim of associated entity.
Definition: localkey.hh:60
unsigned int subEntity() const
Return number of associated subentity.
Definition: localkey.hh:54
LocalKey(unsigned int s, unsigned int c, unsigned int i)
Initialize all components.
Definition: localkey.hh:46
bool operator<(const LocalKey &other) const
Less-than operator so we can use this class as a key type in stl containers.
Definition: localkey.hh:78
void index(unsigned int i)
Set index component.
Definition: localkey.hh:72
friend std::ostream & operator<<(std::ostream &s, const LocalKey &localKey)
Write LocalKey object to output stream.
Definition: localkey.hh:84
@ intersectionCodim
Codimension returned by LocalKey::codim() for degrees of freedom attached to an intersection.
Definition: localkey.hh:34
Dune namespace.
Definition: alignedallocator.hh:10
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 24, 23:30, 2024)