dune-fem 2.8.0
Loading...
Searching...
No Matches
elementquadrature.hh
Go to the documentation of this file.
1#ifndef DUNE_FEM_ELEMENTQUADRATURE_HH
2#define DUNE_FEM_ELEMENTQUADRATURE_HH
3
4#include <dune/geometry/quadraturerules.hh>
5
7
8#include "quadrature.hh"
9#include "elementpointlist.hh"
10
11namespace Dune
12{
13
14 namespace Fem
15 {
16
17 template< typename GridPartImp, class IntegrationPointList >
18 class Agglomeration;
19
20
57 template< typename GridPartImp, int codim, template <class, int> class QuadratureTraits = DefaultQuadratureTraits >
59
60
61
62 template< class GridPartImp, int codim, template< class, int > class QuadratureTraits >
64 {
65 // type of single coordinate
66 typedef typename GridPartImp :: ctype ctype;
67
68 // dimension of quadrature
69 enum { dimension = GridPartImp :: dimension };
70
71 // codimension of quadrature
72 enum { codimension = codim };
73
74 // type of used integration point list
75 typedef Quadrature< ctype, dimension-codim, QuadratureTraits > IntegrationPointListType;
76
77 // type of local coordinate (with respect to the codim-0 entity)
80 };
81
82
83
85 template< typename GridPartImp, template< class, int > class QuadratureTraits >
86 class ElementQuadrature< GridPartImp, 0, QuadratureTraits >
87 : public ElementIntegrationPointList< GridPartImp, 0, ElementQuadratureTraits< GridPartImp, 0, QuadratureTraits > >
88 {
90
91 public:
94
96 typedef GridPartImp GridPartType;
97
99 enum { codimension = 0 };
100
102 enum { dimension = GridPartType :: dimension };
103
105 typedef typename GridPartType :: ctype RealType;
106
108 typedef typename IntegrationTraits :: CoordinateType CoordinateType;
109
111 typedef typename BaseType :: QuadratureKeyType QuadratureKeyType;
112
117
118 // for compatibility
119 typedef typename GridPartType::template Codim< 0 >::EntityType EntityType;
120
121 typedef typename BaseType :: IntegrationPointListType IntegrationPointListType;
122
123 protected:
124 using BaseType::quadImp;
125
126 IntegrationPointListType createQuadrature( const EntityType &entity, const QuadratureKeyType& quadKey, const bool checkGeomType )
127 {
128 const GeometryType geomType = entity.type();
129 if( checkGeomType && ! geomType.isNone() )
130 {
131 // return default element quadratures for given geometry type
132 return IntegrationPointListType( geomType, quadKey );
133 }
134 else // compute weights and points based on sub-triangulation
135 {
137 return AgglomerationType::computeQuadrature( entity, quadKey );
138 }
139 }
140
141 public:
142 using BaseType::nop;
143
150 ElementQuadrature( const EntityType &entity, const QuadratureKeyType& quadKey, const bool checkGeomType = true )
151 : BaseType( createQuadrature( entity, quadKey, checkGeomType ) )
152 {}
153
160 ElementQuadrature( const GeometryType &type, const QuadratureKeyType& quadKey )
161 : BaseType( type, quadKey )
162 {
163 // when type is none then entity has to be passed in order to create
164 // the sub triangulation etc.
165 // assert( ! type.isNone() );
166 }
167
173 : BaseType( org )
174 {}
175
176 QuadraturePointWrapperType operator[] ( std::size_t i ) const
177 {
178 return QuadraturePointWrapperType( *this, i );
179 }
180
181 IteratorType begin () const noexcept { return IteratorType( *this, 0 ); }
182 IteratorType end () const noexcept { return IteratorType( *this, nop() ); }
183
185 const RealType &weight( size_t i ) const
186 {
187 return quadImp().weight( i );
188 }
189 };
190
191
192
194 template< class GridPartImp, template< class, int > class QuadratureTraits >
195 class ElementQuadrature< GridPartImp, 1, QuadratureTraits >
197 < GridPartImp, 1, ElementQuadratureTraits< GridPartImp, 1, QuadratureTraits > >
198 {
199 public:
201 typedef GridPartImp GridPartType;
202
204 enum { codimension = 1 };
205
206 private:
208
211 BaseType;
212
213 protected:
214 using BaseType :: quadImp;
215
216 public:
218 enum { dimension = GridPartType :: dimension };
219
221 typedef typename GridPartType :: ctype RealType;
222
224 typedef typename GridPartType :: IntersectionIteratorType IntersectionIteratorType;
225 typedef typename IntersectionIteratorType :: Intersection IntersectionType;
226
228 typedef typename IntegrationTraits :: CoordinateType CoordinateType;
229
231 typedef typename BaseType :: QuadratureKeyType QuadratureKeyType;
232
237
239 typedef typename IntegrationTraits :: IntegrationPointListType :: CoordinateType
241
244
245 public:
246 using BaseType::nop;
247
257 const IntersectionType &intersection,
258 const QuadratureKeyType& quadKey,
259 typename BaseType :: Side side )
260 : BaseType( gridPart, intersection, quadKey, side )
261 {}
262
268 : BaseType( org )
269 {
270 }
271
272 QuadraturePointWrapperType operator[] ( std::size_t i ) const
273 {
274 return QuadraturePointWrapperType( *this, i );
275 }
276
277 IteratorType begin () const noexcept { return IteratorType( *this, 0 ); }
278 IteratorType end () const noexcept { return IteratorType( *this, nop() ); }
279
289 const RealType &weight( size_t i ) const
290 {
291 return quadImp().weight( i );
292 }
293 };
294
295 template<class GridPart, class Entity>
296 static inline auto elementQuadrature(const GridPart& gridPart, const Entity& entity, unsigned quadOrder)
297 {
299 return Quadrature(entity, quadOrder);
300 }
301
302 } // namespace Fem
303
304} // namespace Dune
305
307
308#endif // #ifndef DUNE_FEM_ELEMENTQUADRATURE_HH
Definition: bindguard.hh:11
static auto elementQuadrature(const GridPart &gridPart, const Entity &entity, unsigned quadOrder)
Definition: elementquadrature.hh:296
Agglomeration is a simple quadrature for polyhedral cells based on sub triangulation
Definition: agglomerationquadrature.hh:22
integration point list on the codim-0 reference element
Definition: elementpointlist.hh:49
quadrature on the codim-0 reference element
Definition: elementquadrature.hh:58
Definition: elementquadrature.hh:64
@ codimension
Definition: elementquadrature.hh:72
Quadrature< ctype, dimension-codim, QuadratureTraits > IntegrationPointListType
Definition: elementquadrature.hh:75
GridPartImp::ctype ctype
Definition: elementquadrature.hh:66
Quadrature< ctype, dimension, QuadratureTraits >::CoordinateType CoordinateType
Definition: elementquadrature.hh:79
@ dimension
Definition: elementquadrature.hh:69
constructor
Definition: elementquadrature.hh:88
IteratorType begin() const noexcept
Definition: elementquadrature.hh:181
QuadraturePointWrapper< ThisType > QuadraturePointWrapperType
type of the quadrature point
Definition: elementquadrature.hh:114
ElementIntegrationPointList< GridPartImp, 0, IntegrationTraits > BaseType
Definition: elementquadrature.hh:93
ElementQuadrature(const ThisType &org)
copy constructor
Definition: elementquadrature.hh:172
const RealType & weight(size_t i) const
obtain weight of i-th integration point
Definition: elementquadrature.hh:185
GridPartImp GridPartType
type of the grid partition
Definition: elementquadrature.hh:96
ElementQuadrature(const GeometryType &type, const QuadratureKeyType &quadKey)
constructor
Definition: elementquadrature.hh:160
BaseType::QuadratureKeyType QuadratureKeyType
type of quadrature identifier on user side (default is the order of quadrature)
Definition: elementquadrature.hh:111
IteratorType end() const noexcept
Definition: elementquadrature.hh:182
IntegrationPointListType createQuadrature(const EntityType &entity, const QuadratureKeyType &quadKey, const bool checkGeomType)
Definition: elementquadrature.hh:126
GridPartType::ctype RealType
type for reals (usually double)
Definition: elementquadrature.hh:105
ElementQuadratureTraits< GridPartImp, 0, QuadratureTraits > IntegrationTraits
Definition: elementquadrature.hh:92
ElementQuadrature(const EntityType &entity, const QuadratureKeyType &quadKey, const bool checkGeomType=true)
constructor
Definition: elementquadrature.hh:150
QuadraturePointIterator< ThisType > IteratorType
type of iterator
Definition: elementquadrature.hh:116
GridPartType::template Codim< 0 >::EntityType EntityType
Definition: elementquadrature.hh:119
IntegrationTraits::CoordinateType CoordinateType
type for coordinates in the codim-0 reference element
Definition: elementquadrature.hh:108
BaseType::IntegrationPointListType IntegrationPointListType
Definition: elementquadrature.hh:121
GridPartType::ctype RealType
type for reals (usually double)
Definition: elementquadrature.hh:221
QuadraturePointWrapper< ThisType > QuadraturePointWrapperType
type of the quadrature point
Definition: elementquadrature.hh:234
ElementQuadrature(const GridPartType &gridPart, const IntersectionType &intersection, const QuadratureKeyType &quadKey, typename BaseType ::Side side)
constructor
Definition: elementquadrature.hh:256
IteratorType begin() const noexcept
Definition: elementquadrature.hh:277
GridPartImp GridPartType
type of the grid partition
Definition: elementquadrature.hh:201
ElementQuadrature(const ElementQuadrature &org)
copy constructor
Definition: elementquadrature.hh:267
IteratorType end() const noexcept
Definition: elementquadrature.hh:278
const RealType & weight(size_t i) const
Definition: elementquadrature.hh:289
ThisType NonConformingQuadratureType
type of quadrature for use on non-conforming intersections
Definition: elementquadrature.hh:243
IntersectionIteratorType::Intersection IntersectionType
Definition: elementquadrature.hh:225
GridPartType::IntersectionIteratorType IntersectionIteratorType
type of the intersection iterator
Definition: elementquadrature.hh:224
IntegrationTraits::IntegrationPointListType::CoordinateType LocalCoordinateType
type of coordinate in codim-1 reference element
Definition: elementquadrature.hh:240
BaseType::QuadratureKeyType QuadratureKeyType
type of quadrature identifier on user side (default is the order of quadrature)
Definition: elementquadrature.hh:231
IntegrationTraits::CoordinateType CoordinateType
type of coordinates in codim-0 reference element
Definition: elementquadrature.hh:228
QuadraturePointIterator< ThisType > IteratorType
type of iterator
Definition: elementquadrature.hh:236
wrapper for a (Quadrature,int) pair
Definition: quadrature.hh:43
iterator over quadrature points
Definition: quadrature.hh:106
actual interface class for quadratures
Definition: quadrature.hh:405