From b2e97311b0fbb11e95fc755c581572308af835ea Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Thu, 5 May 2022 14:59:41 -0600 Subject: [PATCH] Provide ReferenceCell::get_midpoint_quadrature(). --- include/deal.II/grid/reference_cell.h | 31 +++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) 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 { -- 2.39.5