TrialFunction
Represents a function which belongs to a trial space.
Defined in Rodin/Variational/TrialFunction.h
template < class Solution, class FES> class TrialFunction;
| 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();
Inherits from
| Base class | Responsibility |
|---|---|
TrialFunctionReference<Solution, FES>publicFull typeTrialFunctionReference< Solution, FES > | Reference wrapper for trial functions. |
Derived classes
| Derived class | Description |
|---|---|
PETSc::Variational::TrialFunction<Solution, …>publicFull typePETSc::Variational::TrialFunction< Solution, FES > | PETSc-aware trial function wrapper. |
Inherited interface
| Declared in | Members |
|---|---|
TrialFunctionReference |
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& other) deleted
- Copy assignment is deleted.
- void operator=(TrialFunction&& other) 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).
- auto setName(const std::string& name) -> TrialFunction&
- Sets the name of the field.
- auto getName() const -> Optional<StringView> override
- Gets the name of the field.
Function documentation
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.
TrialFunction(const TrialFunction& other) constexpr
Copy constructor.
| Parameters | |
|---|---|
| other in | Trial function to copy |
TrialFunction(TrialFunction&& other) constexpr
Move constructor.
| Parameters | |
|---|---|
| other in | Trial function to move |
void operator=(const TrialFunction& other) deleted
Copy assignment is deleted.
| Parameters | |
|---|---|
| other | Object to copy from. |
void operator=(TrialFunction&& other) deleted
Move assignment is deleted.
| Parameters | |
|---|---|
| other | Object to move from. |
auto x() const constexpr
Gets the x-component of a vector-valued trial function.
| Returns | Component expression representing |
|---|
auto y() const constexpr
Gets the y-component of a vector-valued trial function.
| Returns | Component expression representing |
|---|
auto z() const constexpr
Gets the z-component of a vector-valued trial function.
| Returns | Component expression representing |
|---|
const TrialFunction& getLeaf() const constexpr
Gets the leaf (innermost) expression in the shape function tree.
| Returns | Reference to this trial function |
|---|
SolutionType& 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.
const SolutionType& getSolution() const constexpr
Gets the solution grid function (const).
| Returns | Const reference to the solution |
|---|
TrialFunction& setName(const std::string& name)
Sets the name of the field.
| Parameters | |
|---|---|
| name | Name of the object. |
| Returns | Reference to this object after the operation. |
Optional<StringView> getName() const override
Gets the name of the field.
| Returns | The name of the field. |
|---|