DUNE-FEM (unstable)

elementquadrature.hh
1#ifndef DUNE_FEM_ELEMENTQUADRATURE_HH
2#define DUNE_FEM_ELEMENTQUADRATURE_HH
3
5
6#include <dune/fem/common/utility.hh>
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 >
63 struct ElementQuadratureTraits
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)
78 typedef typename Quadrature< ctype, dimension, QuadratureTraits > :: CoordinateType
79 CoordinateType;
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:
92 typedef ElementQuadratureTraits< GridPartImp, 0, QuadratureTraits > IntegrationTraits;
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:
207 typedef ElementQuadratureTraits< GridPartType, codimension, QuadratureTraits > IntegrationTraits;
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
306#include "agglomerationquadrature.hh"
307
308#endif // #ifndef DUNE_FEM_ELEMENTQUADRATURE_HH
Wrapper class for entities.
Definition: entity.hh:66
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
constructor
Definition: elementquadrature.hh:88
QuadraturePointWrapper< ThisType > QuadraturePointWrapperType
type of the quadrature point
Definition: elementquadrature.hh:114
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
GridPartType::ctype RealType
type for reals (usually double)
Definition: elementquadrature.hh:105
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
IntegrationTraits::CoordinateType CoordinateType
type for coordinates in the codim-0 reference element
Definition: elementquadrature.hh:108
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
GridPartImp GridPartType
type of the grid partition
Definition: elementquadrature.hh:201
ElementQuadrature(const ElementQuadrature &org)
copy constructor
Definition: elementquadrature.hh:267
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
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
quadrature on the codim-0 reference element
Definition: elementquadrature.hh:58
iterator over quadrature points
Definition: quadrature.hh:103
wrapper for a (Quadrature,int) pair
Definition: quadrature.hh:42
Unique label for each type of entities that can occur in DUNE grids.
Definition: type.hh:114
constexpr bool isNone() const
Return true if entity is a singular of any dimension.
Definition: type.hh:355
Dune namespace.
Definition: alignedallocator.hh:13
Static tag representing a codimension.
Definition: dimension.hh:24
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Jul 24, 22:29, 2024)