A class that represents a tensor basis for a finite element. This class is used to evaluate the basis functions and their derivatives at a set of reference points.
More...
#include <tensor_basis.hpp>
|
| struct | Product |
| | A struct that represents a product of one-dimensional basis functions. More...
|
| |
|
| int | points () const noexcept |
| | Get the number of quadrature points in the Cartesian rule.
|
| |
| int | dofs () const noexcept |
| | Get the number of degrees of freedom in the tensor basis.
|
| |
| int | components () const noexcept |
| | Get the number of canonical output components per point in the tensor basis.
|
| |
| void | apply (const ::mfem::Vector &input, ::mfem::Vector &output, TensorWorkspace &workspace, const bool transpose=false) const |
| | Evaluate canonical samples, or their coordinate transpose, with caller-owned scratch.
|
| |
| void | apply_many (const ::mfem::Vector &input, ::mfem::Vector &output, const int lanes, TensorWorkspace &workspace, const bool transpose=false) const |
| | apply() for several coefficient vectors at once, stored lane-interleaved (entry i of lane j at i * lanes + j).
|
| |
|
| static std::shared_ptr< const TensorBasis > | make (const ::mfem::FiniteElement &element, const ::mfem::IntegrationRule &rule, const ReferenceOperation operation, const int copies, const ElementReconstruction *reconstruction=nullptr) |
| | Return no tensor plan unless its factorization agrees with MFEM's canonical basis.
|
| |
|
| bool | agrees_with (const ::mfem::FiniteElement &element, const ::mfem::IntegrationRule &rule, const ReferenceOperation operation, const ElementReconstruction *reconstruction) const |
| | Verify signed ordering and every requested basis entry before enabling the fast path.
|
| |
|
| static void | contract_axis (const ::mfem::DenseMatrix &factor, const int axis, const std::array< int, 3 > &shape, const ::mfem::Vector &input, ::mfem::Vector &output, const bool transpose, const int lanes=1) |
| |
|
| int | m_points {0} |
| | The number of quadrature points in the Cartesian rule.
|
| |
| int | m_dofs {0} |
| | The number of degrees of freedom in the tensor basis.
|
| |
| int | m_components {0} |
| | The number of canonical output components per point in the tensor basis.
|
| |
| std::vector< Product > | m_products |
| | The products of one-dimensional basis functions for each axis. (TOOD: consider if this should be a heap allocated vector of it this could be put on the stack somehow)
|
| |
A class that represents a tensor basis for a finite element. This class is used to evaluate the basis functions and their derivatives at a set of reference points.
◆ agrees_with()
| bool serif::discretization::backend::mfem::TensorBasis::agrees_with |
( |
const ::mfem::FiniteElement & | element, |
|
|
const ::mfem::IntegrationRule & | rule, |
|
|
const ReferenceOperation | operation, |
|
|
const ElementReconstruction * | reconstruction ) const |
|
inlinenodiscardprivate |
Verify signed ordering and every requested basis entry before enabling the fast path.
Verify that the signed ordering and every requested basis entry agrees with MFEM's canonical basis.
- Parameters
-
| element | The finite element to verify against. |
| rule | The integration rule to use for evaluating the basis functions. |
| operation | The reference operation to apply (e.g., value, gradient). |
- Returns
- True if the tensor basis agrees with MFEM's canonical basis, false otherwise.
◆ apply()
| void serif::discretization::backend::mfem::TensorBasis::apply |
( |
const ::mfem::Vector & | input, |
|
|
::mfem::Vector & | output, |
|
|
TensorWorkspace & | workspace, |
|
|
const bool | transpose = false ) const |
|
inline |
Evaluate canonical samples, or their coordinate transpose, with caller-owned scratch.
Apply the tensor basis to an input vector and store the results in an output vector. This function performs the tensor contraction of the input vector with the tensor basis.
- Parameters
-
| input | The input vector to be contracted with the tensor basis. |
| output | The output vector to store the result of the contraction. (Owned by the caller) |
| workspace | The workspace to use for the contraction. (Owned by the caller) |
| transpose | Whether to transpose the contraction (default is false). |
- Precondition
- The input vector must have a size equal to the number of degrees of freedom in the tensor basis if transpose is false, or equal to the number of points times the number of components if transpose is true.
-
The output vector must be constructed
- Postcondition
- The output vector will have a size equal to the number of points times the number of components if transpose is false, or equal to the number of degrees of freedom in the tensor basis if transpose is true.
-
The output vector will contain the result of the tensor contraction of the input vector with the tensor basis.
◆ apply_many()
| void serif::discretization::backend::mfem::TensorBasis::apply_many |
( |
const ::mfem::Vector & | input, |
|
|
::mfem::Vector & | output, |
|
|
const int | lanes, |
|
|
TensorWorkspace & | workspace, |
|
|
const bool | transpose = false ) const |
|
inline |
apply() for several coefficient vectors at once, stored lane-interleaved (entry i of lane j at i * lanes + j).
- Note
- The lanes form the fastest tensor index, so every lane is contracted with exactly the operations and summation order apply() uses for it alone; only the loops are shared.
◆ components()
| int serif::discretization::backend::mfem::TensorBasis::components |
( |
| ) |
const |
|
inlinenodiscardnoexcept |
Get the number of canonical output components per point in the tensor basis.
- Returns
- The number of canonical output components per point in the tensor basis.
◆ contract_axis()
| static void serif::discretization::backend::mfem::TensorBasis::contract_axis |
( |
const ::mfem::DenseMatrix & | factor, |
|
|
const int | axis, |
|
|
const std::array< int, 3 > & | shape, |
|
|
const ::mfem::Vector & | input, |
|
|
::mfem::Vector & | output, |
|
|
const bool | transpose, |
|
|
const int | lanes = 1 ) |
|
inlinestaticprivate |
@breif apply one factor along one tensor axis, teh other two indices will remain unchanged
- Parameters
-
| factor | The one-dimensional basis function to apply along the specified axis. |
| axis | The axis along which to apply the factor (0, 1, or 2). |
| shape | The shape of the input tensor (number of points along each axis). |
| input | The input vector to be contracted with the factor. |
| output | The output vector to store the result of the contraction. |
| transpose | Whether to transpose the factor matrix before applying it. |
| lanes | Number of interleaved independent tensors (the fastest index); 1 for a single tensor. |
- Precondition
- The input vector must have a size equal to the product of the dimensions specified in the shape array.
- Postcondition
- The output vector will have a size equal to the product of the dimensions specified in the next array.
-
The output vector will contain the result of the contraction of the input vector with the factor along the specified axis.
◆ dofs()
| int serif::discretization::backend::mfem::TensorBasis::dofs |
( |
| ) |
const |
|
inlinenodiscardnoexcept |
Get the number of degrees of freedom in the tensor basis.
- Returns
- The number of degrees of freedom in the tensor basis.
◆ make()
| static std::shared_ptr< const TensorBasis > serif::discretization::backend::mfem::TensorBasis::make |
( |
const ::mfem::FiniteElement & | element, |
|
|
const ::mfem::IntegrationRule & | rule, |
|
|
const ReferenceOperation | operation, |
|
|
const int | copies, |
|
|
const ElementReconstruction * | reconstruction = nullptr ) |
|
inlinestaticnodiscard |
Return no tensor plan unless its factorization agrees with MFEM's canonical basis.
Make a tensor basis for a given finite element, integration rule, reference operation, and number of copies. This function returns a shared pointer to a TensorBasis object that can be used to do efficient evaluation of the basis functions and their derivatives at reference points.
- Parameters
-
| element | The finite element for which to construct the tensor basis. |
| rule | The integration rule to use for evaluating the basis functions. |
| operation | The reference operation to apply (e.g., value, gradient). |
| copies | The number of copies of the basis functions. |
- Returns
- A shared pointer to a TensorBasis object if the tensor basis can be constructed, or an empty shared pointer if it cannot.
◆ points()
| int serif::discretization::backend::mfem::TensorBasis::points |
( |
| ) |
const |
|
inlinenodiscardnoexcept |
Get the number of quadrature points in the Cartesian rule.
- Returns
- The number of quadrature points in the Cartesian rule.
◆ m_components
| int serif::discretization::backend::mfem::TensorBasis::m_components {0} |
|
private |
The number of canonical output components per point in the tensor basis.
◆ m_dofs
| int serif::discretization::backend::mfem::TensorBasis::m_dofs {0} |
|
private |
The number of degrees of freedom in the tensor basis.
◆ m_points
| int serif::discretization::backend::mfem::TensorBasis::m_points {0} |
|
private |
The number of quadrature points in the Cartesian rule.
◆ m_products
| std::vector<Product> serif::discretization::backend::mfem::TensorBasis::m_products |
|
private |
The products of one-dimensional basis functions for each axis. (TOOD: consider if this should be a heap allocated vector of it this could be put on the stack somehow)
The documentation for this class was generated from the following file: