DOLFINx 0.9.0
DOLFINx C++ interface
|
Represents a mathematical expression evaluated at a pre-defined set of points on the reference cell. More...
#include <Expression.h>
Public Types | |
using | scalar_type = T |
Scalar type. | |
using | geometry_type = U |
Geometry type of the points. | |
Public Member Functions | |
Expression (const std::vector< std::shared_ptr< const Function< scalar_type, geometry_type > > > &coefficients, const std::vector< std::shared_ptr< const Constant< scalar_type > > > &constants, std::span< const geometry_type > X, std::array< std::size_t, 2 > Xshape, std::function< void(scalar_type *, const scalar_type *, const scalar_type *, const geometry_type *, const int *, const uint8_t *)> fn, const std::vector< int > &value_shape, std::shared_ptr< const FunctionSpace< geometry_type > > argument_function_space=nullptr) | |
Create an Expression. | |
Expression (Expression &&e)=default | |
Move constructor. | |
virtual | ~Expression ()=default |
Destructor. | |
std::shared_ptr< const FunctionSpace< geometry_type > > | argument_function_space () const |
Get argument function space. | |
const std::vector< std::shared_ptr< const Function< scalar_type, geometry_type > > > & | coefficients () const |
Get coefficients. | |
const std::vector< std::shared_ptr< const Constant< scalar_type > > > & | constants () const |
Get constants. | |
std::vector< int > | coefficient_offsets () const |
Offset for each coefficient expansion array on a cell. | |
void | eval (const mesh::Mesh< geometry_type > &mesh, std::span< const std::int32_t > entities, std::span< scalar_type > values, std::array< std::size_t, 2 > vshape) const |
Evaluate Expression on cells or facets. | |
const std::function< void(scalar_type *, const scalar_type *, const scalar_type *, const geometry_type *, const int *, const uint8_t *)> & | get_tabulate_expression () const |
Get function for tabulate_expression. | |
int | value_size () const |
Get value size. | |
const std::vector< int > & | value_shape () const |
Get value shape. | |
std::pair< std::vector< geometry_type >, std::array< std::size_t, 2 > > | X () const |
Evaluation points on the reference cell. | |
Represents a mathematical expression evaluated at a pre-defined set of points on the reference cell.
This class closely follows the concept of a UFC Expression.
The functionality can be used to evaluate a gradient of a Function at quadrature points in all cells. This evaluated gradient can then be used as input in to a non-FEniCS function that calculates a material constitutive model.
T | The scalar type |
U | The mesh geometry scalar type |
using scalar_type = T |
Scalar type.
Field type for the Expression, e.g. double
, std::complex<float>
, etc.
|
inline |
Create an Expression.
[in] | coefficients | Coefficients in the Expression. |
[in] | constants | Constants in the Expression |
[in] | X | Points on the reference cell, shape=(number of / points, tdim) and storage is row-major. |
[in] | Xshape | Shape of X . |
[in] | fn | Function for tabulating the Expression. |
[in] | value_shape | Shape of Expression evaluated at single point. |
[in] | argument_function_space | Function space for Argument. |
|
inline |
Get argument function space.
|
inline |
Offset for each coefficient expansion array on a cell.
Used to pack data for multiple coefficients in a flat array. The last entry is the size required to store all coefficients.
|
inline |
Get coefficients.
|
inline |
Get constants.
|
inline |
Evaluate Expression on cells or facets.
[in] | mesh | Cells on which to evaluate the Expression. |
[in] | entities | List of entities to evaluate the expression on. This could be either a list of cells or a list of (cell, local |
[out] | values | A 2D array to store the result. Caller is responsible for correct sizing which should be (num_cells, / num_points * value_size * num_all_argument_dofs columns) . facet index) tuples. Array is flattened per entity. |
[in] | vshape | The shape of values (row-major storage). |
|
inline |
Get function for tabulate_expression.
|
inline |
Get value shape.
|
inline |
Get value size.
|
inline |
Evaluation points on the reference cell.