dune-fem  2.8-git
cachingquadrature.hh
Go to the documentation of this file.
1 #ifndef DUNE_FEM_CACHINGQUADRATURE_HH
2 #define DUNE_FEM_CACHINGQUADRATURE_HH
3 
4 //- Local includes
5 #include "elementquadrature.hh"
7 #include "caching/pointmapper.hh"
9 
10 #include "cachingpointlist.hh"
11 
12 namespace Dune
13 {
14  namespace Fem
15  {
16 
40  template< typename GridPartImp, int codim, template <class, int> class QuadratureTraits = DefaultQuadratureTraits >
42 
43 
44 
46  template< typename GridPart, template <class, int> class QuadratureTraits >
47  class CachingQuadrature< GridPart, 0, QuadratureTraits >
48  : public CachingPointList< GridPart, 0, ElementQuadratureTraits< GridPart, 0, QuadratureTraits > >
49  {
50  public:
52  typedef GridPart GridPartType;
53 
55  static constexpr auto codimension = 0;
56 
57  private:
59 
62 
63  public:
65  static constexpr auto dimension = BaseType::dimension;
66 
68  typedef typename BaseType :: RealType RealType;
70  typedef typename BaseType :: CoordinateType CoordinateType;
71 
73  typedef typename BaseType::QuadratureKeyType QuadratureKeyType;
74 
79 
80  // for compatibility
81  typedef typename GridPartType::template Codim< 0 >::EntityType EntityType;
82 
83  protected:
84  using BaseType :: quadImp;
85 
86  public:
87  using BaseType::nop;
88 
95  CachingQuadrature( const EntityType &entity, const QuadratureKeyType& quadKey )
96  : BaseType( entity.type(), quadKey )
97  {}
98 
105  CachingQuadrature( const GeometryType &type, const QuadratureKeyType& quadKey )
106  : BaseType( type, quadKey )
107  {}
108 
114  : BaseType( org )
115  {}
116 
117  QuadraturePointWrapperType operator[] ( std::size_t i ) const
118  {
119  return QuadraturePointWrapperType( *this, i );
120  }
121 
122  IteratorType begin () const noexcept { return IteratorType( *this, 0 ); }
123  IteratorType end () const noexcept { return IteratorType( *this, nop() ); }
124 
126  const RealType &weight ( std::size_t i ) const
127  {
128  return quadImp().weight( i );
129  }
130  };
131 
132 
133 
135  template< typename GridPartImp, template <class, int> class QuadratureTraits >
136  class CachingQuadrature< GridPartImp, 1, QuadratureTraits >
137  : public CachingPointList
138  < GridPartImp, 1, ElementQuadratureTraits< GridPartImp, 1, QuadratureTraits > >
139  {
140  public:
142  typedef GridPartImp GridPartType;
143 
145  static constexpr auto codimension = 1;
146 
147  private:
149 
152 
153  protected:
154  using BaseType :: quadImp;
155 
156  public:
158  static constexpr auto dimension = BaseType::dimension;
159 
161  typedef typename BaseType::RealType RealType;
162 
164  typedef typename BaseType::CoordinateType CoordinateType;
165 
167  typedef typename BaseType::QuadratureKeyType QuadratureKeyType;
168 
173 
175  typedef typename BaseType :: IntersectionIteratorType IntersectionIteratorType;
176  typedef typename IntersectionIteratorType :: Intersection IntersectionType;
177 
180 
181  using BaseType::nop;
182 
195  CachingQuadrature( const GridPartType &gridPart, const IntersectionType &intersection,
196  const QuadratureKeyType& quadKey, typename BaseType::Side side )
197  : BaseType( gridPart, intersection, quadKey, side )
198  {}
199 
205  : BaseType( org )
206  {}
207 
208  QuadraturePointWrapperType operator[] ( std::size_t i ) const
209  {
210  return QuadraturePointWrapperType( *this, i );
211  }
212 
213  IteratorType begin () const noexcept { return IteratorType( *this, 0 ); }
214  IteratorType end () const noexcept { return IteratorType( *this, nop() ); }
215 
217  const RealType &weight( std::size_t i ) const
218  {
219  return quadImp().weight(i);
220  }
221  };
222 
223  template<class GridPart, class Entity>
224  static inline auto cachingQuadrature(const GridPart& gridPart, const Entity& entity, unsigned quadOrder)
225  {
227  return Quadrature(entity, quadOrder);
228  }
229  } //namespace Fem
230 
231 } //namespace Dune
232 
233 #endif // #ifndef DUNE_FEM_CACHINGQUADRATURE_HH
Definition: bindguard.hh:11
static auto cachingQuadrature(const GridPart &gridPart, const Entity &entity, unsigned quadOrder)
Definition: cachingquadrature.hh:224
integration point list supporting base function caching
Definition: cachingpointlist.hh:103
quadrature class supporting base function caching
Definition: cachingquadrature.hh:41
QuadraturePointWrapper< ThisType > QuadraturePointWrapperType
type of the quadrature point
Definition: cachingquadrature.hh:76
GridPartType::template Codim< 0 >::EntityType EntityType
Definition: cachingquadrature.hh:81
CachingQuadrature(const GeometryType &type, const QuadratureKeyType &quadKey)
constructor
Definition: cachingquadrature.hh:105
CachingQuadrature(const ThisType &org)
copy constructor
Definition: cachingquadrature.hh:113
IteratorType begin() const noexcept
Definition: cachingquadrature.hh:122
BaseType ::RealType RealType
just another name for double
Definition: cachingquadrature.hh:68
QuadraturePointIterator< ThisType > IteratorType
type of iterator
Definition: cachingquadrature.hh:78
GridPart GridPartType
type of grid partition
Definition: cachingquadrature.hh:52
BaseType ::CoordinateType CoordinateType
type of the coordinates in the codim-0 reference element
Definition: cachingquadrature.hh:70
const RealType & weight(std::size_t i) const
Definition: cachingquadrature.hh:126
BaseType::QuadratureKeyType QuadratureKeyType
type of quadrature identifier on user side (default is the order of quadrature)
Definition: cachingquadrature.hh:73
IteratorType end() const noexcept
Definition: cachingquadrature.hh:123
CachingQuadrature(const EntityType &entity, const QuadratureKeyType &quadKey)
constructor
Definition: cachingquadrature.hh:95
const RealType & weight(std::size_t i) const
Definition: cachingquadrature.hh:217
BaseType::QuadratureKeyType QuadratureKeyType
type of quadrature identifier on user side (default is the order of quadrature)
Definition: cachingquadrature.hh:167
GridPartImp GridPartType
type of the grid partition
Definition: cachingquadrature.hh:142
CachingQuadrature(const GridPartType &gridPart, const IntersectionType &intersection, const QuadratureKeyType &quadKey, typename BaseType::Side side)
constructor
Definition: cachingquadrature.hh:195
BaseType::CoordinateType CoordinateType
the coordinates of the quadrature points in the codim-0 reference element
Definition: cachingquadrature.hh:164
BaseType ::IntersectionIteratorType IntersectionIteratorType
type of the intersection iterator
Definition: cachingquadrature.hh:175
IteratorType end() const noexcept
Definition: cachingquadrature.hh:214
BaseType::RealType RealType
just another name for double
Definition: cachingquadrature.hh:161
QuadraturePointIterator< ThisType > IteratorType
type of iterator
Definition: cachingquadrature.hh:172
ElementQuadrature< GridPartImp, codimension > NonConformingQuadratureType
type of quadrature used for non-conforming intersections
Definition: cachingquadrature.hh:179
IntersectionIteratorType ::Intersection IntersectionType
Definition: cachingquadrature.hh:176
CachingQuadrature(const ThisType &org)
copy constructor
Definition: cachingquadrature.hh:204
QuadraturePointWrapper< ThisType > QuadraturePointWrapperType
type of the quadrature point
Definition: cachingquadrature.hh:170
IteratorType begin() const noexcept
Definition: cachingquadrature.hh:213
quadrature on the codim-0 reference element
Definition: elementquadrature.hh:18
Definition: elementquadrature.hh:64
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