/usr/include/dune/localfunctions/utility/localfiniteelement.hh is in libdune-localfunctions-dev 2.5.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 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 | // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
#ifndef DUNE_GENERIC_LOCALFINITEELEMENT_HH
#define DUNE_GENERIC_LOCALFINITEELEMENT_HH
#include <dune/geometry/type.hh>
#include <dune/localfunctions/common/localfiniteelementtraits.hh>
#include <dune/localfunctions/utility/l2interpolation.hh>
#include <dune/localfunctions/utility/dglocalcoefficients.hh>
namespace Dune
{
/**
* \brief A LocalFiniteElement implementation based on three
* TopologyFactories providing the LocalBasis, LocalCoefficients,
* and LocalInterpolations. Note the key type for all three
* factories must coincide.
**/
template< class BasisF, class CoeffF, class InterpolF>
struct GenericLocalFiniteElement
{
typedef GenericLocalFiniteElement<BasisF, CoeffF, InterpolF> This;
typedef LocalFiniteElementTraits< typename BasisF::Object,
typename CoeffF::Object,
typename InterpolF::Object > Traits;
typedef typename BasisF::Key Key;
static const unsigned int dimDomain = BasisF::dimension;
typedef BasisF BasisFactory;
typedef CoeffF CoefficientFactory;
typedef InterpolF InterpolationFactory;
static_assert(std::is_same<Key, typename CoeffF::Key>::value,
"incompatible keys between BasisCreator and CoefficientsCreator");
static_assert(std::is_same<Key, typename InterpolF::Key>::value,
"incompatible keys between BasisCreator and InterpolationCreator" );
/** \todo Please doc me */
GenericLocalFiniteElement ( const GeometryType >, const Key &key )
: topologyId_( gt.id() ),
key_( key ),
finiteElement_()
{
Impl::IfTopology< FiniteElement::template Maker, dimDomain >::apply( topologyId_, key_, finiteElement_ );
}
/** \todo Please doc me */
GenericLocalFiniteElement ( const GenericLocalFiniteElement &other )
: topologyId_( other.topologyId_ ),
key_( other.key_ ),
finiteElement_()
{
Impl::IfTopology< FiniteElement::template Maker, dimDomain >::apply( topologyId_, key_, finiteElement_ );
}
~GenericLocalFiniteElement()
{
finiteElement_.release();
}
/** \todo Please doc me !
*/
const typename Traits::LocalBasisType& localBasis () const
{
return *(finiteElement_.basis_);
}
/** \todo Please doc me !
*/
const typename Traits::LocalCoefficientsType& localCoefficients () const
{
return *(finiteElement_.coeff_);
}
/** \todo Please doc me !
*/
const typename Traits::LocalInterpolationType& localInterpolation () const
{
return *(finiteElement_.interpol_);
}
/** \brief Number of shape functions in this finite element */
unsigned int size () const
{
return finiteElement_.basis_->size();
}
/** \todo Please doc me !
*/
GeometryType type () const
{
return GeometryType(topologyId_,dimDomain);
}
/** \todo Please doc me !
*/
unsigned int topologyId () const
{
return topologyId_;
}
private:
struct FiniteElement
{
FiniteElement() : basis_(0), coeff_(0), interpol_(0) {}
template <class Topology>
void create( const Key &key )
{
release();
basis_ = BasisF::template create<Topology>(key);
coeff_ = CoeffF::template create<Topology>(key);
interpol_ = InterpolF::template create<Topology>(key);
}
void release()
{
if (basis_)
BasisF::release(basis_);
if (coeff_)
CoeffF::release(coeff_);
if (interpol_)
InterpolF::release(interpol_);
basis_=0;
coeff_=0;
interpol_=0;
}
template< class Topology >
struct Maker
{
static void apply ( const Key &key, FiniteElement &finiteElement )
{
finiteElement.template create<Topology>(key);
};
};
typename Traits::LocalBasisType *basis_;
typename Traits::LocalCoefficientsType *coeff_;
typename Traits::LocalInterpolationType *interpol_;
};
unsigned int topologyId_;
Key key_;
FiniteElement finiteElement_;
};
/**
* @brief Takes the basis and interpolation factory from a given
* LocalFiniteElement (derived from GenericLocalFiniteElement)
* and replaces the coefficients with dg local keys, i.e.,
* attaches all degrees of freedom to the codimension zero entity.
**/
template <class FE>
struct DGLocalFiniteElement
: public GenericLocalFiniteElement< typename FE::BasisFactory,
DGLocalCoefficientsFactory< typename FE::BasisFactory >,
typename FE::InterpolationFactory>
{
typedef GenericLocalFiniteElement< typename FE::BasisFactory,
DGLocalCoefficientsFactory< typename FE::BasisFactory >,
typename FE::InterpolationFactory> Base;
public:
typedef typename Base::Traits Traits;
/** \todo Please doc me !
*/
DGLocalFiniteElement ( const GeometryType >, const typename Base::Key &key )
: Base( gt, key )
{}
};
/**
* @brief Takes the basis factory from a given
* LocalFiniteElement (derived from GenericLocalFiniteElement)
* and replaces the coefficients with dg local keys, i.e.,
* attaches all degrees of freedom to the codimension zero entity
* and uses a l2 interpolation.
**/
template <class FE>
struct L2LocalFiniteElement
: public GenericLocalFiniteElement< typename FE::BasisFactory,
DGLocalCoefficientsFactory< typename FE::BasisFactory >,
LocalL2InterpolationFactory< typename FE::BasisFactory, false > >
{
typedef GenericLocalFiniteElement< typename FE::BasisFactory,
DGLocalCoefficientsFactory< typename FE::BasisFactory >,
LocalL2InterpolationFactory< typename FE::BasisFactory, false > > Base;
public:
typedef typename Base::Traits Traits;
/** \todo Please doc me !
*/
L2LocalFiniteElement ( const GeometryType >, const typename Base::Key &key )
: Base( gt, key )
{}
};
}
#endif
|