template<class FES>
Rodin::Variational::TestFunction class

Represents a function which belongs to a test space.

Template parameters
FES Type of finite element space

Test function in a finite element space.

In the weak formulation of a partial differential equation, test functions (also called weighting functions) are used to convert the PDE into a variational problem. Given a finite element space $ V_h $ , the test function $ v \in V_h $ is chosen from this space.

Mathematical Foundation

The weak formulation seeks $ u \in U_h $ such that:

\[ a(u, v) = l(v) \quad \forall v \in V_h \]

where:

  • $ v $ is the test function
  • $ a(\cdot, \cdot) $ is a bilinear form
  • $ l(\cdot) $ is a linear functional
  • $ V_h $ is the test space (typically equal to the trial space $ U_h $ )

Usage Example

P1 Vh(mesh);                    // Define finite element space
TestFunction v(Vh);              // Define test function

// Use in variational formulation
auto bilinearForm = Integral(Grad(u), Grad(v));
auto linearForm = Integral(f, v);

Base classes

template<class Derived, class FES, ShapeFunctionSpaceType Space>
class ShapeFunction<TestFunction<FES>, FES, TestSpace>
Intermediate shape function class for CRTP derivation.

Public types

using FESType = FES
Finite element space type.
using Parent = ShapeFunction<TestFunction<FESType>, FESType, TestSpace>
Parent class type.

Public static variables

static ShapeFunctionSpaceType Space constexpr
Space type (test space)

Constructors, destructors, conversion operators

TestFunction(const FES& fes) constexpr
Constructs a test function in the given finite element space.
TestFunction(const TestFunction& other) constexpr
Copy constructor.
TestFunction(TestFunction&& other) constexpr
Move constructor.

Public functions

void operator=(const TestFunction&) deleted
Copy assignment is deleted.
void operator=(TestFunction&&) deleted
Move assignment is deleted.
auto x() const -> auto constexpr
Gets the x-component of a vector-valued test function.
auto y() const -> auto constexpr
Gets the y-component of a vector-valued test function.
auto z() const -> auto constexpr
Gets the z-component of a vector-valued test function.
auto getLeaf() const -> const TestFunction& constexpr
Gets the leaf (innermost) expression in the shape function tree.
auto copy() const -> TestFunction* override noexcept
Creates a copy of this test function.

Function documentation

template<class FES>
Rodin::Variational::TestFunction<FES>::TestFunction(const FES& fes) constexpr

Constructs a test function in the given finite element space.

Parameters
fes in Finite element space

template<class FES>
Rodin::Variational::TestFunction<FES>::TestFunction(const TestFunction& other) constexpr

Copy constructor.

Parameters
other in Test function to copy

template<class FES>
Rodin::Variational::TestFunction<FES>::TestFunction(TestFunction&& other) constexpr

Move constructor.

Parameters
other in Test function to move

template<class FES>
auto Rodin::Variational::TestFunction<FES>::x() const constexpr

Gets the x-component of a vector-valued test function.

Returns Component expression representing $ v_x $

template<class FES>
auto Rodin::Variational::TestFunction<FES>::y() const constexpr

Gets the y-component of a vector-valued test function.

Returns Component expression representing $ v_y $

template<class FES>
auto Rodin::Variational::TestFunction<FES>::z() const constexpr

Gets the z-component of a vector-valued test function.

Returns Component expression representing $ v_z $

template<class FES>
const TestFunction& Rodin::Variational::TestFunction<FES>::getLeaf() const constexpr

Gets the leaf (innermost) expression in the shape function tree.

Returns Reference to this test function

template<class FES>
TestFunction* Rodin::Variational::TestFunction<FES>::copy() const override noexcept

Creates a copy of this test function.

Returns Pointer to newly allocated copy