/usr/include/dune/pdelab/finiteelementmap/variableqkdgfem.hh is in libdune-pdelab-dev 2.0.0-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 | // -*- tab-width: 4; indent-tabs-mode: nil -*-
#ifndef DUNE_PDELAB_VARIABLEQKDGFEM_HH
#define DUNE_PDELAB_VARIABLEQKDGFEM_HH
#include <dune/geometry/type.hh>
#include <dune/localfunctions/common/virtualwrappers.hh>
#include <dune/common/array.hh>
#include <dune/common/shared_ptr.hh>
#include "finiteelementmap.hh"
#include "qkdg.hh"
namespace Dune {
namespace PDELab {
namespace {
template<class D, class R, int d, int p>
struct InitVariableQkDGLocalFiniteElementMap
{
template<typename C>
static void init(C & c)
{
typedef Dune::QkDGLocalFiniteElement<D,R,p,d> LFE;
typedef typename C::value_type ptr;
c[p] = ptr(new LocalFiniteElementVirtualImp<LFE>(LFE()));
InitVariableQkDGLocalFiniteElementMap<D,R,d,p-1>::init(c);
}
};
template<class D, class R, int d>
struct InitVariableQkDGLocalFiniteElementMap<D,R,d,-1>
{
template<typename C>
static void init(C & c) {}
};
}
//! FiniteElementMap which provides QkDGLocalFiniteElement instances, depending on the local polynomial degree
//! \ingroup FiniteElementMap
template<class M, class D, class R, int d, int maxP=6>
class VariableQkDGLocalFiniteElementMap
{
typedef typename FixedOrderLocalBasisTraits<
typename QkDGLocalFiniteElement<D,R,0,d>::Traits::LocalBasisType::Traits,0>::Traits T;
//! Type of finite element from local functions
typedef LocalFiniteElementVirtualInterface<T> FiniteElementType;
public:
typedef FiniteElementMapTraits<FiniteElementType> Traits;
VariableQkDGLocalFiniteElementMap (const M & m, unsigned int defaultP) :
mapper_(m), polOrder_(mapper_.size(), defaultP), defaultP_(defaultP)
{
InitVariableQkDGLocalFiniteElementMap<D,R,d,maxP>::init(finiteElements_);
}
//! \brief get local basis functions for entity
template<class EntityType>
const typename Traits::FiniteElementType& find (const EntityType& e) const
{
return getFEM(getOrder(e));
}
//! \brief get local basis functions for a given polynomial order
const typename Traits::FiniteElementType& getFEM (unsigned int p) const
{
return *(finiteElements_[p]);
}
//! \brief get local basis functions for the default order
const typename Traits::FiniteElementType& getFEM () const
{
return *(finiteElements_[defaultP_]);
}
template<class EntityType>
void setOrder (const EntityType& e, unsigned int p)
{
assert(p <= maxP);
unsigned int i = mapper_.map(e);
polOrder_[i] = p;
}
template<class EntityType>
unsigned int getOrder (const EntityType& e) const
{
unsigned int i = mapper_.map(e);
unsigned int p = polOrder_[i];
assert(p <= maxP);
return p;
}
bool fixedSize() const
{
return false;
}
std::size_t size(GeometryType gt) const
{
DUNE_THROW(Dune::Exception,"This should not be called!");
}
std::size_t maxLocalSize() const
{
return getFEM(maxP).localCoefficients().size();
}
private:
const M & mapper_;
std::vector<unsigned char> polOrder_;
unsigned int defaultP_;
Dune::array< Dune::shared_ptr<FiniteElementType>, maxP+1 > finiteElements_;
};
}
}
#endif //DUNE_PDELAB_VARIABLEQKDGFEM_HH
|