1#ifndef HAVE_DUNE_FEM_SPACE_LAGRANGE
2#define HAVE_DUNE_FEM_SPACE_LAGRANGE
6#include <dune/common/gmpfield.hh>
10#if HAVE_DUNE_LOCALFUNCTIONS
11#include <dune/localfunctions/lagrange.hh>
12#include <dune/localfunctions/lagrange/equidistantpoints.hh>
29#if HAVE_DUNE_LOCALFUNCTIONS
30 template<
class FunctionSpace,
class Gr
idPart,
template<
class,
unsigned int >
class PointSet = EquidistantPointSet >
31 class LagrangeFiniteElementMap
33 typedef LagrangeFiniteElementMap< FunctionSpace, GridPart, PointSet > ThisType;
36 typedef GridPart GridPartType;
38 typedef unsigned int KeyType;
40 typedef typename FunctionSpace::DomainFieldType DomainFieldType;
41 typedef typename FunctionSpace::RangeFieldType RangeFieldType;
43 static const int dimLocal = GridPart::dimension;
45 typedef LagrangeLocalFiniteElement< PointSet,dimLocal,double,double,
53 > LocalFiniteElementType;
54 typedef typename LocalFiniteElementType::Traits::LocalBasisType LocalBasisType;
55 typedef typename LocalFiniteElementType::Traits::LocalCoefficientsType LocalCoefficientsType;
56 typedef typename LocalFiniteElementType::Traits::LocalInterpolationType LocalInterpolationType;
59 static const int pointSetId = detail::SelectPointSetId< PointSet<double, dimLocal> >::value;
61 LagrangeFiniteElementMap (
const GridPart &gridPart,
unsigned int order )
62 : gridPart_( gridPart ), order_( order ), localFeVector_( size() )
65 static std::size_t size () {
return LocalGeometryTypeIndex::size(dimLocal); }
67 int order ()
const {
return order_; }
69 template<
class Entity >
70 int order (
const Entity &entity )
const {
return order(); }
72 template<
class Entity >
73 std::tuple< std::size_t, const LocalBasisType &, const LocalInterpolationType & >
74 operator() (
const Entity &e )
const
76 unsigned int index = localFiniteElement(e.type());
77 const LocalFiniteElementType &lfe = *(localFeVector_[index]);
78 return std::tuple< std::size_t, const LocalBasisType &, const LocalInterpolationType & >
79 { index, lfe.localBasis(), lfe.localInterpolation() };
82 bool hasCoefficients (
const GeometryType &type )
const {
return PointSet<double,0>::supports(type,order()); }
84 const LocalCoefficientsType& localCoefficients (
const GeometryType &type )
const
86 unsigned int index = localFiniteElement(type);
87 return localFeVector_[index]->localCoefficients();
90 const GridPartType &gridPart ()
const {
return gridPart_; }
93 std::size_t localFiniteElement (
const GeometryType &type )
const
95 std::size_t index = LocalGeometryTypeIndex::index(type);
96 if ( !localFeVector_[ index ] )
97 localFeVector_[ index ].reset(
new LocalFiniteElementType( type, order_ ) );
101 const GridPartType &gridPart_;
103 mutable std::vector< std::unique_ptr< LocalFiniteElementType > > localFeVector_;
106 template<
class FunctionSpace,
class GridPart,
unsigned int order,
107 template<
class,
unsigned int >
class PointSet = EquidistantPointSet>
108 struct FixedOrderLagrangeFiniteElementMap
109 :
public LagrangeFiniteElementMap<FunctionSpace,GridPart,PointSet>
111 typedef std::tuple<> KeyType;
112 static const unsigned int polynomialOrder = order;
113 typedef typename GeometryWrapper<
116 >::ImplType ImplType;
117 typedef GenericLagrangeBaseFunction<
119 > GenericBaseFunctionType;
120 static const unsigned int numBasisFunctions = GenericBaseFunctionType::numBaseFunctions;
121 FixedOrderLagrangeFiniteElementMap (
const GridPart &gridPart,
const KeyType & )
122 : LagrangeFiniteElementMap<FunctionSpace,GridPart,PointSet>(gridPart,order) {
129 template<
class FunctionSpace,
class GridPart,
130 template<
class,
unsigned int >
class PointSet = EquidistantPointSet,
131 class Storage = CachingStorage >
133 LagrangeFiniteElementMap< FunctionSpace, GridPart, PointSet >,
134 FunctionSpace, Storage >;
135 template<
class FunctionSpace,
class GridPart,
unsigned int order,
136 template<
class,
unsigned int >
class PointSet = EquidistantPointSet,
137 class Storage = CachingStorage >
138 using FixedOrderLagrangeSpace = LocalFiniteElementSpace<
139 FixedOrderLagrangeFiniteElementMap< FunctionSpace, GridPart, order, PointSet >,
140 FunctionSpace, Storage >;
141 template<
class FunctionSpace,
class GridPart,
142 template<
class,
unsigned int >
class PointSet = EquidistantPointSet,
143 class Storage = CachingStorage >
144 using DGLagrangeSpace = DiscontinuousLocalFiniteElementSpace<
145 LagrangeFiniteElementMap< FunctionSpace, GridPart, PointSet >,
146 FunctionSpace, Storage >;
147 template<
class FunctionSpace,
class GridPart,
unsigned int order,
148 template<
class,
unsigned int >
class PointSet = EquidistantPointSet,
149 class Storage = CachingStorage >
150 using FixedOrderDGLagrangeSpace = DiscontinuousLocalFiniteElementSpace<
151 FixedOrderLagrangeFiniteElementMap< FunctionSpace, GridPart, order, PointSet >,
152 FunctionSpace, Storage >;
156 template<
class FunctionSpace,
class GridPart,
157 class Storage = CachingStorage >
Definition: bindguard.hh:11
DynamicLagrangeDiscreteFunctionSpace< FunctionSpace, GridPart, Storage > LagrangeSpace
Definition: lagrange.hh:158
specialize with 'true' for if the codimension 0 entity of the grid part has only one possible geometr...
Definition: gridpart/common/capabilities.hh:29
Lagrange discrete function space.
Definition: lagrange/space.hh:131
FunctionSpaceTraits::ScalarFunctionSpaceType ScalarFunctionSpaceType
corresponding scalar function space
Definition: functionspaceinterface.hh:83