/usr/include/dune/pdelab/finiteelementmap/variablemonomfem.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 120 121 122 123 124 125 126 127 128 129 130 | // -*- tab-width: 4; indent-tabs-mode: nil -*-
#ifndef DUNE_PDELAB_VARIABLEMONOMFEM_HH
#define DUNE_PDELAB_VARIABLEMONOMFEM_HH
#include <dune/geometry/type.hh>
#include <dune/localfunctions/common/virtualwrappers.hh>
#include <dune/localfunctions/monom.hh>
#include <dune/common/array.hh>
#include <dune/common/shared_ptr.hh>
#include "finiteelementmap.hh"
namespace Dune {
namespace PDELab {
namespace {
template<class D, class R, int d, int p>
struct InitVariableMonomLocalFiniteElementMap
{
template<typename C>
static void init(C & c, GeometryType gt)
{
typedef Dune::MonomLocalFiniteElement<D,R,d,p> LFE;
typedef typename C::value_type ptr;
c[p] = ptr(new LocalFiniteElementVirtualImp<LFE>(LFE(gt)));
InitVariableMonomLocalFiniteElementMap<D,R,d,p-1>::init(c,gt);
}
};
template<class D, class R, int d>
struct InitVariableMonomLocalFiniteElementMap<D,R,d,-1>
{
template<typename C>
static void init(C &, GeometryType) {}
};
}
//! FiniteElementMap which provides MonomLocalFiniteElement instances, depending on the local polynomial degree
//! \ingroup FiniteElementMap
template<class M, class D, class R, int d, int maxP=6>
class VariableMonomLocalFiniteElementMap
{
typedef typename FixedOrderLocalBasisTraits<
typename MonomLocalFiniteElement<D,R,d,0>::Traits::LocalBasisType::Traits,0>::Traits T;
//! Type of finite element from local functions
typedef LocalFiniteElementVirtualInterface<T> FiniteElementType;
public:
typedef FiniteElementMapTraits<FiniteElementType> Traits;
/** Construct a VariableMonomLocalFiniteElementMap for GeometryType Dune::cube */
VariableMonomLocalFiniteElementMap (const M & m, unsigned int defaultP) :
gt_(Dune::GeometryType::cube,d), mapper_(m), polOrder_(mapper_.size(), defaultP), defaultP_(defaultP)
{
InitVariableMonomLocalFiniteElementMap<D,R,d,maxP>::init(finiteElements_, gt_);
}
/** Construct a VariableMonomLocalFiniteElementMap for a given GeometryType gt */
VariableMonomLocalFiniteElementMap (const M & m, Dune::GeometryType gt, unsigned int defaultP) :
gt_(gt), mapper_(m), polOrder_(mapper_.size(), defaultP), defaultP_(defaultP)
{
InitVariableMonomLocalFiniteElementMap<D,R,d,maxP>::init(finiteElements_, gt_);
}
//! \brief get local basis functions for entity
template<class EntityType>
const typename Traits::FiniteElementType& find (const EntityType& e) const
{
if (e.type() != gt_)
DUNE_THROW(InvalidGeometryType,"Unsupported geometry type: Support only " << gt_ << ", but got " << e.type());
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(VariableElementSize,"VariableMonomLocalFiniteElementMap can contain elements of variable order.");
}
std::size_t maxLocalSize() const
{
DUNE_THROW(VariableElementSize,"VariableMonomLocalFiniteElementMap can contain elements of variable order.");
}
private:
const Dune::GeometryType gt_;
const M & mapper_;
std::vector<unsigned char> polOrder_;
unsigned int defaultP_;
Dune::array< Dune::shared_ptr<FiniteElementType>, maxP+1 > finiteElements_;
};
}
}
#endif //DUNE_PDELAB_VARIABLEMONOMFEM_HH
|