/usr/include/dune/pdelab/finiteelementmap/pkqkfem.hh is in libdune-pdelab-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 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 | // -*- tab-width: 4; indent-tabs-mode: nil -*-
#ifndef DUNE_PDELAB_PKQKFEM_HH
#define DUNE_PDELAB_PKQKFEM_HH
#include <memory>
#include <dune/geometry/type.hh>
#include <dune/localfunctions/common/virtualwrappers.hh>
#include <dune/localfunctions/common/virtualinterface.hh>
#include <dune/common/array.hh>
#include "finiteelementmap.hh"
#include "qkfem.hh"
#include "pkfem.hh"
namespace Dune {
namespace PDELab {
namespace {
/** \brief Construct LocalFiniteElement with a given run-time order
*
* \tparam k Loop variable in a static loop
*/
template<class D, class R, int d, int k>
struct InitPkQkLocalFiniteElementMap
{
/** \brief Set up LocalFiniteElement with order 'order' */
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);
}
};
}
/** \brief FiniteElementMap which provides PkQkLocalFiniteElement instances, depending on the geometry type
* \ingroup FiniteElementMap
*
* \tparam D Type used for coordinates
* \tparam R Type used for shape function values
* \tparam d Grid dimension
* \tparam maxP Approximation order: if you construct an object of this class with its default constructor,
* then this number is the approximation order that you get. If you construct an object giving an order
* at run-time, then maxP is the maximal order that you can request.
*/
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;
/** \brief Default constructor. Constructs a space of order maxP */
PkQkLocalFiniteElementMap ()
: order_(maxP)
{
InitPkQkLocalFiniteElementMap<D,R,d,maxP>::init(finiteElements_,maxP);
}
/** \brief Construct a space with a given order
* \throw Dune::Exception if the requested order is larger than maxP
*/
PkQkLocalFiniteElementMap (unsigned int order)
: order_(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;
}
bool hasDOFs(int codim) const
{
switch (codim)
{
case 0:
return order_ == 0 || order_ > 1;
case d:
return order_ > 0;
default:
return order_ > 1;
}
}
std::size_t size(GeometryType gt) const
{
assert(false && "this method should never be called");
}
std::size_t maxLocalSize() const
{
return (1<<d);
}
private:
std::array< std::shared_ptr<FiniteElementType>, 2 > finiteElements_;
const std::size_t order_;
};
}
}
#endif //DUNE_PDELAB_PKQKFEM_HH
|