1#ifndef HAVE_DUNE_FEM_SPACE_LAGRANGE 
    2#define HAVE_DUNE_FEM_SPACE_LAGRANGE 
    9#include <dune/fem/space/lagrange/space.hh> 
   11#if HAVE_DUNE_LOCALFUNCTIONS 
   13#include <dune/localfunctions/lagrange/equidistantpoints.hh> 
   16#include <dune/fem/gridpart/common/capabilities.hh> 
   17#include <dune/fem/space/localfiniteelement/space.hh> 
   18#include <dune/fem/space/localfiniteelement/dgspace.hh> 
   19#include <dune/fem/space/localfiniteelement/quadratureinterpolation.hh> 
   30#if HAVE_DUNE_LOCALFUNCTIONS 
   31    template< 
class FunctionSpace, 
class Gr
idPart, 
template< 
class, 
unsigned int > 
class PointSet = EquidistantPointSetDerived >
 
   32    class LagrangeFiniteElementMap
 
   34      typedef LagrangeFiniteElementMap< FunctionSpace, GridPart, PointSet > ThisType;
 
   37      typedef GridPart GridPartType;
 
   39      typedef unsigned int KeyType;
 
   44      static const int dimLocal = GridPart::dimension;
 
   46      typedef LagrangeLocalFiniteElement< PointSet,dimLocal,double,double,
 
   54                > LocalFiniteElementType;
 
   55      typedef typename LocalFiniteElementType::Traits::LocalBasisType LocalBasisType;
 
   56      typedef typename LocalFiniteElementType::Traits::LocalCoefficientsType LocalCoefficientsType;
 
   57      typedef typename LocalFiniteElementType::Traits::LocalInterpolationType LocalInterpolationType;
 
   60      static const int pointSetId = detail::SelectPointSetId< PointSet<double, dimLocal> >::value;
 
   62      LagrangeFiniteElementMap ( 
const GridPart &gridPart, 
unsigned int order )
 
   63        : gridPart_( gridPart ), order_( order ), localFeVector_( 
size() )
 
   67          DUNE_THROW(NotImplemented, 
"LagrangeFiniteElementMap is not implemented for order=0, Use FiniteVolume space instead!");
 
   73      int order ()
 const { 
return order_; }
 
   75      template< 
class Entity >
 
   76      int order ( 
const Entity &entity )
 const { 
return order(); }
 
   78      template< 
class Entity >
 
   79      std::tuple< std::size_t, const LocalBasisType &, const LocalInterpolationType & >
 
   80      operator() ( 
const Entity &e )
 const 
   82        unsigned int index = localFiniteElement(e.type());
 
   83        const LocalFiniteElementType &lfe = *(localFeVector_[index]);
 
   84        return std::tuple< std::size_t, const LocalBasisType &, const LocalInterpolationType & >
 
   85          { index, lfe.localBasis(), lfe.localInterpolation() };
 
   88      bool hasCoefficients ( 
const GeometryType &type )
 const { 
return PointSet<double,0>::supports(type,order()); }
 
   90      const LocalCoefficientsType& localCoefficients ( 
const GeometryType &type )
 const 
   92        unsigned int index = localFiniteElement(type);
 
   93        return localFeVector_[index]->localCoefficients();
 
   96      const GridPartType &gridPart ()
 const { 
return gridPart_; }
 
   99      std::size_t localFiniteElement ( 
const GeometryType &type )
 const 
  102        if ( !localFeVector_[ index ] )
 
  103          localFeVector_[ index ].reset( 
new LocalFiniteElementType( type, order_ ) );
 
  107      const GridPartType &gridPart_;
 
  109      mutable std::vector< std::unique_ptr< LocalFiniteElementType > > localFeVector_;
 
  112    template< 
class FunctionSpace, 
class GridPart, 
unsigned int order,
 
  113      template< 
class, 
unsigned int > 
class PointSet = EquidistantPointSetDerived >
 
  114    struct FixedOrderLagrangeFiniteElementMap
 
  115    : 
