/usr/include/dune/localfunctions/lagrange/pk2d/pk2dlocalcoefficients.hh is in libdune-localfunctions-dev 2.4.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 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
#ifndef DUNE_PK2DLOCALCOEFFICIENTS_HH
#define DUNE_PK2DLOCALCOEFFICIENTS_HH
#include <cstddef>
#include <vector>
#include <dune/localfunctions/common/localkey.hh>
namespace Dune
{
/**@ingroup LocalLayoutImplementation
\brief Layout map for P0 elements
\nosubgrouping
\implements Dune::LocalCoefficientsVirtualImp
*/
template<unsigned int k>
class Pk2DLocalCoefficients
{
enum {N = (k+1)*(k+2)/2};
public:
//! \brief Standard constructor
Pk2DLocalCoefficients () : li(N)
{
fill_default();
}
//! constructor for eight variants with order on edges flipped
Pk2DLocalCoefficients (int variant) : li(N)
{
fill_default();
bool flip[3];
for (int i = 0; i < 3; ++i)
flip[i] = variant & (1<<i);
for (int i=0; i<N; i++)
if (li[i].codim()==1 && flip[li[i].subEntity()])
li[i].index(k-2-li[i].index());
}
/** Constructor for six variants with permuted vertices.
\param vertexmap The permutation of the vertices. This
can for instance be generated from the global indices of
the vertices by reducing those to the integers 0...2. This may be any
object which for which the expression \c vertexmap[i] is defined
apropriately (like an array, a pointer, a std::vector, or a
random-access iterator.
*/
template<class VertexMap>
explicit Pk2DLocalCoefficients(const VertexMap &vertexmap) : li(N)
{
fill_default();
bool flip[3];
flip[0] = vertexmap[0] > vertexmap[1];
flip[1] = vertexmap[0] > vertexmap[2];
flip[2] = vertexmap[1] > vertexmap[2];
for (std::size_t i=0; i<N; i++)
if (li[i].codim()==1 && flip[li[i].subEntity()])
li[i].index(k-2-li[i].index());
}
//! number of coefficients
std::size_t size () const
{
return N;
}
//! get i'th index
const LocalKey& localKey (std::size_t i) const
{
return li[i];
}
private:
std::vector<LocalKey> li;
void fill_default ()
{
if (k==0)
{
li[0] = LocalKey(0,0,0);
return;
}
int n=0;
int c=0;
for (unsigned int j=0; j<=k; j++)
for (unsigned int i=0; i<=k-j; i++)
{
if (i==0 && j==0)
{
li[n++] = LocalKey(0,2,0);
continue;
}
if (i==k && j==0)
{
li[n++] = LocalKey(1,2,0);
continue;
}
if (i==0 && j==k)
{
li[n++] = LocalKey(2,2,0);
continue;
}
if (j==0)
{
li[n++] = LocalKey(0,1,i-1);
continue;
}
if (i==0)
{
li[n++] = LocalKey(1,1,j-1);
continue;
}
if (i+j==k)
{
li[n++] = LocalKey(2,1,j-1);
continue;
}
li[n++] = LocalKey(0,0,c++);
}
}
};
}
#endif
|