FunctionBase

Base class for function objects which can be evaluated over a mesh.

Defined in Rodin/Variational/Function.h

template <
  class Derived>
class FunctionBase;
Template parameters
Derived Derived class following CRTP (Curiously Recurring Template Pattern)

Base class for functions defined on finite element meshes.

Instances of FunctionBase will always have the getValue() method defined, which enables the evaluation of any function on some mesh element.

FunctionBase provides the foundation for representing mathematical functions defined over geometric domains discretized by finite element meshes. This includes both analytical functions and discrete finite element functions (grid functions) that arise in variational formulations.

Mathematical Foundation

A function $ f : \Omega \to \mathbb{R}^n $ maps points in the domain $ \Omega $ to values in $ \mathbb{R}^n $ . In finite element analysis, functions serve various roles:

  • Analytical functions: Exact solutions, boundary conditions, source terms
  • Discrete functions: Finite element approximations $ u_h = \sum_i u_i \phi_i $
  • Test/Trial functions: Basis functions $ \phi_i $ spanning finite element spaces

Key Features

  • Domain support: Functions can be restricted to subdomains or boundaries
  • Trace operations: Support for function traces on mesh boundaries
  • Point evaluation: Evaluation at arbitrary points within the domain
  • Polymorphic design: CRTP enables compile-time polymorphism for efficiency
Direct inheritance by class family
↓
FunctionBase
↓

Inherits from

Base classResponsibility
FormLanguage::Basepublic
Full type
FormLanguage::Base
Base class for all objects in Rodin's FormLanguage system.

Derived classes

Derived classDescription
BooleanFunctionBase<LHSDerived>public
Full type
BooleanFunctionBase< LHSDerived >
Base class for boolean-valued functions.
MatrixFunctionBase<ScalarType, …>public
Full type
MatrixFunctionBase< ScalarType, FittingTensor< GradDerived, Displacement, LocatorType > >
Base class for matrix-valued functions defined on a mesh.
ScalarFunctionBase<…>public
Full type
ScalarFunctionBase< typename FormLanguage::Traits< FunctionBase< OperandDerived > >::ScalarType, Component< FunctionBase< OperandDerived >, size_t, size_t > >
Base class for scalar-valued functions with templated scalar type.
See moreSee less
Derived classDescription
VectorFunctionBase<ScalarType, …>public
Full type
VectorFunctionBase< ScalarType, FittingForce< PhiDerived, GradDerived, Displacement, LocatorType > >
Base class for vector-valued functions defined on a mesh.
TraceOperator<FunctionBase>public
Full type
TraceOperator< FunctionBase >
Trace (boundary restriction) operator for functions.
BooleanFunctionBase<RHSDerived>public
Full type
BooleanFunctionBase< RHSDerived >
Base class for boolean-valued functions.
BooleanFunctionBase<…>public
Full type
BooleanFunctionBase< AND< LHSType, RHSType > >
Base class for boolean-valued functions.
BooleanFunctionBase<…>public
Full type
BooleanFunctionBase< BooleanFunction< Boolean > >
Base class for boolean-valued functions.
BooleanFunctionBase<…>public
Full type
BooleanFunctionBase< EQ< LHSType, RHSType > >
Base class for boolean-valued functions.
BooleanFunctionBase<…>public
Full type
BooleanFunctionBase< GEQ< FunctionBase< LHSDerived >, FunctionBase< RHSDerived > > >
Base class for boolean-valued functions.
BooleanFunctionBase<…>public
Full type
BooleanFunctionBase< GT< LHSType, RHSType > >
Base class for boolean-valued functions.
BooleanFunctionBase<…>public
Full type
BooleanFunctionBase< LEQ< FunctionBase< LHSDerived >, FunctionBase< RHSDerived > > >
Base class for boolean-valued functions.
BooleanFunctionBase<…>public
Full type
BooleanFunctionBase< LT< FunctionBase< LHSDerived >, FunctionBase< RHSDerived > > >
Base class for boolean-valued functions.
BooleanFunctionBase<…>public
Full type
BooleanFunctionBase< NEQ< LHSType, RHSType > >
Base class for boolean-valued functions.
BooleanFunctionBase<…>public
Full type
BooleanFunctionBase< OR< LHSType, RHSType > >
Base class for boolean-valued functions.
MatrixFunctionBase<ScalarType, …>public
Full type
MatrixFunctionBase< ScalarType, IdentityMatrix >
Base class for matrix-valued functions defined on a mesh.
MatrixFunctionBase<Scalar, …>public
Full type
MatrixFunctionBase< Scalar, MatrixFunction< MatrixType > >
Base class for matrix-valued functions defined on a mesh.
MatrixFunctionBase<ScalarType, …>public
Full type
MatrixFunctionBase< ScalarType, MatrixFunction >
Base class for matrix-valued functions defined on a mesh.
ScalarFunctionBase<ScalarType, …>public
Full type
ScalarFunctionBase< ScalarType, Component >
Base class for scalar-valued functions with templated scalar type.
ScalarFunctionBase<Scalar, Zero<Scalar>>public
Full type
ScalarFunctionBase< Scalar, Zero< Scalar > >
Base class for scalar-valued functions with templated scalar type.
VectorFunctionBase<Real, GradDerived>public
Full type
VectorFunctionBase< Real, GradDerived >
Base class for vector-valued functions defined on a mesh.
VectorFunctionBase<ScalarType, …>public
Full type
VectorFunctionBase< ScalarType, BoundaryNormal >
Base class for vector-valued functions defined on a mesh.
VectorFunctionBase<ScalarType, …>public
Full type
VectorFunctionBase< ScalarType, FaceNormal >
Base class for vector-valued functions defined on a mesh.
VectorFunctionBase<ScalarType, …>public
Full type
VectorFunctionBase< ScalarType, GradBase< OperandType, Derived > >
Base class for vector-valued functions defined on a mesh.
VectorFunctionBase<ScalarType, …>public
Full type
VectorFunctionBase< ScalarType, VectorFunction< VectorType > >
Base class for vector-valued functions defined on a mesh.
VectorFunctionBase<ScalarType, …>public
Full type
VectorFunctionBase< ScalarType, VectorFunction< V, Values... > >
Base class for vector-valued functions defined on a mesh.
VectorFunctionBase<ScalarType, …>public
Full type
VectorFunctionBase< ScalarType, VectorFunction< F > >
Base class for vector-valued functions defined on a mesh.
VectorFunctionBase<Scalar, …>public
Full type
VectorFunctionBase< Scalar, Zero< VectorType > >
Base class for vector-valued functions defined on a mesh.

