]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Provide ReferenceCell::get_midpoint_quadrature().
authorWolfgang Bangerth <bangerth@colostate.edu>
Thu, 5 May 2022 20:59:41 +0000 (14:59 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Tue, 10 May 2022 02:48:32 +0000 (20:48 -0600)
include/deal.II/grid/reference_cell.h

index 5431a590922762803efb84ac9daae3a7a5787450..1a6ec8f8ded7b68b90e5aa2aaf9f29ab46cbd381 100644 (file)
@@ -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 <int dim>
+  Quadrature<dim>
+  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 <int dim>
+Quadrature<dim>
+ReferenceCell::get_midpoint_quadrature() const
+{
+  return Quadrature<dim>(std::vector<Point<dim>>({barycenter<dim>()}),
+                         std::vector<double>({volume()}));
+}
+
+
+
 inline unsigned int
 ReferenceCell::n_vertices() const
 {

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.