# Function¶

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

This class represents a function $$u_h$$ in a finite element function space $$V_h$$ , given by .. math:

::

u_h = sum_{i=1}^{n} U_i phi_i

where $$\phi_i\}_{i=1}^{n}$$ is a basis for $$V_h$$ , and $$U$$ is a vector of expansion coefficients for $$u_h$$ .

Friends: FunctionAssigner, FunctionSpace.

Sub-function constructor with shallow copy of vector (used in Python interface) Arguments v (Function ) The function to be copied. i (std::size_t) Index of subfunction.

Parameters: Function & v (const) – i (std::size_t) –
child()

Return the child Function in the hierarchy

compute_vertex_values()

Compute values at all mesh vertices

Parameters: double > & vertex_values (std::vector<) – (Array) The values at all vertices. Mesh & mesh (const) – (Mesh ) The mesh. void
copy(deepcopy=False)

Return a copy of itself

Arguments
deepcopy (bool)
If false (default) the dof vector is shared.
Returns
_Function_
The Function
eval()

Evaluate function at given coordinates

Parameters: double > & values (Array<) – (Array) The values. Array< double > & x (const) – (Array) The coordinates. void
extrapolate()

Extrapolate function (from a possibly lower-degree function space) Arguments v (Function ) The function to be extrapolated.

Parameters: Function & v (const) – void
function_space()

Return the FunctionSpace

geometric_dimension()

Return geometric dimension Returns std::size_t The geometric dimension.

Return type: std::size_t
get_allow_extrapolation()

Check if extrapolation is permitted when evaluating the Function

Return type: bool bool True if extrapolation is permitted, otherwise false
interpolate()

Interpolate function (on possibly non-matching meshes)

Parameters: GenericFunction & v (const) – (GenericFunction ) The function to be interpolated. void
leaf_node()

Return the finest Function in hierarchy

parent()

Return the parent Function in the hierarchy

root_node()

Return the coarsest Function in hierarchy

set_allow_extrapolation()

Allow extrapolation when evaluating the Function

Parameters: allow_extrapolation (bool) – (bool) Whether or not permit extrapolation. void
sub()

Extract subfunction Arguments i (std::size_t) Index of subfunction. Returns:cpp:any:Function The subfunction.

Parameters: i (std::size_t) – Function &
thisown

The membership flag

vector()

Return vector of expansion coefficients (non-const version) Returns:cpp:any:GenericVector The vector of expansion coefficients.

Return type: std::shared_ptr< GenericVector >