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 , the test function is chosen from this space.
Mathematical Foundation
The weak formulation seeks such that:
where:
- is the test function
- is a bilinear form
- is a linear functional
- is the test space (typically equal to the trial space )
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);
Inherits from
| Base class | Responsibility |
|---|---|
ShapeFunction<TestFunction<FES>, …>publicFull typeShapeFunction< TestFunction< FES >, FES, TestSpace > |
Derived classes
| Derived class | Description |
|---|---|
PETSc::Variational::TestFunction<FES>publicFull typePETSc::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 |
|---|
auto y() const constexpr
Gets the y-component of a vector-valued test function.
| Returns | Component expression representing |
|---|
auto z() const constexpr
Gets the z-component of a vector-valued test function.
| Returns | Component expression representing |
|---|
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 |
|---|