#include <Rodin/Variational/TrialFunction.h>
template<class Solution, class FES>
TrialFunction class
Represents a function which belongs to a trial space.
| Template parameters | |
|---|---|
| FES | Type of finite element space |
Trial function (unknown solution) in a finite element space.
In the weak formulation of a partial differential equation, the trial function represents the unknown solution being sought. Given a finite element space , the trial function is the function to be determined by solving the variational problem.
Mathematical Foundation
The weak formulation seeks such that:
where:
- is the trial function (unknown)
- is a test function
- is a bilinear form
- is a linear functional
- is the trial space
The TrialFunction internally manages a GridFunction that stores the degrees of freedom of the solution after the problem is solved.
Usage Example
P1 Uh(mesh); // Define finite element space TrialFunction u(Uh); // Define trial function TestFunction v(Uh); // Define test function // Define problem Problem problem(u, v); problem = Integral(Grad(u), Grad(v)) - Integral(f, v); // Solve problem.solve(solver); // Access solution auto& solution = u.getSolution();
Base classes
-
template<class Solution, class FES>class TrialFunctionReference<Solution, FES>
- Reference wrapper for trial functions.
Public types
- using FESType = FES
- Finite element space type.
- using SolutionType = Solution
- Solution grid function type.
- using Parent = TrialFunctionReference<SolutionType, FESType>
- Parent class type.
Public static variables
- static ShapeFunctionSpaceType Space constexpr
- Space type (trial space)
Constructors, destructors, conversion operators
- TrialFunction(const FES& fes) constexpr
- Constructs a trial function in the given finite element space.
- TrialFunction(const TrialFunction& other) constexpr
- Copy constructor.
- TrialFunction(TrialFunction&& other) constexpr
- Move constructor.
Public functions
- void operator=(const TrialFunction&) deleted
- Copy assignment is deleted.
- void operator=(TrialFunction&&) deleted
- Move assignment is deleted.
- auto x() const -> auto constexpr
- Gets the x-component of a vector-valued trial function.
- auto y() const -> auto constexpr
- Gets the y-component of a vector-valued trial function.
- auto z() const -> auto constexpr
- Gets the z-component of a vector-valued trial function.
- auto getLeaf() const -> const TrialFunction& constexpr
- Gets the leaf (innermost) expression in the shape function tree.
- auto getSolution() -> SolutionType& constexpr
- Gets the solution grid function (mutable).
- auto getSolution() const -> const SolutionType& constexpr
- Gets the solution grid function (const).
Function documentation
template<class Solution, class FES>
Rodin:: Variational:: TrialFunction<Solution, FES>:: TrialFunction(const FES& fes) constexpr
Constructs a trial function in the given finite element space.
| Parameters | |
|---|---|
| fes in | Finite element space |
Creates a trial function with an associated solution grid function initialized to zero.
template<class Solution, class FES>
Rodin:: Variational:: TrialFunction<Solution, FES>:: TrialFunction(const TrialFunction& other) constexpr
Copy constructor.
| Parameters | |
|---|---|
| other in | Trial function to copy |
template<class Solution, class FES>
Rodin:: Variational:: TrialFunction<Solution, FES>:: TrialFunction(TrialFunction&& other) constexpr
Move constructor.
| Parameters | |
|---|---|
| other in | Trial function to move |
template<class Solution, class FES>
const TrialFunction& Rodin:: Variational:: TrialFunction<Solution, FES>:: getLeaf() const constexpr
Gets the leaf (innermost) expression in the shape function tree.
| Returns | Reference to this trial function |
|---|
template<class Solution, class FES>
SolutionType& Rodin:: Variational:: TrialFunction<Solution, FES>:: getSolution() constexpr
Gets the solution grid function (mutable).
| Returns | Reference to the solution |
|---|
The solution grid function stores the degrees of freedom of the computed solution after solving the variational problem.
template<class Solution, class FES>
const SolutionType& Rodin:: Variational:: TrialFunction<Solution, FES>:: getSolution() const constexpr
Gets the solution grid function (const).
| Returns | Const reference to the solution |
|---|