Centroid final

Single-point centroid quadrature formula.

Defined in Rodin/QF/Centroid.h

class Centroid final;

This class implements a quadrature formula that uses a single integration point located at the centroid (barycenter) of the reference polytope. The quadrature is exact for polynomials up to degree 1 (linear functions).

Mathematical Foundation

The centroid rule approximates integrals as:

\[ \int_K f(x) \, dx \approx w \cdot f(c) \]

where $ c $ is the centroid of the polytope $ K $ and $ w $ is the weight equal to the volume (measure) of the reference element.

Reference Element Centroids

The quadrature points are located at:

  • Point: $ (0) $
  • Segment: $ (0.5) $
  • Triangle: $ (1/3, 1/3) $
  • Quadrilateral: $ (0.5, 0.5) $
  • Tetrahedron: $ (0.25, 0.25, 0.25) $
  • Wedge: $ (1/3, 1/3, 0.5) $
  • Hexahedron: $ (0.5, 0.5, 0.5) $

Reference Element Weights

The weights correspond to the reference element measures:

  • Point: $ 1 $
  • Segment: $ 1 $
  • Triangle: $ 1/2 $
  • Quadrilateral: $ 1 $
  • Tetrahedron: $ 1/6 $
  • Wedge: $ 1/2 $
  • Hexahedron: $ 1 $

This is the simplest possible quadrature rule for each geometry type and is computationally efficient when low accuracy is acceptable.

Direct inheritance by class family
↓
Centroid

Inherits from

Base classResponsibility
QuadratureFormulaBasepublic
Full type
QuadratureFormulaBase
Read-only access to reference quadrature points and weights.

Overrides

MemberBase declaration
getSamples()QuadratureFormulaBase::getSamples
getSize()QuadratureFormulaBase::getSize
getPoint()QuadratureFormulaBase::getPoint
getWeight()QuadratureFormulaBase::getWeight

Public types

using Parent = QuadratureFormulaBase
Parent class type.

Constructors, destructors, conversion operators

Centroid(Geometry::Polytope::Type g)
Constructs a centroid quadrature formula for the given geometry.

Public functions

auto getGeometry() const -> Geometry::Polytope::Type constexpr
Gets the polytope geometry of this centroid rule.
auto getSamples() const -> Optional<Samples> override
auto getSize() const -> size_t override
Gets the number of quadrature points (always 1).
auto getPoint(size_t i) const -> const Math::SpatialVector<Real>& override
Gets the single quadrature point coordinates (the centroid).
auto getWeight(size_t i) const -> Real override
Gets the weight of the single quadrature point.
auto copy() const -> Centroid* noexcept
Creates a copy of this quadrature formula.

Function documentation

Centroid(Geometry::Polytope::Type g)

Constructs a centroid quadrature formula for the given geometry.

Parameters
g Geometry type (e.g., Triangle, Quadrilateral, Tetrahedron, etc.)

Geometry::Polytope::Type getGeometry() const constexpr

Gets the polytope geometry of this centroid rule.

Returns Polytope geometry type.

Optional<Samples> getSamples() const override

Returns Read-only views of the retained reference samples.

size_t getSize() const override

Gets the number of quadrature points (always 1).

Returns Always returns 1 (single point quadrature)

const Math::SpatialVector<Real>& getPoint(size_t i) const override

Gets the single quadrature point coordinates (the centroid).

Parameters
i Index of the quadrature point (must be 0)
Returns Reference to the centroid coordinates in reference space

Real getWeight(size_t i) const override

Gets the weight of the single quadrature point.

Parameters
i Index of the quadrature point (must be 0)
Returns Weight equal to the reference element measure

Centroid* copy() const noexcept

Creates a copy of this quadrature formula.

Returns Pointer to a new Centroid instance (caller takes ownership)