dune-fem 2.12-git
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
6
7namespace Dune
8{
9
10 namespace Fem
11 {
12
13 template< typename GridPartImp, class IntegrationPointList >
14 class Agglomeration;
15
16 template< class GridPartImp, int codim, template< class, int > class QuadratureTraits >
18 {
19 // type of single coordinate
20 typedef typename GridPartImp :: ctype ctype;
21
22 // dimension of quadrature
23 enum { dimension = GridPartImp :: dimension };
24
25 // codimension of quadrature
26 enum { codimension = codim };
27
28 // type of used integration point list
29 typedef Quadrature< ctype, dimension-codim, QuadratureTraits > IntegrationPointListType;
30
31 // type of local coordinate (with respect to the codim-0 entity)
34 };
35
72 template< class GridPartImp, int codim, class IntegrationTraits, bool isQuadrature >
74
75
77 template< class GridPartImp, class IntegrationTraits, bool isQuadrature >
78 class ElementQuadratureImpl< GridPartImp, 0, IntegrationTraits, isQuadrature >
79 : public ElementPointListBase< GridPartImp, 0, IntegrationTraits >
80 {
83
84 public:
86 typedef typename Base :: GridPartType GridPartType;
87
90
95
96 // for compatibility
97 typedef typename Base :: EntityType EntityType;
98
99 typedef typename Base :: IntegrationPointListType IntegrationPointListType;
100
101 protected:
102 template <class QuadratureKeyType>
103 IntegrationPointListType createQuadrature( const EntityType &entity, const QuadratureKeyType& quadKey, const bool checkGeomType )
104 {
105 const GeometryType geomType = entity.type();
106 if( checkGeomType && ! geomType.isNone() )
107 {
108 // return default element quadratures for given geometry type
109 return IntegrationPointListType( geomType, quadKey );
110 }
111 else // compute weights and points based on sub-triangulation
112 {
114 return AgglomerationType::computeQuadrature( entity, quadKey );
115 }
116 }
117
118 using Base::quadImp;
119
120 public:
121 using Base::localPoint;
122 using Base::nop;
123
130 template <class QuadratureKeyType>
131 ElementQuadratureImpl( const EntityType &entity, const QuadratureKeyType& quadKey, const bool checkGeomType = isQuadrature )
132 : Base( createQuadrature( entity, quadKey, checkGeomType ) )
133 {}
134
140 template <class QuadratureKeyType>
141 ElementQuadratureImpl( const GeometryType &geometry, const QuadratureKeyType& quadKey )
142 : Base( geometry, quadKey )
143 {}
144
145 const QuadraturePointWrapperType operator[] ( const size_t i ) const
146 {
147 return QuadraturePointWrapperType( *this, i );
148 }
149
150 IteratorType begin () const noexcept { return IteratorType( *this, 0 ); }
151 IteratorType end () const noexcept { return IteratorType( *this, nop() ); }
152
154 const CoordinateType &point ( const size_t i ) const
155 {
156 return localPoint( i );
157 }
158
160 auto weight( size_t i ) const
161 {
162 return quadImp().weight( i );
163 }
164 };
165
166
167
169 template< class GridPartImp, class IntegrationTraits, bool isQuadrature >
170 class ElementQuadratureImpl< GridPartImp, 1, IntegrationTraits, isQuadrature >
171 : public ElementPointListBase< GridPartImp, 1, IntegrationTraits >
172 {
175
176 public:
178 typedef GridPartImp GridPartType;
179
180 static const int dimension = Base::dimension;
181
184
186 typedef typename GridPartType::IntersectionIteratorType IntersectionIteratorType;
187 typedef typename IntersectionIteratorType::Intersection IntersectionType;
188
193
196
197
198 // for compatibility
199 typedef typename GridPartType::TwistUtilityType TwistUtilityType;
201
202
203 using Base::localPoint;
204 using Base::elementGeometry;
205 using Base::nop;
206
218 template <class QuadratureKeyType>
220 const IntersectionType &intersection,
221 const QuadratureKeyType& quadKey,
222 const typename Base :: Side side )
223 : Base( getPointList( intersection, quadKey, side ) ),
224 side_(side),
225 intersection_(intersection),
226 referenceGeometry_( side == Base::INSIDE ? intersection.geometryInInside() : intersection.geometryInOutside())
227 {}
228
230 {
231 return QuadraturePointWrapperType( *this, i );
232 }
233
234 IteratorType begin () const noexcept { return IteratorType( *this, 0 ); }
235 IteratorType end () const noexcept { return IteratorType( *this, nop() ); }
236 typename Base :: Side side() const { return side_; }
237 bool isInside() const { return side_ == Base::INSIDE; }
238
240 const CoordinateType &point ( size_t i ) const
241 {
242 dummy_ = referenceGeometry_.global( localPoint( i ) );
243 return dummy_;
244 }
245
247 auto weight( size_t i ) const
248 {
249 return quadImp().weight( i );
250 }
251
252 using Base::localFaceIndex;
253
255 {
256 return intersection_;
257 }
258
259 protected:
260 using Base::quadImp;
261
262 Base getPointList ( const IntersectionType &intersection, const int order,
263 const typename Base :: Side side )
264 {
265 switch( side )
266 {
267 case Base :: INSIDE:
268 return Base( TwistUtilityType::elementGeometry( intersection, true ),
269 intersection.type(), intersection.indexInInside(), order );
270
271 case Base ::OUTSIDE:
272 return Base( TwistUtilityType::elementGeometry( intersection, false ),
273 intersection.type(), intersection.indexInOutside(), order );
274
275 default:
276 DUNE_THROW( InvalidStateException, "ElementIntegrationPointList: side must either be INSIDE or OUTSIDE." );
277 }
278 }
279
280 private:
281 typedef typename IntersectionIteratorType::Intersection::LocalGeometry ReferenceGeometry;
282
283 const typename Base :: Side side_;
284 const IntersectionType &intersection_;
285 ReferenceGeometry referenceGeometry_;
286 mutable CoordinateType dummy_;
287 };
288
290 template< class GridPart, int codim, template <class, int> class IntegrationTraits = DefaultQuadratureTraits >
292
293 template< class GridPart, int codim, template <class, int> class IntegrationTraits = DefaultQuadratureTraits >
295
296 template<class GridPart, class Entity>
297 static inline auto elementQuadrature(const GridPart& gridPart, const Entity& entity, unsigned quadOrder)
298 {
300 return Quadrature(entity, quadOrder);
301 }
302
303 } // namespace Fem
304
305} // namespace Dune
306
308
309#endif // #ifndef DUNE_FEM_ELEMENTQUADRATURE_HH
reference operator[](size_type i)
#define DUNE_THROW(E,...)
IntegrationPointList< FieldImp, dim, QuadratureTraits, true > Quadrature
Definition quadrature.hh:443
static auto elementQuadrature(const GridPart &gridPart, const Entity &entity, unsigned quadOrder)
Definition elementquadrature.hh:297
constexpr bool isNone() const
Agglomeration is a simple quadrature for polyhedral cells based on sub triangulation
Definition agglomerationquadrature.hh:22
Definition defaultquadratures.hh:40
ElementPointListBase.
Definition elementpointlistbase.hh:193
IntegrationTraits::CoordinateType CoordinateType
Definition elementpointlistbase.hh:215
IntegrationTraits::CoordinateType CoordinateType
Definition elementpointlistbase.hh:48
Definition elementquadrature.hh:18
@ codimension
Definition elementquadrature.hh:26
Quadrature< ctype, dimension-codim, QuadratureTraits > IntegrationPointListType
Definition elementquadrature.hh:29
GridPartImp::ctype ctype
Definition elementquadrature.hh:20
Quadrature< ctype, dimension, QuadratureTraits >::CoordinateType CoordinateType
Definition elementquadrature.hh:33
@ dimension
Definition elementquadrature.hh:23
Definition elementquadrature.hh:73
QuadraturePointIterator< This > IteratorType
type of iterator
Definition elementquadrature.hh:94
ElementQuadratureImpl(const EntityType &entity, const QuadratureKeyType &quadKey, const bool checkGeomType=isQuadrature)
constructor
Definition elementquadrature.hh:131
ElementQuadratureImpl(const GeometryType &geometry, const QuadratureKeyType &quadKey)
constructor
Definition elementquadrature.hh:141
Base::IntegrationPointListType IntegrationPointListType
Definition elementquadrature.hh:99
QuadraturePointWrapper< This > QuadraturePointWrapperType
type of the quadrature point
Definition elementquadrature.hh:92
Base::GridPartType GridPartType
type of grid part
Definition elementquadrature.hh:86
auto weight(size_t i) const
obtain weight of i-th integration point (if quadrature, else 1.0)
Definition elementquadrature.hh:160
Base::CoordinateType CoordinateType
type for coordinates in the codim-0 reference element
Definition elementquadrature.hh:89
IteratorType begin() const noexcept
Definition elementquadrature.hh:150
IntegrationPointListType createQuadrature(const EntityType &entity, const QuadratureKeyType &quadKey, const bool checkGeomType)
Definition elementquadrature.hh:103
const CoordinateType & point(const size_t i) const
obtain coordinates of i-th integration point
Definition elementquadrature.hh:154
IteratorType end() const noexcept
Definition elementquadrature.hh:151
QuadraturePointIterator< This > IteratorType
type of iterator
Definition elementquadrature.hh:192
GridPartType::IntersectionIteratorType IntersectionIteratorType
Type of the intersection iterator.
Definition elementquadrature.hh:186
auto weight(size_t i) const
obtain weight of i-th integration point (if quadrature, else 1.0)
Definition elementquadrature.hh:247
QuadraturePointWrapper< This > QuadraturePointWrapperType
type of the quadrature point
Definition elementquadrature.hh:190
IntersectionIteratorType::Intersection IntersectionType
Definition elementquadrature.hh:187
IntersectionIteratorType IntersectionIterator
Definition elementquadrature.hh:200
IteratorType begin() const noexcept
Definition elementquadrature.hh:234
IteratorType end() const noexcept
Definition elementquadrature.hh:235
ElementQuadratureImpl(const GridPartType &gridPart, const IntersectionType &intersection, const QuadratureKeyType &quadKey, const typename Base ::Side side)
constructor
Definition elementquadrature.hh:219
GridPartType::TwistUtilityType TwistUtilityType
Definition elementquadrature.hh:199
const CoordinateType & point(size_t i) const
obtain coordinates of i-th integration point
Definition elementquadrature.hh:240
Base::CoordinateType CoordinateType
Type of coordinates in codim-0 reference element.
Definition elementquadrature.hh:183
GridPartImp GridPartType
type of the grid partition
Definition elementquadrature.hh:178
const IntersectionType & intersection() const
Definition elementquadrature.hh:254
Base getPointList(const IntersectionType &intersection, const int order, const typename Base ::Side side)
Definition elementquadrature.hh:262
This NonConformingQuadratureType
type quadrature for use on non-conforming intersections
Definition elementquadrature.hh:195
wrapper for a (Quadrature,int) pair
Definition quadrature.hh:42
iterator over quadrature points
Definition quadrature.hh:103
actual interface class for integration point lists
Definition quadrature.hh:158