DUNE-FEM (unstable)

generic.hh
1#ifndef DUNE_FEM_SPACE_DISCONTINUOUSGALERKIN_GENERIC_HH
2#define DUNE_FEM_SPACE_DISCONTINUOUSGALERKIN_GENERIC_HH
3
4#include <utility>
5
6#include <dune/fem/space/common/discretefunctionspace.hh>
7#include <dune/fem/space/mapper/codimensionmapper.hh>
8#include <dune/fem/storage/singletonlist.hh>
9
10#include "localrestrictprolong.hh"
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
40 typedef typename BaseType::GridPartType GridPartType;
42 typedef typename BaseType::EntityType EntityType;
45
47 typedef typename Traits::BasisFunctionSetsType BasisFunctionSetsType;
50
52 typedef typename BaseType::BlockMapperType BlockMapperType;
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
89 GenericDiscontinuousGalerkinSpace ( const ThisType & ) = delete;
90
93
94 GenericDiscontinuousGalerkinSpace &operator= ( const ThisType & ) = default;
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
131 LocalMassMatrixStorageType& localMassMatrixStorage() const
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
146 mutable ThreadSafeValue< std::shared_ptr< LocalMassMatrixStorageType > > localMassMatrixStorage_;
147 };
148
149 } // namespace Fem
150
151} // namespace Dune
152
153#endif // #ifndef DUNE_FEM_SPACE_DISCONTINUOUSGALERKIN_GENERIC_HH
quadrature class supporting base function caching
Definition: cachingquadrature.hh:41
This is the class with default implementations for discrete function. The methods not marked with hav...
Definition: discretefunctionspace.hh:649
const IndexSetType & indexSet() const
Get a reference to the associated index set.
Definition: discretefunctionspace.hh:772
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
generic implementation of a Discontinuous Galerkin space based on a fixed family of basis function se...
Definition: generic.hh:31
static constexpr bool continuous(const IntersectionType &intersection)
returns true if the space contains only globally continuous functions
Definition: generic.hh:115
BaseType::GridPartType GridPartType
type of underlying grid part
Definition: generic.hh:40
static DFSpaceIdentifier type()
return type identifier of discrete function space
Definition: generic.hh:103
BlockMapperType & blockMapper() const
get a reference to the block mapper
Definition: generic.hh:124
BaseType::IntersectionType IntersectionType
type of the intersections
Definition: generic.hh:44
static constexpr bool continuous()
returns true if the space contains only globally continuous functions
Definition: generic.hh:112
int order() const
get global order of space
Definition: generic.hh:118
BaseType::EntityType EntityType
type of entity of codimension 0
Definition: generic.hh:42
int order(const EntityType &entity) const
get global order of space
Definition: generic.hh:121
Traits::DiscreteFunctionSpaceType DiscreteFunctionSpaceType
Definition: generic.hh:61
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
GenericDiscontinuousGalerkinSpace(ThisType &&other)=default
move constructor
BasisFunctionSetType basisFunctionSet(const EntityType &entity) const
get basis function set for given entity
Definition: generic.hh:106
BaseType::BlockMapperType BlockMapperType
type of block mapper of this space
Definition: generic.hh:52
static const int codimension
Definition: generic.hh:37
Local Mass Matrix for arbitrary spaces.
Definition: localmassmatrix.hh:919
Singleton list for key/object pairs.
Definition: singletonlist.hh:53
DFSpaceIdentifier
enumerator for identification of spaces
Definition: discretefunctionspace.hh:95
@ DGSpace_id
id for Discontinuous Galerkin Space
Definition: discretefunctionspace.hh:98
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
STL namespace.
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Jul 27, 22:29, 2024)