P0Element

Degree 0 Lagrange element.

Defined in Rodin/Variational/P0/P0Element.h

template <
  class Scalar>
class P0Element;
Template parameters
Scalar Type of scalar range (e.g., Real, Complex)

Piecewise constant (degree 0) scalar Lagrange element.

SpecializationDescription
Math::SpatialMatrix<Scalar>
Full specialization
template <
  class Scalar>
class P0Element<
  Math::SpatialMatrix< Scalar >> final;
Matrix-valued reference element built from scalar nodal functionals.
Math::SpatialVector<Scalar>
Full specialization
template <
  class Scalar>
class P0Element<
  Math::SpatialVector< Scalar >> final;
Piecewise constant (degree 0) vector Lagrange element.

The P0Element represents a piecewise constant finite element with:

  • DOF count: 1 per element (located at barycenter)
  • Basis function: $ \phi(x) = 1 $ for all $ x $ in element
  • Derivatives: $ \nabla \phi = 0 $ (constant function has zero gradient)

P0 elements are discontinuous across element interfaces, making them suitable for DG methods, flux computations, and element-wise constant approximations.

Direct inheritance by class family
↓
P0Element

Inherits from

Base classResponsibility
FiniteElementBase<P0Element<Scalar>>public
Full type
FiniteElementBase< P0Element< Scalar > >
Base class for finite elements.

Inherited interface

Declared inMembers
FiniteElementBase
5 members

Public types

class LinearForm
Represents a linear form of a P0 scalar element.
class BasisFunction
Represents the constant basis function of a P0 scalar element.
using Parent = FiniteElementBase<P0Element<Scalar>>
Parent class.
using ScalarType = Scalar
Scalar value type.
using RangeType = Scalar
Type of range.

Constructors, destructors, conversion operators

P0Element(Geometry::Polytope::Type geometry) constexpr
Constructs the P0Element from the given arguments.
P0Element(const P0Element& other) constexpr
Copy constructor.
P0Element(P0Element&& other) constexpr
Move constructor.

Public functions

auto operator=(const P0Element& other) -> P0Element& defaulted constexpr
Assigns the scalar basis and matrix component dimensions.
auto operator=(P0Element&& other) -> P0Element& defaulted constexpr
Assigns the scalar basis and matrix component dimensions.
auto getCount() const -> size_t constexpr
Gets the number of degrees of freedom in the finite element.
auto getNode(size_t i) const -> const Math::SpatialVector<Real>&
Gets the node of a local degree of freedom.
auto getLinearForm(size_t local) const -> LinearForm constexpr
Gets the degree-of-freedom functional of a local degree of freedom.
auto getBasis(size_t local) const -> BasisFunction constexpr
Gets the basis function of a local degree of freedom.
auto getOrder() const -> size_t constexpr
Returns a total polynomial degree bound for the reference basis.
auto getDegree() const -> Optional<size_t> constexpr
Returns the total polynomial degree of the reference basis.
auto getDegree(std::initializer_list<size_t> directions) const -> Optional<size_t>
Returns a degree bound in selected reference coordinates.

Function documentation

P0Element(Geometry::Polytope::Type geometry) constexpr

Constructs the P0Element from the given arguments.

Parameters
geometry Reference geometry.

P0Element(const P0Element& other) constexpr

Copy constructor.

Parameters
other Object to copy from.

P0Element(P0Element&& other) constexpr

Move constructor.

Parameters
other Object to move from.

P0Element& operator=(const P0Element& other) defaulted constexpr

Assigns the scalar basis and matrix component dimensions.

Parameters
other Object to copy from.
Returns Reference to this object after the operation.

P0Element& operator=(P0Element&& other) defaulted constexpr

Assigns the scalar basis and matrix component dimensions.

Parameters
other Object to move from.
Returns Reference to this object after the operation.

size_t getCount() const constexpr

Gets the number of degrees of freedom in the finite element.

Returns Number of degrees of freedom

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

Gets the node of a local degree of freedom.

Parameters
i Index of the requested entry.
Returns The node of a local degree of freedom.

LinearForm getLinearForm(size_t local) const constexpr

Gets the degree-of-freedom functional of a local degree of freedom.

Parameters
local Local degree-of-freedom index; unused by this constant element.
Returns The degree-of-freedom functional of a local degree of freedom.

BasisFunction getBasis(size_t local) const constexpr

Gets the basis function of a local degree of freedom.

Parameters
local Local degree-of-freedom index; unused by this constant element.
Returns Value of the selected local basis function at the evaluation point.

size_t getOrder() const constexpr

Returns a total polynomial degree bound for the reference basis.

Returns Polynomial order of the finite element.

Optional<size_t> getDegree() const constexpr

Returns the total polynomial degree of the reference basis.

Returns Zero for the constant reference basis.

Optional<size_t> getDegree(std::initializer_list<size_t> directions) const

Returns a degree bound in selected reference coordinates.

Parameters
directions Reference-coordinate indices; duplicates are ignored.
Returns The bound, or no value for invalid or unsupported selections.