public LagrangeFiniteElementMap<FunctionSpace,GridPart,PointSet>
 
  117      typedef std::tuple<> KeyType; 
 
  118      static const unsigned int polynomialOrder = order;
 
  119      typedef typename GeometryWrapper<
 
  122        >::ImplType ImplType;
 
  123      typedef GenericLagrangeBaseFunction<
 
  125        > GenericBaseFunctionType;
 
  126      static const unsigned int numBasisFunctions = GenericBaseFunctionType::numBaseFunctions;
 
  127      FixedOrderLagrangeFiniteElementMap ( 
const GridPart &gridPart, 
const KeyType & )
 
  128        : LagrangeFiniteElementMap<FunctionSpace,GridPart,PointSet>(gridPart,order) {
 
  135    template< 
class FunctionSpace, 
class GridPart,
 
  136              template< 
class, 
unsigned int > 
class PointSet = EquidistantPointSetDerived,
 
  137              class Storage = CachingStorage >
 
  139            LagrangeFiniteElementMap< FunctionSpace, GridPart, PointSet >,
 
  140            FunctionSpace, Storage >;
 
  141    template< 
class FunctionSpace, 
class GridPart, 
unsigned int order,
 
  142              template< 
class, 
unsigned int > 
class PointSet = EquidistantPointSetDerived,
 
  143              class Storage = CachingStorage >
 
  144    using FixedOrderLagrangeSpace = LocalFiniteElementSpace<
 
  145            FixedOrderLagrangeFiniteElementMap< FunctionSpace, GridPart, order, PointSet >,
 
  146            FunctionSpace, Storage >;
 
  147    template< 
class FunctionSpace, 
class GridPart,
 
  148              template< 
class, 
unsigned int > 
class PointSet = EquidistantPointSetDerived,
 
  149              class Storage = CachingStorage >
 
  150    using DGLagrangeSpace = DiscontinuousLocalFiniteElementSpace<
 
  151            LagrangeFiniteElementMap< FunctionSpace, GridPart, PointSet >,
 
  152            FunctionSpace, Storage >;
 
  153    template< 
class FunctionSpace, 
class GridPart, 
unsigned int order,
 
  154              template< 
class, 
unsigned int > 
class PointSet = EquidistantPointSetDerived,
 
  155              class Storage = CachingStorage >
 
  156    using FixedOrderDGLagrangeSpace = DiscontinuousLocalFiniteElementSpace<
 
  157            FixedOrderLagrangeFiniteElementMap< FunctionSpace, GridPart, order, PointSet >,
 
  158            FunctionSpace, Storage >;
 
  162    template< 
class FunctionSpace, 
class GridPart,
 
  163              class Storage = CachingStorage >
 
  164    using LagrangeSpace = DynamicLagrangeDiscreteFunctionSpace< FunctionSpace, GridPart, Storage >;
 
FunctionSpaceTraits::DomainFieldType DomainFieldType
Intrinsic type used for values in the domain field (usually a double)
Definition: functionspaceinterface.hh:60
 
FunctionSpaceTraits::RangeFieldType RangeFieldType
Intrinsic type used for values in the range field (usually a double)
Definition: functionspaceinterface.hh:63
 
FunctionSpaceTraits::ScalarFunctionSpaceType ScalarFunctionSpaceType
corresponding scalar function space
Definition: functionspaceinterface.hh:83
 
Lagrange discrete function space.
Definition: space.hh:131
 
static constexpr std::size_t size(std::size_t dim)
Compute total number of geometry types for the given dimension.
Definition: typeindex.hh:61
 
static constexpr std::size_t index(const GeometryType >)
Compute the index for the given geometry type within its dimension.
Definition: typeindex.hh:73
 
A few common exception classes.
 
Convenience header that includes all implementations of Lagrange finite elements.
 
Wrapper for the GNU multiprecision (GMP) library.
 
#define DUNE_THROW(E,...)
Definition: exceptions.hh:314
 
Dune namespace.
Definition: alignedallocator.hh:13
 
constexpr std::integral_constant< std::size_t, sizeof...(II)> size(std::integer_sequence< T, II... >)
Return the size of the sequence.
Definition: integersequence.hh:75
 
specialize with 'true' for if the codimension 0 entity of the grid part has only one possible geometr...
Definition: capabilities.hh:29