Expression

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

Bases: dolfin.cpp.function.GenericFunction

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<double>) The values at the point.
  • Array< double > & x (const) – (Array<double>) The coordinates of the point.
Return type:

void

eval_cell()

Evaluate at given point in given cell (deprecated)

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

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) –
Return type: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) –
Return type: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<) –
Return type:

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) –
Return type:

void

thisown

The membership flag

value_shape()

Return value shape

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