/usr/include/dune/localfunctions/common/localkey.hh is in libdune-localfunctions-dev 2.5.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
#ifndef DUNE_LOCALKEY_HH
#define DUNE_LOCALKEY_HH
#include <array>
#include <cstddef>
#include <ostream>
namespace Dune
{
/**@ingroup LocalLayoutInterface
\brief Describe position of one degree of freedom
A LocalKey associates a degree of freedom with an index
of a local basis function.
\nosubgrouping
*/
class LocalKey
{
public:
/** \brief Enumerate 'special values' for the codimension method */
enum {
/** \brief Codimension returned by LocalKey::codim() for degrees of freedom attached to an intersection
The standard interface of dune-localfunctions assumes that degrees of freedom are attached to subentities
of an element. This subentities can be described by a codimension and a subentity number.
However some elements, like the mimetic finite elements, attach their degrees of freedom to intersections.
While intersections do have a codimension, namely 1, having the method codim() return 1 in this case
would be ambiguous. Hence 'intersectionCodim' is returned instead.
*/
intersectionCodim=666
};
//! \brief Standard constructor for uninitialized local index
LocalKey ()
{}
/** \brief Initialize all components
\param s Local number of the associated subentity
\param c Codimension of the associated subentity
\param i Index in the set of all functions associated to this subentity
*/
LocalKey (unsigned int s, unsigned int c, unsigned int i)
{
values_[0] = s;
values_[1] = c;
values_[2] = i;
}
//! \brief Return number of associated subentity
inline unsigned int subEntity () const
{
return values_[0];
}
//! \brief Return codim of associated entity
inline unsigned int codim () const
{
return values_[1];
}
//! \brief Return offset within subentity
inline unsigned int index () const
{
return values_[2];
}
//! \brief Set index component
void index (unsigned int i)
{
values_[2] = i;
}
/** \brief Less-than operator so we can use this class as a key type in stl containers */
bool operator< (const LocalKey& other) const
{
return values_ < other.values_;
}
/** \brief Write LocalKey object to output stream */
friend std::ostream& operator<< (std::ostream& s, const LocalKey& localKey)
{
return s << "[ subEntity: " << localKey.subEntity()
<< ", codim: " << localKey.codim()
<< ", index: " << localKey.index() << " ]";
}
private:
// We use an array to store the values in order to be able to use the array::operator< implementation
std::array<unsigned int,3> values_;
};
}
#endif
|