dune-fem  2.8-git
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 
20 
21 #include "basisfunctionsets.hh"
22 #include "declaration.hh"
23 #include "generic.hh"
24 #include "localinterpolation.hh"
25 #include "shapefunctionsets.hh"
26 
27 namespace Dune
28 {
29 
30  namespace Fem
31  {
32  // Forward declaration
33  template< class FunctionSpace, class GridPart, int polOrder, class Storage = CachingStorage >
34  class LegendreDiscontinuousGalerkinSpace;
35 
36  template< class FunctionSpace, class GridPart, int polOrder, class Storage = CachingStorage >
37  class HierarchicLegendreDiscontinuousGalerkinSpace;
38 
39  // LegendreDiscontinuousGalerkinSpaceTraits
40  // ----------------------------------------
41 
42  template< class FunctionSpace, class GridPart, int polOrder, class Storage, bool hierarchicalOrdering >
44  {
45  // select space implementation depending on basis function ordering
46  typedef typename std::conditional< hierarchicalOrdering,
49 
50  typedef GridPart GridPartType;
52 
53  static const int codimension = 0;
54 
57  GridPartType::dimension, 1
59 
61  : public Dune::Fem::LegendreShapeFunctionSet< ScalarShapeFunctionSpaceType, hierarchicalOrdering >
62  {
64  static const int numberShapeFunctions =
65  StaticPower<polOrder+1,ScalarShapeFunctionSpaceType::dimDomain>::power;
66 
67  public:
68  explicit ScalarShapeFunctionSet ( Dune::GeometryType type )
69  : BaseType( polOrder )
70  {
71  assert( type.isCube() );
72  assert( size() == BaseType::size() );
73  }
74 
75  // overload size method because it's a static value
76  static constexpr unsigned int size() { return numberShapeFunctions; }
77  };
78 
81 
84 
86 
88 
89  template <class DiscreteFunction, class Operation = DFCommunicationOperation::Copy >
91  {
92  typedef Operation OperationType;
94  };
95  };
96 
97 
98  // LegendreDiscontinuousGalerkinSpaceBase
99  // --------------------------------------
100 
101  template< class FunctionSpace, class GridPart, int polOrder, class Storage, bool hierarchicalOrdering >
103  : public GenericDiscontinuousGalerkinSpace< LegendreDiscontinuousGalerkinSpaceTraits< FunctionSpace, GridPart, polOrder, Storage, hierarchicalOrdering > >
104  {
107 
108  public:
110 
111  static const int polynomialOrder = polOrder;
112 
115 
118 
120  const InterfaceType commInterface = InteriorBorder_All_Interface,
121  const CommunicationDirection commDirection = ForwardCommunication )
122  : BaseType( gridPart, makeBasisFunctionSets( gridPart ), commInterface, commDirection )
123  {}
124 
126 
127  private:
128  static BasisFunctionSetsType makeBasisFunctionSets ( const GridPartType &gridPart )
129  {
130  typedef typename BasisFunctionSetsType::ShapeFunctionSetsType ShapeFunctionSetsType;
131  ShapeFunctionSetsType shapeFunctionSets( gridPart );
132  return BasisFunctionSetsType( std::move( shapeFunctionSets ) );
133  }
134  };
135 
136  // LegendreDiscontinuousGalerkinSpace
137  // ----------------------------------
138 
139  template< class FunctionSpace, class GridPart, int polOrder, class Storage >
141  : public LegendreDiscontinuousGalerkinSpaceBase< FunctionSpace, GridPart, polOrder, Storage, false >
142  {
143  // hierarchicalOrdering = false
146 
147  public:
152 
154  const InterfaceType commInterface = InteriorBorder_All_Interface,
155  const CommunicationDirection commDirection = ForwardCommunication )
156  : BaseType( gridPart, commInterface, commDirection )
157  {}
158 
160  {
161  return InterpolationType( *this );
162  }
163 
164  [[deprecated]]
166  {
167  return interpolation();
168  }
169 
171  {
172  return interpolation();
173  }
174  };
175 
176 
177  namespace Capabilities
178  {
179 
180  template< class FunctionSpace, class GridPart, int polOrder, class Storage >
182  {
183  static const bool v = true;
184  };
185 
186  template< class FunctionSpace, class GridPart, int polOrder, class Storage >
188  {
189  static const bool v = true;
190  static const int order = polOrder;
191  };
192 
193  template< class FunctionSpace, class GridPart, int polOrder, class Storage >
194  struct isContinuous< LegendreDiscontinuousGalerkinSpace< FunctionSpace, GridPart, polOrder, Storage > >
195  {
196  static const bool v = false;
197  };
198 
199  template< class FunctionSpace, class GridPart, int polOrder, class Storage >
200  struct isLocalized< LegendreDiscontinuousGalerkinSpace< FunctionSpace, GridPart, polOrder, Storage > >
201  {
202  static const bool v = true;
203  };
204 
205  template< class FunctionSpace, class GridPart, int polOrder, class Storage >
206  struct isAdaptive< LegendreDiscontinuousGalerkinSpace< FunctionSpace, GridPart, polOrder, Storage > >
207  {
208  static const bool v = true;
209  };
210 
211  template< class FunctionSpace, class GridPart, int polOrder, class Storage >
212  struct threadSafe< LegendreDiscontinuousGalerkinSpace< FunctionSpace, GridPart, polOrder, Storage > >
213  {
214  static const bool v = false;
215  };
216 
217  template< class FunctionSpace, class GridPart, int polOrder, class Storage >
218  struct viewThreadSafe< LegendreDiscontinuousGalerkinSpace< FunctionSpace, GridPart, polOrder, Storage > >
219  {
220  static const bool v = true;
221  };
222 
223  } // namespace Capabilities
224 
225  } // namespace Fem
226 
227 } // namespace Dune
228 
229 #endif // #ifndef DUNE_FEM_SPACE_DISCONTINUOUSGALERKIN_LEGENDRE_HH
DFSpaceIdentifier
enumerator for identification of spaces
Definition: discretefunctionspace.hh:94
@ LegendreDGSpace_id
id for Legendre Discontinuous Galerkin Space
Definition: discretefunctionspace.hh:103
Definition: bindguard.hh:11
typename Impl::GridFunctionSpace< GridPart, T >::Type GridFunctionSpace
Definition: functionspace.hh:317
Definition: hybrid.hh:86
Definition: space/basisfunctionset/default.hh:52
specialize with true if polynomial order does not depend on the grid (part) entity
Definition: space/common/capabilities.hh:24
static const bool v
Definition: space/common/capabilities.hh:25
specialize with true if polynomial order fixed and compile time static
Definition: space/common/capabilities.hh:37
static const bool v
Definition: space/common/capabilities.hh:38
static const int order
Definition: space/common/capabilities.hh:39
specialize with true if space is always continuous
Definition: space/common/capabilities.hh:50
static const bool v
Definition: space/common/capabilities.hh:51
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:68
static const bool v
Definition: space/common/capabilities.hh:69
specialize with true if space can be used with AdaptiveDiscreteFunction
Definition: space/common/capabilities.hh:81
static const bool v
Definition: space/common/capabilities.hh:82
specialize with true if the space implementation is thread safe
Definition: space/common/capabilities.hh:94
static const bool v
Definition: space/common/capabilities.hh:95
specialize with true if the space implementation is thread safe, while it is not modified
Definition: space/common/capabilities.hh:108
static const bool v
Definition: space/common/capabilities.hh:109
Default communication handler for discrete functions.
Definition: defaultcommhandler.hh:29
Traits ::GridPartType GridPartType
type of underlying grid part
Definition: discretefunctionspace.hh:210
GridPartType ::template Codim< Traits::codimension >::EntityType EntityType
type of entity of codimension 0
Definition: discretefunctionspace.hh:223
GridPartType & gridPart() const
Definition: discretefunctionspace.hh:745
A vector valued function space.
Definition: functionspace.hh:60
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
generate a set of default basis function sets from given set of shape function sets
Definition: discontinuousgalerkin/basisfunctionsets.hh:83
Definition: discontinuousgalerkin/legendre.hh:142
BaseType::GridPartType GridPartType
Definition: discontinuousgalerkin/legendre.hh:148
InterpolationType localInterpolation(const EntityType &entity) const
Definition: discontinuousgalerkin/legendre.hh:170
BaseType::EntityType EntityType
Definition: discontinuousgalerkin/legendre.hh:149
LegendreDiscontinuousGalerkinSpace(GridPartType &gridPart, const InterfaceType commInterface=InteriorBorder_All_Interface, const CommunicationDirection commDirection=ForwardCommunication)
Definition: discontinuousgalerkin/legendre.hh:153
InterpolationType interpolation(const EntityType &entity) const
Definition: discontinuousgalerkin/legendre.hh:165
InterpolationType interpolation() const
Definition: discontinuousgalerkin/legendre.hh:159
InterpolationType InterpolationImplType
Definition: discontinuousgalerkin/legendre.hh:151
DiscontinuousGalerkinLocalInterpolation< ThisType > InterpolationType
Definition: discontinuousgalerkin/legendre.hh:150
generic implementation of a Discontinuous Galerkin space based on a fixed family of basis function se...
Definition: discontinuousgalerkin/generic.hh:31
BaseType::BasisFunctionSetType BasisFunctionSetType
type of basis function set of this space
Definition: discontinuousgalerkin/generic.hh:49
BasisFunctionSetType basisFunctionSet(const EntityType &entity) const
get basis function set for given entity
Definition: discontinuousgalerkin/generic.hh:106
Definition: discontinuousgalerkin/legendre.hh:44
Hybrid::IndexRange< int, FunctionSpaceType::dimRange *StaticPower< polOrder+1, GridPartType::dimension >::power > LocalBlockIndices
Definition: discontinuousgalerkin/legendre.hh:87
std::conditional< hierarchicalOrdering, HierarchicLegendreDiscontinuousGalerkinSpace< FunctionSpace, GridPart, polOrder, Storage >, LegendreDiscontinuousGalerkinSpace< FunctionSpace, GridPart, polOrder, Storage > >::type DiscreteFunctionSpaceType
Definition: discontinuousgalerkin/legendre.hh:48
static const int codimension
Definition: discontinuousgalerkin/legendre.hh:53
Dune::Fem::FunctionSpace< typename FunctionSpace::DomainFieldType, typename FunctionSpace::RangeFieldType, GridPartType::dimension, 1 > ScalarShapeFunctionSpaceType
Definition: discontinuousgalerkin/legendre.hh:58
GridFunctionSpace< GridPartType, FunctionSpace > FunctionSpaceType
Definition: discontinuousgalerkin/legendre.hh:51
VectorialShapeFunctionSets< ScalarShapeFunctionSetsType, typename FunctionSpaceType::RangeType > ShapeFunctionSetsType
Definition: discontinuousgalerkin/legendre.hh:80
GridPart GridPartType
Definition: discontinuousgalerkin/legendre.hh:50
CodimensionMapper< GridPartType, codimension > BlockMapperType
Definition: discontinuousgalerkin/legendre.hh:85
DefaultBasisFunctionSets< GridPartType, ShapeFunctionSetsType > BasisFunctionSetsType
Definition: discontinuousgalerkin/legendre.hh:82
SelectCachingShapeFunctionSets< GridPartType, ScalarShapeFunctionSet, Storage > ScalarShapeFunctionSetsType
Definition: discontinuousgalerkin/legendre.hh:79
BasisFunctionSetsType::BasisFunctionSetType BasisFunctionSetType
Definition: discontinuousgalerkin/legendre.hh:83
Dune::Fem::LegendreShapeFunctionSet< ScalarShapeFunctionSpaceType, hierarchicalOrdering > BaseType
Definition: discontinuousgalerkin/legendre.hh:63
static const int numberShapeFunctions
Definition: discontinuousgalerkin/legendre.hh:64
static constexpr unsigned int size()
Definition: discontinuousgalerkin/legendre.hh:76
ScalarShapeFunctionSet(Dune::GeometryType type)
Definition: discontinuousgalerkin/legendre.hh:68
Definition: discontinuousgalerkin/legendre.hh:91
Operation OperationType
Definition: discontinuousgalerkin/legendre.hh:92
DefaultCommunicationHandler< DiscreteFunction, Operation > Type
Definition: discontinuousgalerkin/legendre.hh:93
Definition: discontinuousgalerkin/legendre.hh:104
BaseType::BasisFunctionSetType BasisFunctionSetType
Definition: discontinuousgalerkin/legendre.hh:117
static const int polynomialOrder
Definition: discontinuousgalerkin/legendre.hh:111
LegendreDiscontinuousGalerkinSpaceBase(GridPartType &gridPart, const InterfaceType commInterface=InteriorBorder_All_Interface, const CommunicationDirection commDirection=ForwardCommunication)
Definition: discontinuousgalerkin/legendre.hh:119
static DFSpaceIdentifier type()
Definition: discontinuousgalerkin/legendre.hh:125
BaseType::BasisFunctionSetsType BasisFunctionSetsType
Definition: discontinuousgalerkin/legendre.hh:116
BaseType::EntityType EntityType
Definition: discontinuousgalerkin/legendre.hh:114
BaseType::GridPartType GridPartType
Definition: discontinuousgalerkin/legendre.hh:113
Definition: discontinuousgalerkin/localinterpolation.hh:30
Definition: shapefunctionsets.hh:197
Definition: shapefunctionsets.hh:271
mapper allocating one DoF per subentity of a given codimension
Definition: codimensionmapper.hh:330
a Dune::Fem::ShapeFunctionSet of Legendre ansatz polynomials
Definition: shapefunctionset/legendre.hh:218
std::size_t size() const noexcept
return number of shape functions
Definition: shapefunctionset/legendre.hh:308