DUNE-FEM (unstable)

lumpingquadrature.hh
1#ifndef DUNE_FEM_LUMPING_QUADRATURE_HH
2#define DUNE_FEM_LUMPING_QUADRATURE_HH
3
4#include <dune/geometry/referenceelements.hh>
6
7#include <dune/fem/quadrature/cachingquadrature.hh>
8#include <dune/fem/space/lagrange/lagrangepoints.hh>
9
10namespace Dune {
11
12namespace Fem {
13
30template<class FieldImp, Dune::GeometryType::Id geometryId>
32 : public QuadratureImp<FieldImp, Dune::GeometryType(geometryId).dim()>
33{
34 public:
35 typedef FieldImp FieldType;
36 static constexpr auto dimension = Dune::GeometryType(geometryId).dim();
37
38 private:
41
42 static const int maxOrder_ = 6;
43 int order_ ;
44
45 public:
47
55 : BaseType(id),
56 order_( order )
57 {
58 assert( order_ <= maxOrder_ && order_ >= 1 );
59
60 // create Lagrange points to define quadrature
61 typedef LagrangePointListImplementation< FieldType, Dune::GeometryType(geometryId).id(), dimension, maxOrder_ > LP;
62 LP pts( gt, order_, id );
63
65 //const std::size_t numCorners = refElement.size( dimension );
66 const std::size_t numCorners = pts.nop();
67 const FieldType weight = refElement.volume() / FieldType(numCorners);
68 for( std::size_t i = 0 ; i < numCorners; ++i )
69 {
70 //auto pt = refElement.position( i, dimension );
71 auto pt = pts.point( i );
72 this->addQuadraturePoint( pt, weight );
73 //std::cout << "Point " << i << ": (" << pt << ") " << weight << std::endl;
74 }
75 }
76
79 virtual GeometryType geometryType() const { return Dune::GeometryType(geometryId); }
82 virtual int order () const { return order_; }
83
85 static std::size_t maxOrder () { return maxOrder_; }
86};
87
88template<class FieldType, int dimension>
89struct DefaultLumpingQuadratureTraits
90{
91 typedef QuadratureImp<FieldType, dimension> IntegrationPointListType;
92
93 static constexpr Dune::GeometryType::Id simplexId = Dune::GeometryTypes::simplex(dimension);
94 static constexpr Dune::GeometryType::Id cubeId = Dune::GeometryTypes::cube(dimension);
95 static constexpr Dune::GeometryType::Id prismId = Dune::GeometryTypes::prism ;
96 static constexpr Dune::GeometryType::Id pyramidId = Dune::GeometryTypes::pyramid;
97
98 typedef LumpingQuadrature<FieldType, simplexId> SimplexQuadratureType;
99 typedef LumpingQuadrature<FieldType, cubeId > CubeQuadratureType;
100 typedef LumpingQuadrature<FieldType, prismId > PrismQuadratureType;
101 typedef LumpingQuadrature<FieldType, pyramidId> PyramidQuadratureType;
102
103 typedef SimplexQuadratureType LineQuadratureType;
104 typedef SimplexQuadratureType PointQuadratureType;
105
106 typedef int QuadratureKeyType;
107};
108
109// LumpingQuadrature uses CachingQuadrature with a different traits class for creating the quadratures.
110template<class GridPartImp, int codim>
111using CachingLumpingQuadrature = CachingQuadrature< GridPartImp, codim, DefaultLumpingQuadratureTraits >;
112
113} // Fem
114
115} // Dune
116
117
118#endif // DUNE_FEM_LUMPING_QUADRATURE_HH
size_t id() const
obtain the identifier of the integration point list
Definition: quadratureimp.hh:122
Definition: lumpingquadrature.hh:33
static std::size_t maxOrder()
maximal order of available quadratures
Definition: lumpingquadrature.hh:85
virtual GeometryType geometryType() const
Definition: lumpingquadrature.hh:79
LumpingQuadrature(const GeometryType &gt, int order, int id)
constructor filling the list of points and weights.
Definition: lumpingquadrature.hh:54
virtual int order() const
obtain order of the integration point list
Definition: lumpingquadrature.hh:82
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
const FieldType & weight(size_t i) const
obtain weight of i-th integration point
Definition: quadratureimp.hh:251
vector space out of a tensor product of fields.
Definition: fvector.hh:95
Unique label for each type of entities that can occur in DUNE grids.
Definition: type.hh:114
constexpr unsigned int dim() const
Return dimension of the type.
Definition: type.hh:360
constexpr unsigned int id() const
Return the topology id of the type.
Definition: type.hh:365
bool gt(const T &first, const T &second, typename EpsilonType< T >::Type epsilon)
test if first greater than second
Definition: float_cmp.cc:158
constexpr GeometryType cube(unsigned int dim)
Returns a GeometryType representing a hypercube of dimension dim.
Definition: type.hh:462
constexpr GeometryType prism
GeometryType representing a 3D prism.
Definition: type.hh:528
constexpr GeometryType pyramid
GeometryType representing a 3D pyramid.
Definition: type.hh:522
constexpr GeometryType simplex(unsigned int dim)
Returns a GeometryType representing a simplex of dimension dim.
Definition: type.hh:453
Dune namespace.
Definition: alignedallocator.hh:13
static const ReferenceElement & general(const GeometryType &type)
get general reference elements
Definition: referenceelements.hh:156
A unique label for each type of element that can occur in a grid.
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Jul 24, 22:29, 2024)