Loading...
Searching...
No Matches
Expression< T, U > Class Template Reference

An Expression represents a mathematical expression evaluated at a pre-defined points on a 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 *, void *)> fn, const std::vector< std::size_t > &value_shape, std::shared_ptr< const FunctionSpace< geometry_type > > argument_space=nullptr)

| Create an Expression.
| Expression (Expression &&e)=default
| Move constructor.
virtual | ~Expression ()=default
| Destructor.
std::shared_ptr< const FunctionSpace< geometry_type > > | argument_space () const
| Argument function space.
const std::vector< std::shared_ptr< const Function< scalar_type, geometry_type > > > & | coefficients () const
| Expression coefficients.
const std::vector< std::shared_ptr< const Constant< scalar_type > > > & | constants () const
| Expression constants.
std::vector< int > | coefficient_offsets () const
| Offset for each coefficient expansion array on a cell.
const std::function< void(scalar_type *, const scalar_type *, const scalar_type *, const geometry_type *, const int *, const uint8_t *, void *)> & | kernel () const
| Function for tabulating the Expression.
int | value_size () const
| Value size of the Expression result.
const std::vector< std::size_t > & | value_shape () const
| Value shape of of Expression result (at a point),.
std::pair< std::vector< geometry_type >, std::array< std::size_t, 2 > > | X () const
| Evaluation point coordinates on the reference cell.

## Detailed Description

template<dolfinx::scalar T, std::floating_point U = dolfinx::scalar_value_t<T>>
class dolfinx::fem::Expression< T, U >

An Expression represents a mathematical expression evaluated at a pre-defined points on a reference cell.

An Expression can be evaluated using ::tabulate_expression.

An example of Expression use is to evaluate the gradient of a Function at quadrature points in cells. The evaluated gradient can then be used as input in to a non-FEniCS function that evaluates a material constitutive model.

Template Parameters

  T | The scalar type.
  U | The mesh geometry scalar type.

## Member Typedef Documentation

## scalar_type

template<dolfinx::scalar T, std::floating_point U = dolfinx::scalar_value_t<T>>

using scalar_type = T

Scalar type.

Field type for the Expression, e.g. double, std::complex<float>, etc.

## Constructor & Destructor Documentation

## Expression()

template<dolfinx::scalar T, std::floating_point U = dolfinx::scalar_value_t<T>>

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 *, void *)> | fn,
|  | const std::vector< std::size_t > & | value_shape,
|  | std::shared_ptr< const FunctionSpace< geometry_type > > | argument_space = nullptr )

inline

Create an Expression.

Note
  Users should prefer the fem::create_expression factory functions for creating an Expression.

Parameters

  [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_space | Function space for Argument. Used to computed a 1-form expression, e.g. can be used to create a matrix that when applied to a degree-of-freedom vector gives the expression values at the evaluation points.

## Member Function Documentation

## argument_space()

template<dolfinx::scalar T, std::floating_point U = dolfinx::scalar_value_t<T>>

std::shared_ptr< const FunctionSpace< geometry_type > > argument_space | ( |  | ) | const

inline

Argument function space.

Returns
  Argument function space, nullptr if there is no argument.

## coefficient_offsets()

template<dolfinx::scalar T, std::floating_point U = dolfinx::scalar_value_t<T>>

std::vector< int > coefficient_offsets | ( |  | ) | const

inline

Offset for each coefficient expansion array on a cell.

Used to pack data for multiple coefficients into a flat array. The last entry is the size required to store all coefficients.

Returns
  The offsets.

## coefficients()

template<dolfinx::scalar T, std::floating_point U = dolfinx::scalar_value_t<T>>

const std::vector< std::shared_ptr< const Function< scalar_type, geometry_type > > > & coefficients | ( |  | ) | const

inline

Expression coefficients.

Returns
  List of attached coefficients.

## constants()

template<dolfinx::scalar T, std::floating_point U = dolfinx::scalar_value_t<T>>

const std::vector< std::shared_ptr< const Constant< scalar_type > > > & constants | ( |  | ) | const

inline

Expression constants.

Returns
  List of attached constants.

The documentation for this class was generated from the following files:

- /build/fenics-dolfinx-PdyzCE/fenics-dolfinx-0.10.0.post5/cpp/dolfinx/fem/assembler.h
- /build/fenics-dolfinx-PdyzCE/fenics-dolfinx-0.10.0.post5/cpp/dolfinx/fem/Expression.h