Overrides

MemberBase declaration
copy()Base::copy

Inherited interface

Declared inMembers
FormLanguage::Base
3 members
Identifiable
2 members

Public types

class Cache
Function value retained for the current quadrature binding.
using Parent = FormLanguage::Base
Parent class type.
using TraceDomain = FlatSet<Geometry::Attribute>
Domain type for trace operations (set of mesh attributes).

Constructors, destructors, conversion operators

FunctionBase() defaulted
Default constructor.
FunctionBase(const FunctionBase& other)
Copy constructor.
FunctionBase(FunctionBase&& other)
Move constructor.
~FunctionBase() defaulted virtual
Virtual destructor.

Public functions

auto operator=(FunctionBase&& other) -> FunctionBase&
Move assignment operator.
auto operator()(const Geometry::Point& p) const -> auto constexpr
Evaluates the function on a Point belonging to the mesh.
auto operator()(const IntegrationPoint& ip) const -> auto constexpr
Evaluates the function at an integration point.
auto operator()(size_t i) const -> auto
Extracts the i-th component of the function.
auto operator()(size_t i, size_t j) const -> auto
Extracts the (i,j)-th component of a matrix function.
auto x() const -> auto constexpr
Convenience accessor for the first component (x-component).
auto y() const -> auto constexpr
Convenience accessor for the second component (y-component).
auto z() const -> auto constexpr
Convenience accessor for the third component (z-component).
auto T() const -> auto constexpr
Returns the transpose of the function.
auto traceOf(const Geometry::Attribute& attr) -> Derived& constexpr
Sets a single attribute as the trace domain.
traceOf
Sets multiple attributes as the trace domain.
See declaration
template<class A1, class A2, class... As>
auto traceOf(const A1& a1, const A2& a2, const As&... as) -> Derived& constexpr
auto traceOf(const FlatSet<Geometry::Attribute>& attr) -> Derived& constexpr
Sets a set of attributes as the trace domain.
auto getTraceDomain() const -> const TraceDomain& constexpr
Gets the set of attributes which will be interpreted as the domains to "trace".
auto getValue(const Geometry::Point& p) const -> auto constexpr
Evaluates the function on a Point belonging to the mesh.
auto getValue(const IntegrationPoint& ip) const -> auto constexpr
Evaluates the function at an integration point.
auto getOrder(const Geometry::Polytope& geom) const -> Optional<size_t> constexpr noexcept
Recommends an automatic integration order on a mesh entity.
auto getDerived() -> Derived& noexcept
Returns this object as the CRTP-derived type.
auto getDerived() const -> const Derived& noexcept
Returns this object as the CRTP-derived type.
auto copy() const -> FunctionBase* override noexcept
Polymorphically copies the derived function.

