/usr/include/dune/pdelab/finiteelementmap/pkqkfem.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 | // -*- tab-width: 4; indent-tabs-mode: nil -*-
#ifndef DUNE_PDELAB_PKQKFEM_HH
#define DUNE_PDELAB_PKQKFEM_HH
#include <dune/geometry/type.hh>
#include <dune/localfunctions/common/virtualwrappers.hh>
#include <dune/localfunctions/common/virtualinterface.hh>
#include <dune/common/array.hh>
#include <dune/common/shared_ptr.hh>
#include "finiteelementmap.hh"
#include "qkfem.hh"
#include "pkfem.hh"
namespace Dune {
namespace PDELab {
namespace {
template<class D, class R, int d, int k>
struct InitPkQkLocalFiniteElementMap
{
template<typename C>
static void init(C & c, unsigned int order)
{
if (order == k)
{
typedef Dune::QkLocalFiniteElement<D,R,d,k> QkLFE;
typedef Dune::PkLocalFiniteElement<D,R,d,k> PkLFE;
typedef typename C::value_type ptr;
c[0] = ptr(new LocalFiniteElementVirtualImp<QkLFE>(QkLFE()));
c[1] = ptr(new LocalFiniteElementVirtualImp<PkLFE>(PkLFE()));
}
else
InitPkQkLocalFiniteElementMap<D,R,d,k-1>::init(c,order);
}
};
template<class D, class R, int d>
struct InitPkQkLocalFiniteElementMap<D,R,d,-1>
{
template<typename C>
static void init(C & c, unsigned int order)
{
DUNE_THROW(Exception, "Sorry, but we failed to initialize a QkPk FiniteElementMap of order " << order);
}
};
}
//! FiniteElementMap which provides PkQkLocalFiniteElement instances, depending on the geometry type
//! \ingroup FiniteElementMap
template<class D, class R, int d, int maxP=6>
class PkQkLocalFiniteElementMap
{
//! Type of finite element from local functions
typedef LocalFiniteElementVirtualInterface<Dune::LocalBasisTraits<D,d,Dune::FieldVector<D,d>,R,1,Dune::FieldVector<R,1>,Dune::FieldMatrix<R,1,d>,0> > FiniteElementType;
public:
typedef FiniteElementMapTraits<FiniteElementType> Traits;
PkQkLocalFiniteElementMap ()
{
InitPkQkLocalFiniteElementMap<D,R,d,maxP>::init(finiteElements_,maxP);
}
PkQkLocalFiniteElementMap (unsigned int order)
{
InitPkQkLocalFiniteElementMap<D,R,d,maxP>::init(finiteElements_,order);
}
//! \brief get local basis functions for entity
template<class EntityType>
const typename Traits::FiniteElementType& find (const EntityType& e) const
{
typename Dune::GeometryType geoType=e.type();
return getFEM(geoType);
}
//! \brief get local basis functions for a given geometrytype
const typename Traits::FiniteElementType& getFEM (Dune::GeometryType gt) const
{
if (gt.isCube())
{
return *(finiteElements_[0]);
}
if (gt.isSimplex())
{
return *(finiteElements_[1]);
}
DUNE_THROW(Exception, "We can only handle cubes and simplices");
}
bool fixedSize() const
{
return false;
}
std::size_t size(GeometryType gt) const
{
assert(false && "this method should never be called");
}
std::size_t maxLocalSize() const
{
return (1<<d);
}
private:
Dune::array< Dune::shared_ptr<FiniteElementType>, 2 > finiteElements_;
};
}
}
#endif //DUNE_PDELAB_PKQKFEM_HH
|