TestFunction

Represents a function which belongs to a test space.

Defined in Rodin/Variational/TestFunction.h

template <
  class FES>
class TestFunction;
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);
Direct inheritance by class family
↓
TestFunction
↓

Inherits from

Base classResponsibility
ShapeFunction<TestFunction<FES>, …>public
Full type
ShapeFunction< TestFunction< FES >, FES, TestSpace >

Derived classes

Derived classDescription
PETSc::Variational::TestFunction<FES>public
Full type
PETSc::Variational::TestFunction< FES >
PETSc-aware test function wrapper.

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& other) deleted
Copy assignment is deleted.
void operator=(TestFunction&& other) 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

TestFunction(const FES& fes) constexpr

Constructs a test function in the given finite element space.

Parameters
fes in Finite element space

TestFunction(const TestFunction& other) constexpr

Copy constructor.

Parameters
other in Test function to copy

TestFunction(TestFunction&& other) constexpr

Move constructor.

Parameters
other in Test function to move

void operator=(const TestFunction& other) deleted

Copy assignment is deleted.

Parameters
other Object to copy from.

void operator=(TestFunction&& other) deleted

Move assignment is deleted.

Parameters
other Object to move from.

auto x() const constexpr

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

Returns Component expression representing $ v_x $

auto y() const constexpr

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

Returns Component expression representing $ v_y $

auto z() const constexpr

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

Returns Component expression representing $ v_z $

const TestFunction& getLeaf() const constexpr

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

Returns Reference to this test function

TestFunction* copy() const override noexcept

Creates a copy of this test function.

Returns Pointer to newly allocated copy