template<class Derived>
Rodin::Variational::FunctionBase class

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

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

Base classes

class Base
Base class for all objects in Rodin's FormLanguage system.

Derived classes

template<class Derived>
class BooleanFunctionBase
Base class for boolean-valued functions.
template<class Derived>
class BooleanFunctionBase
Base class for boolean-valued functions.
template<class Derived>
class BooleanFunctionBase
Base class for boolean-valued functions.
template<class Derived>
class BooleanFunctionBase
Base class for boolean-valued functions.
template<class Derived>
class BooleanFunctionBase
Base class for boolean-valued functions.
template<class Derived>
class BooleanFunctionBase
Base class for boolean-valued functions.
template<class Derived>
class BooleanFunctionBase
Base class for boolean-valued functions.
template<class StrictType>
class GridFunctionBaseReference
Base class for discrete finite element functions.
template<class StrictType>
class GridFunctionBaseReference
Base class for discrete finite element functions.
template<class StrictType>
class GridFunctionBaseReference
Base class for discrete finite element functions.
template<class Scalar, class Derived>
class MatrixFunctionBase
Base class for matrix-valued functions defined on a mesh.
template<class Scalar, class Derived>
class MatrixFunctionBase
Base class for matrix-valued functions defined on a mesh.
template<class Scalar, class Derived>
class MatrixFunctionBase
Base class for matrix-valued functions defined on a mesh.
template<class Scalar, class Derived>
class ScalarFunctionBase
Base class for scalar-valued functions with templated scalar type.
template<class Scalar, class Derived>
class ScalarFunctionBase
Base class for scalar-valued functions with templated scalar type.
template<class Scalar, class Derived>
class ScalarFunctionBase
Base class for scalar-valued functions with templated scalar type.
template<class Scalar, class Derived>
class ScalarFunctionBase
Base class for scalar-valued functions with templated scalar type.
template<class Scalar, class Derived>
class ScalarFunctionBase
Base class for scalar-valued functions with templated scalar type.
template<class Scalar, class Derived>
class ScalarFunctionBase
Base class for scalar-valued functions with templated scalar type.
template<class Scalar, class Derived>
class ScalarFunctionBase
Base class for scalar-valued functions with templated scalar type.
template<class Scalar, class Derived>
class ScalarFunctionBase
Base class for scalar-valued functions with templated scalar type.
template<class Scalar, class Derived>
class ScalarFunctionBase
Base class for scalar-valued functions with templated scalar type.
template<class Scalar, class Derived>
class ScalarFunctionBase
Base class for scalar-valued functions with templated scalar type.
template<class Scalar, class Derived>
class ScalarFunctionBase
Base class for scalar-valued functions with templated scalar type.
template<class Scalar, class Derived>
class ScalarFunctionBase
Base class for scalar-valued functions with templated scalar type.
template<class Scalar, class Derived>
class ScalarFunctionBase
Base class for scalar-valued functions with templated scalar type.
template<class Scalar, class Derived>
class ScalarFunctionBase
Base class for scalar-valued functions with templated scalar type.
template<class Scalar, class Derived>
class ScalarFunctionBase
Base class for scalar-valued functions with templated scalar type.
template<class Scalar, class Derived>
class ScalarFunctionBase
Base class for scalar-valued functions with templated scalar type.
template<class Scalar, class Derived>
class ScalarFunctionBase
Base class for scalar-valued functions with templated scalar type.
template<class Scalar, class Derived>
class ScalarFunctionBase
Base class for scalar-valued functions with templated scalar type.
template<class Scalar, class Derived>
class ScalarFunctionBase
Base class for scalar-valued functions with templated scalar type.
template<class Scalar, class Derived>
class ScalarFunctionBase
Base class for scalar-valued functions with templated scalar type.
template<class Scalar, class Derived>
class ScalarFunctionBase
Base class for scalar-valued functions with templated scalar type.
template<class Scalar, class Derived>
class ScalarFunctionBase
Base class for scalar-valued functions with templated scalar type.
template<class Scalar, class Derived>
class ScalarFunctionBase
Base class for scalar-valued functions with templated scalar type.
template<class Scalar, class Derived>
class ScalarFunctionBase
Base class for scalar-valued functions with templated scalar type.
template<class Scalar, class Derived>
class ScalarFunctionBase
Base class for scalar-valued functions with templated scalar type.
template<class Scalar, class Derived>
class ScalarFunctionBase
Base class for scalar-valued functions with templated scalar type.
template<class Scalar, class Derived>
class ScalarFunctionBase
Base class for scalar-valued functions with templated scalar type.
template<class Scalar, class Derived>
class ScalarFunctionBase
Base class for scalar-valued functions with templated scalar type.
template<class Scalar, class Derived>
class ScalarFunctionBase
Base class for scalar-valued functions with templated scalar type.
template<class Scalar, class Derived>
class ScalarFunctionBase
Base class for scalar-valued functions with templated scalar type.
template<class Scalar, class Derived>
class ScalarFunctionBase
Base class for scalar-valued functions with templated scalar type.
template<class Scalar, class Derived>
class ScalarFunctionBase
Base class for scalar-valued functions with templated scalar type.
template<class Scalar, class Derived>
class ScalarFunctionBase
Base class for scalar-valued functions with templated scalar type.
template<class Scalar, class Derived>
class ScalarFunctionBase
Base class for scalar-valued functions with templated scalar type.
template<class Scalar, class Derived>
class ScalarFunctionBase
Base class for scalar-valued functions with templated scalar type.
template<class Scalar, class Derived>
class ScalarFunctionBase
Base class for scalar-valued functions with templated scalar type.
template<class Scalar, class Derived>
class ScalarFunctionBase
Base class for scalar-valued functions with templated scalar type.
template<class Scalar, class Derived>
class VectorFunctionBase
Base class for vector-valued functions defined on a mesh.
template<class Scalar, class Derived>
class VectorFunctionBase
Base class for vector-valued functions defined on a mesh.
template<class Scalar, class Derived>
class VectorFunctionBase
Base class for vector-valued functions defined on a mesh.
template<class Scalar, class Derived>
class VectorFunctionBase
Base class for vector-valued functions defined on a mesh.
template<class Scalar, class Derived>
class VectorFunctionBase
Base class for vector-valued functions defined on a mesh.
template<class Scalar, class Derived>
class VectorFunctionBase
Base class for vector-valued functions defined on a mesh.
template<class Scalar, class Derived>
class VectorFunctionBase
Base class for vector-valued functions defined on a mesh.
template<>
class TraceOperator<FunctionBase>
Trace (boundary restriction) operator for functions.

