DUNE-FEM (unstable)

space.hh
1#ifndef DUNE_FEM_SPACE_DISCONTINUOUSGALERKIN_SPACE_HH
2#define DUNE_FEM_SPACE_DISCONTINUOUSGALERKIN_SPACE_HH
3
4#include <utility>
5
7
8#include <dune/grid/common/gridenums.hh>
9
10#include <dune/fem/common/hybrid.hh>
11#include <dune/fem/gridpart/common/capabilities.hh>
12#include <dune/fem/space/common/capabilities.hh>
13#include <dune/fem/space/common/commoperations.hh>
14#include <dune/fem/space/common/defaultcommhandler.hh>
15#include <dune/fem/space/common/functionspace.hh>
16#include <dune/fem/space/shapefunctionset/orthonormal.hh>
17#include <dune/fem/space/shapefunctionset/selectcaching.hh>
18
19#include "basisfunctionsets.hh"
20#include "declaration.hh"
21#include "generic.hh"
22#include "localinterpolation.hh"
23#include "interpolation.hh"
24#include "shapefunctionsets.hh"
25
26namespace Dune
27{
28
29 namespace Fem
30 {
31
32 // DiscontinuousGalerkinSpaceTraits
33 // --------------------------------
34
35 template< class FunctionSpace, class GridPart, int polOrder, class Storage >
36 struct DiscontinuousGalerkinSpaceTraits
37 {
38 typedef DiscontinuousGalerkinSpace< FunctionSpace, GridPart, polOrder, Storage > DiscreteFunctionSpaceType;
39
40 typedef GridPart GridPartType;
41 typedef GridFunctionSpace< GridPartType, FunctionSpace > FunctionSpaceType;
42
43 static const int codimension = 0;
44
47 GridPartType::dimension, 1
48 > ScalarShapeFunctionSpaceType;
49
50 struct ScalarShapeFunctionSet
51 : public Dune::Fem::OrthonormalShapeFunctionSet< ScalarShapeFunctionSpaceType >
52 {
53 typedef Dune::Fem::OrthonormalShapeFunctionSet< ScalarShapeFunctionSpaceType > BaseType;
54
55 static constexpr int numberShapeFunctions =
56 OrthonormalShapeFunctions< ScalarShapeFunctionSpaceType::dimDomain >::size(polOrder);
57 public:
58 explicit ScalarShapeFunctionSet ( Dune::GeometryType type )
59 : BaseType( type, polOrder )
60 {
61 assert( size() == BaseType::size() );
62 }
63
64 // overload size method because it's a static value
65 static constexpr unsigned int size() { return numberShapeFunctions; }
66 };
67
68
69
70 typedef SelectCachingShapeFunctionSets< GridPartType, ScalarShapeFunctionSet, Storage > ScalarShapeFunctionSetsType;
71 typedef VectorialShapeFunctionSets< ScalarShapeFunctionSetsType, typename FunctionSpaceType::RangeType > ShapeFunctionSetsType;
72
73 typedef DefaultBasisFunctionSets< GridPartType, ShapeFunctionSetsType > BasisFunctionSetsType;
74 typedef typename BasisFunctionSetsType::BasisFunctionSetType BasisFunctionSetType;
75
76 typedef CodimensionMapper< GridPartType, codimension > BlockMapperType;
77
78 typedef Hybrid::IndexRange< int, FunctionSpaceType::dimRange * ScalarShapeFunctionSet::numberShapeFunctions > LocalBlockIndices;
79
80 template <class DiscreteFunction, class Operation = DFCommunicationOperation::Copy >
81 struct CommDataHandle
82 {
83 typedef Operation OperationType;
84 typedef DefaultCommunicationHandler< DiscreteFunction, Operation > Type;
85 };
86 };
87
88
89
90 // DiscontinuousGalerkinSpace
91 // --------------------------
92
93 template< class FunctionSpace, class GridPart, int polOrder, class Storage = CachingStorage >
94 class DiscontinuousGalerkinSpace
95 : public GenericDiscontinuousGalerkinSpace< DiscontinuousGalerkinSpaceTraits< FunctionSpace, GridPart, polOrder, Storage > >
96 {
97 typedef GenericDiscontinuousGalerkinSpace< DiscontinuousGalerkinSpaceTraits< FunctionSpace, GridPart, polOrder, Storage > > BaseType;
98 typedef DiscontinuousGalerkinSpace< FunctionSpace, GridPart, polOrder, Storage > ThisType;
99
100 public:
102
103 static const int polynomialOrder = polOrder;
104
105 typedef typename BaseType::GridPartType GridPartType;
106 typedef typename BaseType::EntityType EntityType;
107
108 typedef typename BaseType::BasisFunctionSetsType BasisFunctionSetsType;
109 typedef typename BaseType::BasisFunctionSetType BasisFunctionSetType;
110
111 typedef DiscontinuousGalerkinLocalInterpolation< ThisType > InterpolationType;
112 typedef InterpolationType InterpolationImplType;
113
114
115 explicit DiscontinuousGalerkinSpace ( GridPartType &gridPart,
116 const InterfaceType commInterface = InteriorBorder_All_Interface,
117 const CommunicationDirection commDirection = ForwardCommunication )
118 : BaseType( gridPart, makeBasisFunctionSets( gridPart ), commInterface, commDirection )
119 {}
120
121 InterpolationType interpolation () const
122 {
123 return InterpolationType( *this );
124 }
125
126 [[deprecated]]
127 InterpolationType interpolation ( const EntityType &entity ) const
128 {
129 return interpolation ();
130 }
131
132 InterpolationType localInterpolation ( const EntityType &entity ) const
133 {
134 return interpolation ();
135 }
136
137 private:
138 static BasisFunctionSetsType makeBasisFunctionSets ( const GridPartType &gridPart )
139 {
140 typedef typename BasisFunctionSetsType::ShapeFunctionSetsType ShapeFunctionSetsType;
141 ShapeFunctionSetsType shapeFunctionSets( gridPart );
142 return BasisFunctionSetsType( std::move( shapeFunctionSets ) );
143 }
144 };
145
146
147
148 namespace Capabilities
149 {
150
151 template< class FunctionSpace, class GridPart, int polOrder, class Storage >
152 struct hasFixedPolynomialOrder< DiscontinuousGalerkinSpace< FunctionSpace, GridPart, polOrder, Storage > >
153 {
154 static const bool v = true;
155 };
156
157 template< class FunctionSpace, class GridPart, int polOrder, class Storage >
158 struct hasStaticPolynomialOrder< DiscontinuousGalerkinSpace< FunctionSpace, GridPart, polOrder, Storage > >
159 {
160 static const bool v = true;
161 static const int order = polOrder;
162 };
163
164 template< class FunctionSpace, class GridPart, int polOrder, class Storage >
165 struct isContinuous< DiscontinuousGalerkinSpace< FunctionSpace, GridPart, polOrder, Storage > >
166 {
167 static const bool v = false;
168 };
169
170 template< class FunctionSpace, class GridPart, int polOrder, class Storage >
171 struct isLocalized< DiscontinuousGalerkinSpace< FunctionSpace, GridPart, polOrder, Storage > >
172 {
173 static const bool v = true;
174 };
175
176 template< class FunctionSpace, class GridPart, int polOrder, class Storage >
177 struct isAdaptive< DiscontinuousGalerkinSpace< FunctionSpace, GridPart, polOrder, Storage > >
178 {
179 static const bool v = true;
180 };
181
182 template< class FunctionSpace, class GridPart, int polOrder, class Storage >
183 struct threadSafe< DiscontinuousGalerkinSpace< FunctionSpace, GridPart, polOrder, Storage > >
184 {
185 static const bool v = false;
186 };
187
188 template< class FunctionSpace, class GridPart, int polOrder, class Storage >
189 struct viewThreadSafe< DiscontinuousGalerkinSpace< FunctionSpace, GridPart, polOrder, Storage > >
190 {
191 static const bool v = true;
192 };
193
194 template< class FunctionSpace, class GridPart, int polOrder, class Storage >
195 struct isHierarchic< DiscontinuousGalerkinSpace< FunctionSpace, GridPart, polOrder, Storage > >
196 {
197 static const bool v = true;
198 };
199
200 } // namespace Capabilities
201
202 } // namespace Fem
203
204} // namespace Dune
205
206#endif // #ifndef DUNE_FEM_SPACE_DISCONTINUOUSGALERKIN_SPACE_HH
Dune::Fem::DefaultBasisFunctionSet< EntityType, ShapeFunctionSetType > BasisFunctionSetType
entity type
Definition: basisfunctionsets.hh:105
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
A vector valued function space.
Definition: functionspace.hh:60
BaseType::GridPartType GridPartType
type of underlying grid part
Definition: generic.hh:40
BaseType::EntityType EntityType
type of entity of codimension 0
Definition: generic.hh:42
BaseType::BasisFunctionSetType BasisFunctionSetType
type of basis function set of this space
Definition: generic.hh:49
Traits::BasisFunctionSetsType BasisFunctionSetsType
basis function sets
Definition: generic.hh:47
BasisFunctionSetType basisFunctionSet(const EntityType &entity) const
get basis function set for given entity
Definition: generic.hh:106
Unique label for each type of entities that can occur in DUNE grids.
Definition: type.hh:114
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
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
A unique label for each type of element that can occur in a grid.
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 21, 23:30, 2024)