DUNE-FEM (unstable)

legendre.hh
1#ifndef DUNE_FEM_HPDG_SPACE_DISCONTINUOUSGALERKIN_LEGENDRE_HH
2#define DUNE_FEM_HPDG_SPACE_DISCONTINUOUSGALERKIN_LEGENDRE_HH
3
4#include <dune/grid/common/gridenums.hh>
5
6#include <dune/fem/operator/matrix/istlmatrixadapter.hh>
7#include <dune/fem/space/common/capabilities.hh>
8#include <dune/fem/space/common/commoperations.hh>
9#include <dune/fem/space/common/defaultcommhandler.hh>
10#include <dune/fem/space/common/localrestrictprolong.hh>
11#include <dune/fem/space/discontinuousgalerkin/localrestrictprolong.hh>
12
13#include <dune/fem/space/shapefunctionset/selectcaching.hh>
14#include <dune/fem/space/basisfunctionset/hpdg/legendre.hh>
15
16#include "blockmapper.hh"
17#include "space.hh"
18
19namespace Dune
20{
21
22 namespace Fem
23 {
24
25 namespace hpDG
26 {
27
28 // Internal forward declaration
29 // ----------------------------
30
31 template< class FunctionSpace, class GridPart, int order, class Storage = Fem::CachingStorage >
32 class LegendreDiscontinuousGalerkinSpace;
33
34 template< class FunctionSpace, class GridPart, int order, class Storage = Fem::CachingStorage >
35 class HierarchicLegendreDiscontinuousGalerkinSpace;
36
37
38#ifndef DOXYGEN
39
40 // LegendreDiscontinuousGalerkinSpaceTraits
41 // ----------------------------------------
42
43 template< class FunctionSpace, class GridPart, int order, bool hierarchicalOrdering, class Storage >
44 struct LegendreDiscontinuousGalerkinSpaceTraits
45 {
46 // select space implementation depending on basis function ordering
47 typedef typename std::conditional< hierarchicalOrdering,
48 HierarchicLegendreDiscontinuousGalerkinSpace< FunctionSpace, GridPart, order, Storage >,
49 LegendreDiscontinuousGalerkinSpace< FunctionSpace, GridPart, order, Storage > >::type DiscreteFunctionSpaceType;
50
51 using FunctionSpaceType = FunctionSpace;
52
53 using GridPartType = GridPart;
54
55 using BasisFunctionSetsType = hpDG::LegendreBasisFunctionSets< FunctionSpaceType, GridPartType, order, hierarchicalOrdering, Storage >;
56 using BasisFunctionSetType = typename BasisFunctionSetsType::BasisFunctionSetType;
57
58 static const int codimension = BasisFunctionSetType::EntityType::codimension;
59
60 using BlockMapperType = hpDG::DiscontinuousGalerkinBlockMapper< GridPartType, BasisFunctionSetsType >;
61 static const int localBlockSize = BasisFunctionSetsType::localBlockSize;
62
63 typedef Hybrid::IndexRange< int, localBlockSize > LocalBlockIndices;
64
65 template< class DiscreteFunction, class Operation = Dune::Fem::DFCommunicationOperation::Copy >
66 struct CommDataHandle
67 {
68 using OperationType = Operation;
70 };
71 };
72
73#endif // #ifndef DOXYGEN
74
75
76
77 // LegendreDiscontinuousGalerkinSpace
78 // ----------------------------------
79
89 template< class FunctionSpace, class GridPart, int order, class Storage >
91 : public hpDG::DiscontinuousGalerkinSpace< LegendreDiscontinuousGalerkinSpaceTraits< FunctionSpace, GridPart, order, false, Storage > >
92 {
94
95 public:
96 static const int polynomialOrder = order;
97
98 using GridPartType = typename BaseType::GridPartType;
99 using BasisFunctionSetsType = typename BaseType::BasisFunctionSetsType;
100
101 explicit LegendreDiscontinuousGalerkinSpace ( GridPartType &gridPart,
104 : BaseType( gridPart, BasisFunctionSetsType{}, order, interface, direction )
105 {}
106
107 template< class Function >
108 LegendreDiscontinuousGalerkinSpace ( GridPartType &gridPart, Function function,
111 : BaseType( gridPart, BasisFunctionSetsType{}, order, function, interface, direction )
112 {}
113 };
114
115 // HierarchicLegendreDiscontinuousGalerkinSpace
116 // --------------------------------------------
117
127 template< class FunctionSpace, class GridPart, int order, class Storage >
129 : public hpDG::DiscontinuousGalerkinSpace< LegendreDiscontinuousGalerkinSpaceTraits< FunctionSpace, GridPart, order, true, Storage > >
130 {
132
133 public:
134 static const int polynomialOrder = order;
135
136 using GridPartType = typename BaseType::GridPartType;
137 using EntityType = typename BaseType::EntityType;
138 using BasisFunctionSetsType = typename BaseType::BasisFunctionSetsType;
139
143 : BaseType( gridPart, BasisFunctionSetsType{}, order, interface, direction )
144 {}
145
146 template <class Function,
147 std::enable_if_t<
148 std::is_arithmetic<
149 decltype(Function(std::declval<const EntityType>()))>::value,int> i=0>
153 : BaseType( gridPart, BasisFunctionSetsType{}, order, function, interface, direction )
154 {}
155 };
156
157 } // namespace hpDG
158
159
160
161#ifndef DOXYGEN
162
163 // DefaultLocalRestrictProlong
164 // ---------------------------
165
166 template< class FunctionSpace, class GridPart, int order, class Storage >
167 class DefaultLocalRestrictProlong< hpDG::LegendreDiscontinuousGalerkinSpace< FunctionSpace, GridPart, order, Storage > >
168 : public DiscontinuousGalerkinLocalRestrictProlong< hpDG::LegendreDiscontinuousGalerkinSpace< FunctionSpace, GridPart, order, Storage >, false >
169 {
170 using BaseType = DiscontinuousGalerkinLocalRestrictProlong< hpDG::LegendreDiscontinuousGalerkinSpace< FunctionSpace, GridPart, order, Storage >, false >;
171
172 public:
173 explicit DefaultLocalRestrictProlong ( const typename BaseType::DiscreteFunctionSpaceType &space )
174 : BaseType( space )
175 {}
176 };
177
178
179 // DefaultLocalRestrictProlong
180 // ---------------------------
181
182 template< class FunctionSpace, class GridPart, int order, class Storage >
183 class DefaultLocalRestrictProlong< hpDG::HierarchicLegendreDiscontinuousGalerkinSpace< FunctionSpace, GridPart, order, Storage > >
184 : public DiscontinuousGalerkinLocalRestrictProlong< hpDG::HierarchicLegendreDiscontinuousGalerkinSpace< FunctionSpace, GridPart, order, Storage >, false >
185 {
186 using BaseType = DiscontinuousGalerkinLocalRestrictProlong< hpDG::HierarchicLegendreDiscontinuousGalerkinSpace< FunctionSpace, GridPart, order, Storage >, false >;
187
188 public:
189 explicit DefaultLocalRestrictProlong ( const typename BaseType::DiscreteFunctionSpaceType &space )
190 : BaseType( space )
191 {}
192 };
193
194
195#endif // #ifndef DOXYGEN
196
197
198 namespace Capabilities
199 {
201 // hpDG::LegendreDiscontinuousGalerkinSpace
203
204 template< class FunctionSpace, class GridPart, int polOrder, class Storage >
205 struct hasStaticPolynomialOrder< hpDG::LegendreDiscontinuousGalerkinSpace< FunctionSpace, GridPart, polOrder, Storage > >
206 {
207 static const bool v = true;
208 static const int order = polOrder;
209 };
210
211 template< class FunctionSpace, class GridPart, int polOrder, class Storage >
212 struct isLocalized< hpDG::LegendreDiscontinuousGalerkinSpace< FunctionSpace, GridPart, polOrder, Storage > >
213 {
214 static const bool v = true;
215 };
216
217 template< class FunctionSpace, class GridPart, int polOrder, class Storage >
218 struct isAdaptive< hpDG::LegendreDiscontinuousGalerkinSpace< FunctionSpace, GridPart, polOrder, Storage > >
219 {
220 static const bool v = true;
221 };
222
223 template< class FunctionSpace, class GridPart, int polOrder, class Storage >
224 struct viewThreadSafe< hpDG::LegendreDiscontinuousGalerkinSpace< FunctionSpace, GridPart, polOrder, Storage > >
225 {
226 static const bool v = true;
227 };
228
230 // hpDG::HierarchicLegendreDiscontinuousGalerkinSpace
232
233 template< class FunctionSpace, class GridPart, int polOrder, class Storage >
234 struct hasStaticPolynomialOrder< hpDG::HierarchicLegendreDiscontinuousGalerkinSpace< FunctionSpace, GridPart, polOrder, Storage > >
235 {
236 static const bool v = true;
237 static const int order = polOrder;
238 };
239
240 template< class FunctionSpace, class GridPart, int polOrder, class Storage >
241 struct isLocalized< hpDG::HierarchicLegendreDiscontinuousGalerkinSpace< FunctionSpace, GridPart, polOrder, Storage > >
242 {
243 static const bool v = true;
244 };
245
246 template< class FunctionSpace, class GridPart, int polOrder, class Storage >
247 struct isAdaptive< hpDG::HierarchicLegendreDiscontinuousGalerkinSpace< FunctionSpace, GridPart, polOrder, Storage > >
248 {
249 static const bool v = true;
250 };
251
252 template< class FunctionSpace, class GridPart, int polOrder, class Storage >
253 struct viewThreadSafe< hpDG::HierarchicLegendreDiscontinuousGalerkinSpace< FunctionSpace, GridPart, polOrder, Storage > >
254 {
255 static const bool v = true;
256 };
257
258 template< class FunctionSpace, class GridPart, int polOrder, class Storage >
259 struct isHierarchic< hpDG::HierarchicLegendreDiscontinuousGalerkinSpace< FunctionSpace, GridPart, polOrder, Storage > >
260 {
261 static const bool v = true;
262 };
263
264 } // namespace Capabilities
265
266 } // namespace Fem
267
268} // namespace Dune
269
270#endif // #ifndef DUNE_FEM_HPDG_SPACE_DISCONTINUOUSGALERKIN_LEGENDRE_HH
Default communication handler for discrete functions.
Definition: defaultcommhandler.hh:38
A vector valued function space.
Definition: functionspace.hh:60
Abstract class representing a function.
Definition: function.hh:50
Generic implementation of a -adaptive discontinuous finite element space.
Definition: space.hh:46
typename Traits::BasisFunctionSetsType BasisFunctionSetsType
basis function sets type
Definition: space.hh:56
Implementation of an -adaptive discrete function space using product Legendre polynomials.
Definition: legendre.hh:130
Implementation of an -adaptive discrete function space using product Legendre polynomials.
Definition: legendre.hh:92
CommunicationDirection
Define a type for communication direction parameter.
Definition: gridenums.hh:170
InterfaceType
Parameter to be used for the communication functions.
Definition: gridenums.hh:86
@ ForwardCommunication
communicate as given in InterfaceType
Definition: gridenums.hh:171
@ InteriorBorder_All_Interface
send interior and border, receive all entities
Definition: gridenums.hh:88
Dune namespace.
Definition: alignedallocator.hh:13
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Jul 27, 22:29, 2024)