1#ifndef DUNE_FEM_INTERPOLATIONQUADRATURE_HH
2#define DUNE_FEM_INTERPOLATIONQUADRATURE_HH
8#include <dune/fem/quadrature/quadratureimp.hh>
9#include <dune/fem/space/localfiniteelement/quadratureinterpolation.hh>
24 template<
typename FieldImp,
int dim,
template <
class,
unsigned int>
class PointSet >
25 class InterpolationQuadratureFactory
29 typedef FieldImp FieldType;
30 typedef PointSet< FieldType, dim > PointSetType;
32 enum { dimension = dim };
35 typedef InterpolationQuadratureFactory< FieldType, dimension, PointSet > ThisType;
39 typedef typename BaseType :: ElementCoordinateType ElementCoordinateType;
40 using BaseType :: addQuadraturePoint;
47 mutable size_t numElementInterpolPoints_;
57 InterpolationQuadratureFactory(
const GeometryType &geometry,
61 elementGeometry_( geometry ),
62 numElementInterpolPoints_( 0 )
65 if( geometry.isCube() )
67 auto points = PointSetType::buildCubeQuadrature( order );
68 order_ = points.quadOrder();
70 assert(order_ >= order);
72 for(
unsigned int i=0; i<points.size(); ++i )
79 DUNE_THROW(InvalidStateException,
"InterpolationQuadratureFactory: Unsupported geometry type " << geometry);
92 virtual std::vector< ElementCoordinateType > interpolationPoints(
const int reqDim )
const
95 if( reqDim == (dim+1) && dim < 3 )
97 typedef PointSet< FieldType, dim+1 > ElementPointSet;
98 auto points = ElementPointSet::buildCubeQuadrature( order_ );
99 numElementInterpolPoints_ = points.size();
100 std::vector< ElementCoordinateType > pts( numElementInterpolPoints_ );
101 for(
size_t i=0; i<numElementInterpolPoints_; ++i )
102 pts[ i ] = points[ i ].
point();
106 return std::vector< ElementCoordinateType >();
110 virtual bool isFaceInterpolationQuadrature(
const size_t numShapeFunctions )
const
116 return numShapeFunctions == numElementInterpolPoints_;
123 return elementGeometry_;
128 static unsigned int maxOrder ()
131 if constexpr( PointSetType::pointSetId < Dune::QuadratureType::size )
143 template<
class FieldType,
int dim,
template <
class,
unsigned int>
class PointSet >
144 struct InterpolationQuadratureTraitsImpl
146 static const int pointSetId = PointSet<FieldType,dim>::pointSetId;
148 typedef InterpolationQuadratureFactory< FieldType, dim, PointSet > SimplexQuadratureType;
149 typedef InterpolationQuadratureFactory< FieldType, dim, PointSet > CubeQuadratureType;
153 typedef int QuadratureKeyType ;
156 template<
class FieldType,
template <
class,
unsigned int>
class PointSet >
157 struct InterpolationQuadratureTraitsImpl< FieldType, 0, PointSet >
159 static const int dim = 0;
161 static const int pointSetId = PointSet<FieldType,dim>::pointSetId;
163 typedef InterpolationQuadratureFactory< FieldType, dim, PointSet > PointQuadratureType;
167 typedef int QuadratureKeyType ;
170 template<
class FieldType,
template <
class,
unsigned int>
class PointSet >
171 struct InterpolationQuadratureTraitsImpl< FieldType, 1, PointSet >
173 static const int dim = 1;
175 static const int pointSetId = PointSet<FieldType,dim>::pointSetId;
177 typedef InterpolationQuadratureFactory< FieldType, dim, PointSet > LineQuadratureType;
181 typedef int QuadratureKeyType ;
184 template<
class FieldType,
template <
class,
unsigned int>
class PointSet >
185 struct InterpolationQuadratureTraitsImpl< FieldType, 3, PointSet >
187 static const int dim = 3;
189 static const int pointSetId = PointSet<FieldType,dim>::pointSetId;
191 typedef InterpolationQuadratureFactory< FieldType, dim, PointSet > SimplexQuadratureType;
192 typedef InterpolationQuadratureFactory< FieldType, dim, PointSet > CubeQuadratureType;
194 typedef InterpolationQuadratureFactory< FieldType, dim, PointSet > PrismQuadratureType;
195 typedef InterpolationQuadratureFactory< FieldType, dim, PointSet > PyramidQuadratureType;
199 typedef int QuadratureKeyType ;
203#if HAVE_DUNE_LOCALFUNCTIONS
209 template <
class FieldType,
int dim >
210 using EquidistantQuadratureTraits = detail::InterpolationQuadratureTraitsImpl< FieldType, dim, EquidistantPointSetDerived >;
218 template <
class FieldType,
int dim >
219 using GaussLobattoQuadratureTraits = detail::InterpolationQuadratureTraitsImpl< FieldType, dim, GaussLobattoPointSet >;
227 template <
class FieldType,
int dim >
228 using GaussLegendreQuadratureTraits = detail::InterpolationQuadratureTraitsImpl< FieldType, dim, GaussLegendrePointSet >;
235 template <
class FieldType,
int dim >
236 using CellCentersQuadratureTraits = detail::InterpolationQuadratureTraitsImpl< FieldType, dim, CellCentersPointSet >;
const CoordinateType & point(size_t i) const
obtain coordinates of i-th integration point
Definition: quadratureimp.hh:96
Generic implementation of a Dune quadrature.
Definition: quadratureimp.hh:196
void addQuadraturePoint(const CoordinateType &point, const FieldType weight)
Adds a point-weight pair to the quadrature.
Definition: quadratureimp.hh:270
BaseType::CoordinateType CoordinateType
type of local coordinates
Definition: quadratureimp.hh:207
const FieldType & weight(size_t i) const
obtain weight of i-th integration point
Definition: quadratureimp.hh:251
static unsigned maxOrder(const GeometryType &t, QuadratureType::Enum qt=QuadratureType::GaussLegendre)
maximum quadrature order for given geometry type and quadrature type
Definition: quadraturerules.hh:319
GeometryType geometryType(const Dune::GeometryType &t)
mapping from GeometryType to VTKGeometryType
Definition: common.hh:151
GeometryType
Type representing VTK's entity geometry types.
Definition: common.hh:132
#define DUNE_THROW(E, m)
Definition: exceptions.hh:218
constexpr GeometryType cube(unsigned int dim)
Returns a GeometryType representing a hypercube of dimension dim.
Definition: type.hh:462
Enum
Definition: quadraturerules.hh:131
Dune namespace.
Definition: alignedallocator.hh:13
A unique label for each type of element that can occur in a grid.