dune-fem  2.4.1-rc
discontinuousgalerkin/legendre.hh
Go to the documentation of this file.
1 #ifndef DUNE_FEM_SPACE_DISCONTINUOUSGALERKIN_LEGENDRE_HH
2 #define DUNE_FEM_SPACE_DISCONTINUOUSGALERKIN_LEGENDRE_HH
3 
4 #include <cassert>
5 
6 #include <dune/common/power.hh>
7 
8 #include <dune/geometry/type.hh>
9 
10 #include <dune/grid/common/gridenums.hh>
11 
19 
20 #include "basisfunctionsets.hh"
21 #include "declaration.hh"
22 #include "generic.hh"
23 #include "interpolation.hh"
24 #include "shapefunctionsets.hh"
25 
26 namespace Dune
27 {
28 
29  namespace Fem
30  {
31 
32  // LegendreDiscontinuousGalerkinSpaceTraits
33  // ----------------------------------------
34 
35  template< class FunctionSpace, class GridPart, int polOrder, template< class > class Storage >
37  {
39 
41  typedef GridPart GridPartType;
42 
43  static const int codimension = 0;
44 
47  GridPartType::dimension, 1
49 
51  : public Dune::Fem::LegendreShapeFunctionSet< ScalarShapeFunctionSpaceType >
52  {
54  static const int numberShapeFunctions =
55  StaticPower<polOrder+1,ScalarShapeFunctionSpaceType::dimDomain>::power;
56 
57  public:
58  explicit ScalarShapeFunctionSet ( Dune::GeometryType type )
59  : BaseType( polOrder )
60  {
61  assert( type.isCube() );
62  assert( size() == BaseType::size() );
63  }
64 
65  // overload size method because it's a static value
66  unsigned int size() const { return numberShapeFunctions; }
67  };
68 
71 
74 
76  static const int localBlockSize
77  = FunctionSpaceType::dimRange*StaticPower< polOrder+1, GridPartType::dimension >::power;
78 
79  template <class DiscreteFunction, class Operation = DFCommunicationOperation::Copy >
81  {
82  typedef Operation OperationType;
84  };
85  };
86 
87 
88 
89  // LegendreDiscontinuousGalerkinSpace
90  // ----------------------------------
91 
92  template< class FunctionSpace, class GridPart, int polOrder, template< class > class Storage = CachingStorage >
94  : public GenericDiscontinuousGalerkinSpace< LegendreDiscontinuousGalerkinSpaceTraits< FunctionSpace, GridPart, polOrder, Storage > >
95  {
97 
98  public:
99  using BaseType::basisFunctionSet;
100 
101  static const int polynomialOrder = polOrder;
102 
103  typedef typename BaseType::GridPartType GridPartType;
104  typedef typename BaseType::EntityType EntityType;
105 
106  typedef typename BaseType::BasisFunctionSetsType BasisFunctionSetsType;
107  typedef typename BaseType::BasisFunctionSetType BasisFunctionSetType;
108 
110 
111  explicit LegendreDiscontinuousGalerkinSpace ( GridPartType &gridPart,
112  const InterfaceType commInterface = InteriorBorder_All_Interface,
113  const CommunicationDirection commDirection = ForwardCommunication )
114  : BaseType( gridPart, basisFunctionSets( gridPart ), commInterface, commDirection )
115  {}
116 
118 
119  InterpolationType interpolation ( const EntityType &entity ) const
120  {
121  return InterpolationType( basisFunctionSet( entity ) );
122  }
123 
124  private:
125  static BasisFunctionSetsType basisFunctionSets ( const GridPartType &gridPart )
126  {
128  ShapeFunctionSetsType shapeFunctionSets( gridPart );
129  return BasisFunctionSetsType( std::move( shapeFunctionSets ) );
130  }
131  };
132 
133 
134 
135  namespace Capabilities
136  {
137 
138  template< class FunctionSpace, class GridPart, int polOrder, template< class > class Storage >
140  {
141  static const bool v = true;
142  };
143 
144  template< class FunctionSpace, class GridPart, int polOrder, template< class > class Storage >
146  {
147  static const bool v = true;
148  static const int order = polOrder;
149  };
150 
151  template< class FunctionSpace, class GridPart, int polOrder, template< class > class Storage >
152  struct isContinuous< LegendreDiscontinuousGalerkinSpace< FunctionSpace, GridPart, polOrder, Storage > >
153  {
154  static const bool v = false;
155  };
156 
157  template< class FunctionSpace, class GridPart, int polOrder, template< class > class Storage >
158  struct isLocalized< LegendreDiscontinuousGalerkinSpace< FunctionSpace, GridPart, polOrder, Storage > >
159  {
160  static const bool v = true;
161  };
162 
163  template< class FunctionSpace, class GridPart, int polOrder, template< class > class Storage >
164  struct isParallel< LegendreDiscontinuousGalerkinSpace< FunctionSpace, GridPart, polOrder, Storage > >
165  {
167  };
168 
169  template< class FunctionSpace, class GridPart, int polOrder, template< class > class Storage >
170  struct isAdaptive< LegendreDiscontinuousGalerkinSpace< FunctionSpace, GridPart, polOrder, Storage > >
171  {
172  static const bool v = true;
173  };
174 
175  template< class FunctionSpace, class GridPart, int polOrder, template< class > class Storage >
176  struct threadSafe< LegendreDiscontinuousGalerkinSpace< FunctionSpace, GridPart, polOrder, Storage > >
177  {
178  static const bool v = false;
179  };
180 
181  template< class FunctionSpace, class GridPart, int polOrder, template< class > class Storage >
182  struct viewThreadSafe< LegendreDiscontinuousGalerkinSpace< FunctionSpace, GridPart, polOrder, Storage > >
183  {
184  static const bool v = true;
185  };
186 
187  } // namespace Capabilities
188 
189  } // namespace Fem
190 
191 } // namespace Dune
192 
193 #endif // #ifndef DUNE_FEM_SPACE_DISCONTINUOUSGALERKIN_LEGENDRE_HH
Definition: shapefunctionsets.hh:268
Definition: selectcaching.hh:17
VectorSpaceTraits< DomainField, RangeField, dimD, dimR >::RangeFieldType RangeFieldType
Intrinsic type used for values in the range field (usually a double)
Definition: functionspaceinterface.hh:62
specialize with true if the space is localized, * i.e., the basis function set is based on a shape fu...
Definition: space/common/capabilities.hh:64
Definition: discontinuousgalerkin/legendre.hh:80
A vector valued function space.
Definition: functionspace.hh:16
Default communication handler for discrete functions.
Definition: defaultcommhandler.hh:23
specialize with &#39;true&#39; if implementation supports parallelism (default=false)
Definition: gridpart/common/capabilities.hh:59
DFSpaceIdentifier
enumerator for identification of spaces
Definition: discretefunctionspace.hh:88
unsigned int size() const
Definition: discontinuousgalerkin/legendre.hh:66
BaseType::BasisFunctionSetsType BasisFunctionSetsType
Definition: discontinuousgalerkin/legendre.hh:106
a Dune::Fem::ShapeFunctionSet of Legendre ansatz polynomials
Definition: shapefunctionset/legendre.hh:216
Operation OperationType
Definition: discontinuousgalerkin/legendre.hh:82
VectorialShapeFunctionSets< ScalarShapeFunctionSetsType, typename FunctionSpaceType::RangeType > ShapeFunctionSetsType
Definition: discontinuousgalerkin/legendre.hh:70
ShapeFunctionSets ShapeFunctionSetsType
shape function sets type
Definition: discontinuousgalerkin/basisfunctionsets.hh:91
BaseType::BasisFunctionSetType BasisFunctionSetType
Definition: discontinuousgalerkin/legendre.hh:107
BaseType::GridPartType GridPartType
Definition: discontinuousgalerkin/legendre.hh:103
BasisFunctionSetsType::BasisFunctionSetType BasisFunctionSetType
Definition: discontinuousgalerkin/legendre.hh:73
static const int numberShapeFunctions
Definition: discontinuousgalerkin/legendre.hh:54
dimension of range vector space
Definition: functionspaceinterface.hh:47
Definition: discontinuousgalerkin/legendre.hh:36
SelectCachingShapeFunctionSets< GridPartType, ScalarShapeFunctionSet, Storage > ScalarShapeFunctionSetsType
Definition: discontinuousgalerkin/legendre.hh:69
mapper allocating one DoF per subentity of a given codimension
Definition: codimensionmapper.hh:28
VectorSpaceTraits< DomainField, RangeField, dimD, dimR >::DomainFieldType DomainFieldType
Intrinsic type used for values in the domain field (usually a double)
Definition: functionspaceinterface.hh:59
DefaultCommunicationHandler< DiscreteFunction, Operation > Type
Definition: discontinuousgalerkin/legendre.hh:83
specialize with true if space is always continuous
Definition: space/common/capabilities.hh:46
static const int localBlockSize
Definition: discontinuousgalerkin/legendre.hh:77
static DFSpaceIdentifier type()
Definition: discontinuousgalerkin/legendre.hh:117
BaseType::EntityType EntityType
Definition: discontinuousgalerkin/legendre.hh:104
specialize with true if space can be used with AdaptiveDiscreteFunction
Definition: space/common/capabilities.hh:89
Definition: coordinate.hh:4
specialize with true if space can be used in parallel
Definition: space/common/capabilities.hh:76
Definition: space/discontinuousgalerkin/declaration.hh:29
InterpolationType interpolation(const EntityType &entity) const
Definition: discontinuousgalerkin/legendre.hh:119
GridPart GridPartType
Definition: discontinuousgalerkin/legendre.hh:41
LegendreDiscontinuousGalerkinSpace< FunctionSpace, GridPart, polOrder, Storage > DiscreteFunctionSpaceType
Definition: discontinuousgalerkin/legendre.hh:38
generic implementation of a Discontinuous Galerkin space based on a fixed family of basis function se...
Definition: discontinuousgalerkin/generic.hh:33
Definition: discontinuousgalerkin/interpolation.hh:24
CodimensionMapper< GridPartType, codimension > BlockMapperType
Definition: discontinuousgalerkin/legendre.hh:75
Dune::Fem::FunctionSpace< typename FunctionSpace::DomainFieldType, typename FunctionSpace::RangeFieldType, GridPartType::dimension, 1 > ScalarShapeFunctionSpaceType
Definition: discontinuousgalerkin/legendre.hh:48
void move(ArrayInterface< T > &array, const unsigned int oldOffset, const unsigned int newOffset, const unsigned int length)
Definition: array_inline.hh:38
generate a set of default basis function sets from given set of shape function sets ...
Definition: discontinuousgalerkin/basisfunctionsets.hh:82
static const int codimension
Definition: discontinuousgalerkin/legendre.hh:43
specialize with true if polynomial order does not depend on the grid (part) entity ...
Definition: space/common/capabilities.hh:20
Dune::Fem::LegendreShapeFunctionSet< ScalarShapeFunctionSpaceType > BaseType
Definition: discontinuousgalerkin/legendre.hh:53
specialize with true if the space implementation is thread safe
Definition: space/common/capabilities.hh:102
std::size_t size() const noexcept
return number of shape functions
Definition: shapefunctionset/legendre.hh:283
specialize with true if polynomial order fixed and compile time static
Definition: space/common/capabilities.hh:33
LegendreDiscontinuousGalerkinSpace(GridPartType &gridPart, const InterfaceType commInterface=InteriorBorder_All_Interface, const CommunicationDirection commDirection=ForwardCommunication)
Definition: discontinuousgalerkin/legendre.hh:111
DefaultBasisFunctionSets< GridPartType, ShapeFunctionSetsType > BasisFunctionSetsType
Definition: discontinuousgalerkin/legendre.hh:72
specialize with true if the space implementation is thread safe, while it is not modified ...
Definition: space/common/capabilities.hh:116
ScalarShapeFunctionSet(Dune::GeometryType type)
Definition: discontinuousgalerkin/legendre.hh:58
DiscontinuousGalerkinLocalL2Projection< GridPartType, BasisFunctionSetType > InterpolationType
Definition: discontinuousgalerkin/legendre.hh:109
id for Legendre Discontinuous Galerkin Space
Definition: discretefunctionspace.hh:97
Definition: shapefunctionsets.hh:196
int order() const noexcept
return order of shape functions
Definition: shapefunctionset/legendre.hh:280
implementation of a basis function set for given entity
Definition: default.hh:46
FunctionSpace FunctionSpaceType
Definition: discontinuousgalerkin/legendre.hh:40