# Expression¶

class dolfin.cpp.function.Expression(*args)

This class represents a user-defined expression. Expressions can be used as coefficients in variational forms or interpolated into finite element spaces. An expression is defined by overloading the eval method. Users may choose to overload either a simple version of eval , in the case of expressions only depending on the coordinate x, or an optional version for expressions depending on x and mesh data like cell indices or facet normals. The geometric dimension (the size of x) and the value rank and dimensions of an expression must supplied as arguments to the constructor.

Copy constructor

Parameters: Expression & expression (const) – (Expression ) Object to be copied.
eval()

Evaluate at given point (deprecated)

Parameters: double > & values (Array<) – (Array) The values at the point. Array< double > & x (const) – (Array) The coordinates of the point. void
eval_cell()

Evaluate at given point in given cell (deprecated)

Parameters: double > & values (Array<) – (Array) The values at the point. Array< double > & x (const) – (Array) The coordinates of the point. ufc::cell & cell (const) – (ufc::cell) The cell which contains the given point. void
get_generic_function()

Property getter for type “GenericFunction” Used in pybind11 Python interface to get the value of a python attribute

Parameters: name (std::string) – std::shared_ptr< dolfin::GenericFunction >
get_property()

Property getter for type “double” Used in pybind11 Python interface to get the value of a python attribute

Parameters: name (std::string) – double
set_generic_function()

Property setter for type “GenericFunction” Used in pybind11 Python interface to attach a value to a python attribute

Parameters: name (std::string) – GenericFunction > f (std::shared_ptr<) – void
set_property()

Property setter for type “double” Used in pybind11 Python interface to attach a value to a python attribute

Parameters: name (std::string) – value (double) – void
thisown

The membership flag

value_shape()

Return value shape

Return type: std::vector< std::size_t > std::vector The value shape.