dune-fem 2.8.0
Loading...
Searching...
No Matches
discontinuousgalerkin/generic.hh
Go to the documentation of this file.
1#ifndef DUNE_FEM_SPACE_DISCONTINUOUSGALERKIN_GENERIC_HH
2#define DUNE_FEM_SPACE_DISCONTINUOUSGALERKIN_GENERIC_HH
3
4#include <utility>
5
9
11
12namespace Dune
13{
14
15 namespace Fem
16 {
17
18 // GenericDiscontinuousGalerkinSpace
19 // ---------------------------------
20
28 template< class Traits >
30 : public DiscreteFunctionSpaceDefault< Traits >
31 {
34
35 public:
37 static const int codimension = Traits::codimension;
38
45
47 typedef typename Traits::BasisFunctionSetsType BasisFunctionSetsType;
50
53
54 protected:
56
58
59 public:
61 typedef typename Traits :: DiscreteFunctionSpaceType DiscreteFunctionSpaceType;
62
64 typedef std::vector< typename BaseType::RangeType > VectorType;
65 typedef std::pair< LocalMassMatrixType, VectorType > LocalMassMatrixStorageType;
66
67 protected:
68 using BaseType::asImp;
69 public:
75 const InterfaceType commInterface = InteriorBorder_All_Interface,
76 const CommunicationDirection commDirection = ForwardCommunication )
77 : BaseType( gridPart, commInterface, commDirection ),
78 basisFunctionSets_( std::move( basisFunctionSets ) ),
79 // block mapper is a singleton so that the communication can be cached efficiently
80 blockMapper_( &BlockMapperProdiverType::getObject( &(gridPart.indexSet() )))
81 {}
82
90
93
95
103 static DFSpaceIdentifier type () { return DGSpace_id; }
104
107 {
108 return basisFunctionSets().basisFunctionSet( entity );
109 }
110
112 static constexpr bool continuous () { return false; }
113
115 static constexpr bool continuous ( const IntersectionType &intersection ) { return false; }
116
118 int order () const { return basisFunctionSets().order(); }
119
121 int order ( const EntityType &entity ) const { return basisFunctionSets().order( entity ); }
122
124 BlockMapperType &blockMapper () const { assert( blockMapper_ ); return *blockMapper_; }
125
128 const BasisFunctionSetsType &basisFunctionSets () const { return basisFunctionSets_; }
129 BasisFunctionSetsType &basisFunctionSets () { return basisFunctionSets_; }
130
132 {
133 auto& localMassPtr = *localMassMatrixStorage_;
134 if( ! localMassPtr )
135 {
136 localMassPtr.reset( new LocalMassMatrixStorageType( LocalMassMatrixType( asImp(), 2*order() ), VectorType() ) );
137 }
138
139 return *localMassPtr;
140 }
141
142 private:
143 BasisFunctionSetsType basisFunctionSets_;
144 std::unique_ptr< BlockMapperType, typename BlockMapperProdiverType::Deleter > blockMapper_;
145
147 };
148
149 } // namespace Fem
150
151} // namespace Dune
152
153#endif // #ifndef DUNE_FEM_SPACE_DISCONTINUOUSGALERKIN_GENERIC_HH
DFSpaceIdentifier
enumerator for identification of spaces
Definition: discretefunctionspace.hh:94
@ DGSpace_id
id for Discontinuous Galerkin Space
Definition: discretefunctionspace.hh:97
STL namespace.
Definition: bindguard.hh:11
ThreadSafeValue realizes thread safety for a given variable by creating an instance of this variable ...
Definition: threadsafevalue.hh:18
Local Mass Matrix for arbitrary spaces.
Definition: localmassmatrix.hh:909
quadrature class supporting base function caching
Definition: cachingquadrature.hh:41
const DiscreteFunctionSpaceType & asImp() const
Definition: discretefunctionspace.hh:576
Traits::BasisFunctionSetType BasisFunctionSetType
type of basis function set of this space
Definition: discretefunctionspace.hh:200
GridPartType::IntersectionType IntersectionType
type of the intersections
Definition: discretefunctionspace.hh:225
This is the class with default implementations for discrete function. The methods not marked with hav...
Definition: discretefunctionspace.hh:628
BaseType::EntityType EntityType
Definition: discretefunctionspace.hh:644
BaseType::BlockMapperType BlockMapperType
Definition: discretefunctionspace.hh:660
BaseType::GridPartType GridPartType
Definition: discretefunctionspace.hh:640
const IndexSetType & indexSet() const
Get a reference to the associated index set.
Definition: discretefunctionspace.hh:751
GridPartType & gridPart() const
Definition: discretefunctionspace.hh:745
generic implementation of a Discontinuous Galerkin space based on a fixed family of basis function se...
Definition: discontinuousgalerkin/generic.hh:31
LocalMassMatrixStorageType & localMassMatrixStorage() const
Definition: discontinuousgalerkin/generic.hh:131
std::vector< typename BaseType::RangeType > VectorType
Definition: discontinuousgalerkin/generic.hh:64
GenericDiscontinuousGalerkinSpace(GridPartType &gridPart, BasisFunctionSetsType &&basisFunctionSets, const InterfaceType commInterface=InteriorBorder_All_Interface, const CommunicationDirection commDirection=ForwardCommunication)
Definition: discontinuousgalerkin/generic.hh:74
BasisFunctionSetsType & basisFunctionSets()
Definition: discontinuousgalerkin/generic.hh:129
static constexpr bool continuous(const IntersectionType &intersection)
returns true if the space contains only globally continuous functions
Definition: discontinuousgalerkin/generic.hh:115
BaseType::GridPartType GridPartType
type of underlying grid part
Definition: discontinuousgalerkin/generic.hh:40
static DFSpaceIdentifier type()
return type identifier of discrete function space
Definition: discontinuousgalerkin/generic.hh:103
GenericDiscontinuousGalerkinSpace & operator=(const ThisType &)=default
BlockMapperType & blockMapper() const
get a reference to the block mapper
Definition: discontinuousgalerkin/generic.hh:124
GenericDiscontinuousGalerkinSpace(const ThisType &)=delete
CachingQuadrature< GridPartType, EntityType::codimension > VolumeQuadratureType
Definition: discontinuousgalerkin/generic.hh:57
LocalMassMatrix< DiscreteFunctionSpaceType, VolumeQuadratureType > LocalMassMatrixType
Definition: discontinuousgalerkin/generic.hh:63
BaseType::IntersectionType IntersectionType
type of the intersections
Definition: discontinuousgalerkin/generic.hh:44
const BasisFunctionSetsType & basisFunctionSets() const
Definition: discontinuousgalerkin/generic.hh:128
static constexpr bool continuous()
returns true if the space contains only globally continuous functions
Definition: discontinuousgalerkin/generic.hh:112
int order() const
get global order of space
Definition: discontinuousgalerkin/generic.hh:118
BaseType::EntityType EntityType
type of entity of codimension 0
Definition: discontinuousgalerkin/generic.hh:42
int order(const EntityType &entity) const
get global order of space
Definition: discontinuousgalerkin/generic.hh:121
Traits::DiscreteFunctionSpaceType DiscreteFunctionSpaceType
Definition: discontinuousgalerkin/generic.hh:61
BaseType::BasisFunctionSetType BasisFunctionSetType
type of basis function set of this space
Definition: discontinuousgalerkin/generic.hh:49
std::pair< LocalMassMatrixType, VectorType > LocalMassMatrixStorageType
Definition: discontinuousgalerkin/generic.hh:65
Traits::BasisFunctionSetsType BasisFunctionSetsType
basis function sets
Definition: discontinuousgalerkin/generic.hh:47
GenericDiscontinuousGalerkinSpace(ThisType &&other)=default
move constructor
BasisFunctionSetType basisFunctionSet(const EntityType &entity) const
get basis function set for given entity
Definition: discontinuousgalerkin/generic.hh:106
BaseType::BlockMapperType BlockMapperType
type of block mapper of this space
Definition: discontinuousgalerkin/generic.hh:52
static const int codimension
Definition: discontinuousgalerkin/generic.hh:37
SingletonList< const typename GridPartType::IndexSetType *, BlockMapperType > BlockMapperProdiverType
Definition: discontinuousgalerkin/generic.hh:55
Singleton list for key/object pairs.
Definition: singletonlist.hh:53