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
where is the centroid of the polytope and is the weight equal to the volume (measure) of the reference element.
Reference Element Centroids
The quadrature points are located at:
- Point:
- Segment:
- Triangle:
- Quadrilateral:
- Tetrahedron:
- Wedge:
- Hexahedron:
Reference Element Weights
The weights correspond to the reference element measures:
- Point:
- Segment:
- Triangle:
- Quadrilateral:
- Tetrahedron:
- Wedge:
- Hexahedron:
This is the simplest possible quadrature rule for each geometry type and is computationally efficient when low accuracy is acceptable.
Inherits from
| Base class | Responsibility |
|---|---|
QuadratureFormulaBasepublicFull typeQuadratureFormulaBase | Read-only access to reference quadrature points and weights. |
Overrides
| Member | Base 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 |