Function documentation

FunctionBase(const FunctionBase& other)

Copy constructor.

Parameters
other Object to copy from.

FunctionBase(FunctionBase&& other)

Move constructor.

Parameters
other Object to move from.

FunctionBase& operator=(FunctionBase&& other)

Move assignment operator.

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

auto operator()(const Geometry::Point& p) const constexpr

Evaluates the function on a Point belonging to the mesh.

Parameters
p in Point at which to evaluate the function
Returns Function value at the given point

This operator provides convenient function call syntax for evaluation. Delegates to the derived class's getValue() method via CRTP.

auto operator()(const IntegrationPoint& ip) const constexpr

Evaluates the function at an integration point.

Parameters
ip Integration point at which the expression is evaluated.
Returns Value of the expression at the supplied evaluation point.

auto operator()(size_t i) const

Extracts the i-th component of the function.

Parameters
i in Component index
Returns Component function object

For vector or matrix-valued functions, this returns a scalar function representing the specified component.

auto operator()(size_t i, size_t j) const

Extracts the (i,j)-th component of a matrix function.

Parameters
i in Row index
j in Column index
Returns Component function object

auto x() const constexpr

Convenience accessor for the first component (x-component).

Returns Component function for index 0

auto y() const constexpr

Convenience accessor for the second component (y-component).

Returns Component function for index 1

auto z() const constexpr

Convenience accessor for the third component (z-component).

Returns Component function for index 2

auto T() const constexpr

Returns the transpose of the function.

Returns Transposed function object

For matrix-valued functions $ A(x) $ , returns $ A^T(x) $ .

Derived& traceOf(const Geometry::Attribute& attr) constexpr

Sets a single attribute as the trace domain.

Parameters
attr in Mesh attribute defining the trace domain
Returns Reference to self (for method chaining)

Convenience function to call traceOf(FlatSet<int>) with only one attribute. The trace operation restricts function evaluation to the specified boundary or interface regions.

template<class Derived> template<class A1, class A2, class... As>
Derived& traceOf(const A1& a1, const A2& a2, const As&... as) constexpr

Sets multiple attributes as the trace domain.

Parameters
a1 Mesh attributes selecting the region.
a2 Mesh attributes selecting the region.
as Mesh attributes selecting the region.
Returns Reference to self (for method chaining)

The attributes are collected into the trace domain of the function.

Derived& traceOf(const FlatSet<Geometry::Attribute>& attr) constexpr

Sets a set of attributes as the trace domain.

Parameters
attr in Set of mesh attributes defining the trace domain
Returns Reference to self (for method chaining)

The trace domain specifies regions (typically boundaries or interfaces) where the function should be evaluated via continuous extension from adjacent elements.

const TraceDomain& getTraceDomain() const constexpr

Gets the set of attributes which will be interpreted as the domains to "trace".

Returns The set of attributes which will be interpreted as the domains to "trace".

The domains to trace are interpreted as the domains where there shall be a continuous extension from values to the interior boundaries. If the trace domain is empty, then this has the semantic value that it has not been specified yet.

auto getValue(const Geometry::Point& p) const constexpr

Evaluates the function on a Point belonging to the mesh.

Parameters
p Point at which the operation is evaluated.
Returns Value of the expression at the supplied evaluation point.

auto getValue(const IntegrationPoint& ip) const constexpr

Evaluates the function at an integration point.

Parameters
ip Integration point at which the expression is evaluated.
Returns Value of the expression at the supplied evaluation point.

Optional<size_t> getOrder(const Geometry::Polytope& geom) const constexpr noexcept

Recommends an automatic integration order on a mesh entity.

Parameters
geom Entity supplying reference geometry and coordinate mapping.
Returns An integration recommendation, or no established estimate.

Known polynomial structure supplies a degree-based recommendation. Rational expressions may use a documented accuracy estimate instead; no polynomial exactness is implied in that case. An empty result means that no recommendation is established. A result of zero must certify an elementwise constant expression, since constant-value optimizations also consume this information. Integrators retain explicit overrides and account for the geometric measure in their selection policies.

Derived& getDerived() noexcept

Returns this object as the CRTP-derived type.

Returns This object as the CRTP-derived type.

const Derived& getDerived() const noexcept

Returns this object as the CRTP-derived type.

Returns This object as the CRTP-derived type.

FunctionBase* copy() const override noexcept

Polymorphically copies the derived function.

Returns Pointer to a newly allocated copy; the caller owns the returned object.