DUNE-FEM (unstable)

space.hh
1#ifndef DUNE_FEM_HPDG_SPACE_DISCONTINUOUSGALERKIN_SPACE_HH
2#define DUNE_FEM_HPDG_SPACE_DISCONTINUOUSGALERKIN_SPACE_HH
3
4#include <cstddef>
5
6#include <functional>
7#include <memory>
8#include <type_traits>
9
12
13#include <dune/grid/common/gridenums.hh>
14#include <dune/grid/common/partitionset.hh>
15#include <dune/grid/common/rangegenerators.hh>
16
17#include <dune/fem/space/common/allgeomtypes.hh>
18#include <dune/fem/space/common/discretefunctionspace.hh>
19#include <dune/fem/space/common/localinterpolation.hh>
20
21#include <dune/fem/space/common/dataprojection.hh>
22
23#include <dune/fem/space/discontinuousgalerkin/interpolation.hh>
24
25namespace Dune
26{
27
28 namespace Fem
29 {
30
31 namespace hpDG
32 {
33
34 // DiscontinuousGalerkinSpace
35 // --------------------------
36
43 template< class Traits >
46 {
48
49 public:
51 using GridPartType = typename BaseType::GridPartType;
53 using EntityType = typename BaseType::EntityType;
54
56 using BasisFunctionSetsType = typename Traits::BasisFunctionSetsType;
58 using KeyType = typename BasisFunctionSetsType::KeyType;
61
63 using BlockMapperType = typename BaseType::BlockMapperType;
64
65 typedef typename BaseType::AuxiliaryDofsType AuxiliaryDofsType;
66
67 protected:
68 struct AuxiliaryDofsFactory
69 {
70 typedef std::pair< AuxiliaryDofsType, int > ObjectType;
71
72 static ObjectType *createObject ( std::pair< GridPartType *, BlockMapperType * > key )
73 {
74 return new ObjectType( std::piecewise_construct, std::tie( *key.first, *key.second ), std::make_tuple( -1 ) );
75 }
76
77 static void deleteObject ( ObjectType *object ) { delete object; }
78 };
79
80 typedef SingletonList< std::pair< GridPartType *, BlockMapperType * >, std::pair< AuxiliaryDofsType, int >, AuxiliaryDofsFactory > AuxiliaryDofsProviderType;
81
82
83
84 protected:
85 using BaseType::asImp;
86 using BaseType::gridPart_;
87
88 private:
89 template< class DataProjection >
90 struct DataProjectionWrapper;
91
92 typedef typename Traits::DiscreteFunctionSpaceType DiscreteFunctionSpaceType;
93 public:
95 using InterpolationImplType = DiscontinuousGalerkinLocalL2Projection< GridPartType, BasisFunctionSetType >;
96
98 using InterpolationType = LocalInterpolationWrapper< DiscreteFunctionSpaceType >;
99
104 template< class Function >
106 const KeyType &value, Function function,
109 : BaseType( gridPart, interface, direction ),
110 basisFunctionSets_( basisFunctionSets ),
111 blockMapper_( gridPart_, basisFunctionSets_, value, function )
112 {}
113
117 : DiscontinuousGalerkinSpace( gridPart, basisFunctionSets, value, [&value]( const EntityType &){ return value; }, interface, direction )
118 {}
119
128
131
139 bool continuous () const { return false; }
140
142 bool continuous ( const typename BaseType::IntersectionType &intersection ) const
143 {
144 return false;
145 }
146
148 bool multipleBasisFunctionSets () const { return true; }
149
157 int order () const { return basisFunctionSets().order(); }
158
160 int order ( const EntityType &entity ) const
161 {
162 return basisFunctionSet( entity ).order();
163 }
164
167 {
168 return basisFunctionSets().basisFunctionSet( entity, key( entity ) );
169 }
170
184 {
185 return InterpolationType( static_cast< const DiscreteFunctionSpaceType& > (*this) );
186 }
187
195 {
196 return InterpolationImplType( basisFunctionSet( entity ) );
197 }
198
206 {
207 return InterpolationImplType( basisFunctionSet( entity ) );
208 }
209
217 BlockMapperType &blockMapper () const { return blockMapper_; }
218
231 const KeyType &key ( const EntityType &entity ) const
232 {
233 return blockMapper().key( entity );
234 }
235
241 void mark ( const KeyType &key, const EntityType &entity )
242 {
243 return blockMapper_.mark( key, entity );
244 }
245
252 KeyType getMark ( const EntityType &entity ) const
253 {
254 return blockMapper().getMark( entity );
255 }
256
258 bool adapt () { return blockMapper_.adapt(); }
259
261 template< class DiscreteFunctionSpace, class Implementation >
263 {
264 DataProjectionWrapper< DataProjection< DiscreteFunctionSpace, Implementation > > wrapper( basisFunctionSets(), projection );
265 return blockMapper_.adapt( wrapper );
266 }
267
274 /* \brief return space identitifier */
275 DFSpaceIdentifier type () const
276 {
277 DUNE_THROW( NotImplemented, "Method type() not implemented" );
278 }
279
288 {
289 return basisFunctionSets_;
290 }
291
294 protected:
295 BasisFunctionSetsType basisFunctionSets_;
296 mutable BlockMapperType blockMapper_;
297 };
298
299
300
301 // DiscontinuousGalerkinSpace::DataProjectionWrapper
302 // -------------------------------------------------
303
304 template< class Traits >
305 template< class DataProjection >
306 struct DiscontinuousGalerkinSpace< Traits >::DataProjectionWrapper
307 {
308 explicit DataProjectionWrapper ( const BasisFunctionSetsType &basisFunctionSets,
309 DataProjection &dataProjection )
310 : basisFunctionSets_( basisFunctionSets ),
311 dataProjection_( dataProjection )
312 {}
313
314 DataProjectionWrapper ( const DataProjectionWrapper & ) = default;
315
316 DataProjectionWrapper &operator= ( const DataProjectionWrapper & ) = default;
317
318 void operator() ( const EntityType &entity,
319 const KeyType &prior,
320 const KeyType &present,
321 const std::vector< std::size_t > &origin,
322 const std::vector< std::size_t > &destination )
323 {
324 dataProjection_.get()( entity, basisFunctionSet( entity, prior ), basisFunctionSet( entity, present ), origin, destination );
325 }
326
327 protected:
328 BasisFunctionSetType basisFunctionSet ( const EntityType &entity, const KeyType &key ) const
329 {
330 return basisFunctionSets_.get().basisFunctionSet( entity, key );
331 }
332
333 std::reference_wrapper< const BasisFunctionSetsType > basisFunctionSets_;
334 std::reference_wrapper< DataProjection > dataProjection_;
335 };
336
337 } // namespace hpDG
338
339 } // namespace Fem
340
341} // namespace Dune
342
343#endif // #ifndef DUNE_FEM_HPDG_SPACE_DISCONTINUOUSGALERKIN_SPACE_HH
This is the class with default implementations for discrete function. The methods not marked with hav...
Definition: discretefunctionspace.hh:649
GridPartType & gridPart() const
Definition: discretefunctionspace.hh:766
Traits::BasisFunctionSetType BasisFunctionSetType
type of basis function set of this space
Definition: discretefunctionspace.hh:201
GridPartType::IntersectionType IntersectionType
type of the intersections
Definition: discretefunctionspace.hh:226
Abstract class representing a function.
Definition: function.hh:50
Singleton list for key/object pairs.
Definition: singletonlist.hh:53
Abstract definition of the local restriction and prolongation of discrete functions.
Definition: dataprojection.hh:29
Generic implementation of a -adaptive discontinuous finite element space.
Definition: space.hh:46
LocalInterpolationWrapper< DiscreteFunctionSpaceType > InterpolationType
local interpolation type
Definition: space.hh:98
InterpolationImplType localInterpolation(const EntityType &entity) const
return interpolation
Definition: space.hh:205
typename BaseType::BlockMapperType BlockMapperType
block mapper type
Definition: space.hh:63
BlockMapperType & blockMapper() const
return block mapper
Definition: space.hh:217
typename BaseType::EntityType EntityType
entity type
Definition: space.hh:53
DiscontinuousGalerkinLocalL2Projection< GridPartType, BasisFunctionSetType > InterpolationImplType
local interpolation type
Definition: space.hh:95
bool multipleBasisFunctionSets() const
please doc me
Definition: space.hh:148
const KeyType & key(const EntityType &entity) const
get identifiying basis function set key assigned to given entity
Definition: space.hh:231
typename Traits::BasisFunctionSetsType BasisFunctionSetsType
basis function sets type
Definition: space.hh:56
BasisFunctionSetType basisFunctionSet(const EntityType &entity) const
return basis function set
Definition: space.hh:166
bool adapt(DataProjection< DiscreteFunctionSpace, Implementation > &projection)
please doc me
Definition: space.hh:262
typename BasisFunctionSetsType::KeyType KeyType
key type identifying a basis function set
Definition: space.hh:58
int order(const EntityType &entity) const
return polynomial order
Definition: space.hh:160
bool continuous(const typename BaseType::IntersectionType &intersection) const
please doc me
Definition: space.hh:142
typename BaseType::GridPartType GridPartType
grid part type
Definition: space.hh:51
InterpolationType interpolation() const
return interpolation
Definition: space.hh:183
const BasisFunctionSetsType & basisFunctionSets() const
return basis function sets
Definition: space.hh:287
void mark(const KeyType &key, const EntityType &entity)
assign new key to given entity
Definition: space.hh:241
bool continuous() const
please doc me
Definition: space.hh:139
InterpolationImplType interpolation(const EntityType &entity) const
return interpolation
Definition: space.hh:194
const DiscontinuousGalerkinSpace & operator=(const DiscontinuousGalerkinSpace &)=delete
assignment operator
KeyType getMark(const EntityType &entity) const
get key to be assigned to an entity after next call to adapt()
Definition: space.hh:252
int order() const
return polynomial order
Definition: space.hh:157
DiscontinuousGalerkinSpace(const DiscontinuousGalerkinSpace &)=delete
copy constructor
typename BaseType::BasisFunctionSetType BasisFunctionSetType
basis function set type
Definition: space.hh:60
bool adapt()
please doc me
Definition: space.hh:258
Default exception for dummy implementations.
Definition: exceptions.hh:263
Definition of the DUNE_NO_DEPRECATED_* macros.
A few common exception classes.
DFSpaceIdentifier
enumerator for identification of spaces
Definition: discretefunctionspace.hh:95
#define DUNE_THROW(E, m)
Definition: exceptions.hh:218
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 (Nov 13, 23:29, 2024)