Public types

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()(const Geometry::Point& p) const -> decltype(auto) constexpr
Evaluates the function on a Point belonging to the mesh.
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.
template<class A1, class A2, class ... As>
auto traceOf(const A1& a1, const A2& a2, const As&... as) -> Derived& constexpr
Sets multiple attributes as the trace domain.
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 -> decltype(auto) constexpr
Evaluates the function on a Point belonging to the mesh.
auto copy() const -> FunctionBase* override noexcept
Creates a polymorphic copy of this object.

Function documentation

template<class Derived>
decltype(auto) Rodin::Variational::FunctionBase<Derived>::operator()(const Geometry::Point& p) const constexpr

Evaluates the function on a Point belonging to the mesh.

Parameters
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.

template<class Derived>
auto Rodin::Variational::FunctionBase<Derived>::operator()(size_t i) const

Extracts the i-th component of the function.

Parameters
in Component index
Returns Component function object

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

template<class Derived>
auto Rodin::Variational::FunctionBase<Derived>::operator()(size_t i, size_t j) const

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

Parameters
in Row index
in Column index
Returns Component function object

template<class Derived>
auto Rodin::Variational::FunctionBase<Derived>::x() const constexpr

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

Returns Component function for index 0

template<class Derived>
auto Rodin::Variational::FunctionBase<Derived>::y() const constexpr

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

Returns Component function for index 1

template<class Derived>
auto Rodin::Variational::FunctionBase<Derived>::z() const constexpr

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

Returns Component function for index 2

template<class Derived>
auto Rodin::Variational::FunctionBase<Derived>::T() const constexpr

Returns the transpose of the function.

Returns Transposed function object

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

template<class Derived>
Derived& Rodin::Variational::FunctionBase<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& Rodin::Variational::FunctionBase<Derived>::traceOf(const A1& a1, const A2& a2, const As&... as) constexpr

Sets multiple attributes as the trace domain.

Parameters
a1 in First attribute
a2 in Second attribute
as in Additional attributes (variadic)
Returns Reference to self (for method chaining)

template<class Derived>
Derived& Rodin::Variational::FunctionBase<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.

template<class Derived>
const TraceDomain& Rodin::Variational::FunctionBase<Derived>::getTraceDomain() const constexpr

Gets 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.

template<class Derived>
decltype(auto) Rodin::Variational::FunctionBase<Derived>::getValue(const Geometry::Point& p) const constexpr

Evaluates the function on a Point belonging to the mesh.

template<class Derived>
FunctionBase* Rodin::Variational::FunctionBase<Derived>::copy() const override noexcept

Creates a polymorphic copy of this object.

Returns Non-owning pointer to the copied object

Pure virtual function that must be implemented by derived classes to support polymorphic copying. The returned pointer is non-owning; the caller is responsible for managing its lifetime.