From: Wolfgang Bangerth Date: Thu, 5 May 2022 20:59:41 +0000 (-0600) Subject: Provide ReferenceCell::get_midpoint_quadrature(). X-Git-Tag: v9.4.0-rc1~248^2~3 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b2e97311b0fbb11e95fc755c581572308af835ea;p=dealii.git Provide ReferenceCell::get_midpoint_quadrature(). --- diff --git a/include/deal.II/grid/reference_cell.h b/include/deal.II/grid/reference_cell.h index 5431a59092..1a6ec8f8de 100644 --- a/include/deal.II/grid/reference_cell.h +++ b/include/deal.II/grid/reference_cell.h @@ -204,10 +204,23 @@ public: get_gauss_type_quadrature(const unsigned n_points_1D) const; /** - * Return a quadrature rule with the support points of the given reference - * cell. For 1d line segments, this corresponds to the quadrature points - * of the trapezoidal rule, which by taking tensor products easily - * generalizes also to other hypercube elements (see also QTrapezoid). + * Return a quadrature object that has a single quadrature point at the + * barycenter of the cell with quadrature weight equal to the volume of the + * reference cell. This quadrature formula is exact for integrals of constant + * and linear integrands. + * + * The object returned by this function generalizes what the QMidpoint class + * represents to other reference cells. + */ + template + Quadrature + get_midpoint_quadrature() const; + + /** + * Return a quadrature rule whose quadrature points are the vertices of the + * given reference cell. For 1d line segments, this corresponds to the + * quadrature points of the trapezoidal rule, which by taking tensor products + * easily generalizes also to other hypercube elements (see also QTrapezoid). * For all reference cell shapes, the quadrature points are ordered * in the same order as the vertices of the reference cell. * @@ -926,6 +939,16 @@ ReferenceCell::get_dimension() const +template +Quadrature +ReferenceCell::get_midpoint_quadrature() const +{ + return Quadrature(std::vector>({barycenter()}), + std::vector({volume()})); +} + + + inline unsigned int ReferenceCell::n_vertices() const {