Function

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

Bases: dolfin.cpp.function.GenericFunction, dolfin.cpp.function.HierarchicalFunction

This class represents a function \(u_h\) in a finite element function space \(V_h\), given by

\[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\).

Overloaded versions

  • Function(V)

    Create function on given function space

    Arguments
    V (FunctionSpace)

    The function space.

    Example

    Note

    No example code available for this function.

  • Function(V)

    Create function on given function space (shared data)

    Arguments
    V (FunctionSpace)

    The function space.

  • Function(V, x)

    Create function on given function space with a given vector (shared data)

    Warning: This constructor is intended for internal library use only

    Arguments
    V (FunctionSpace)

    The function space.

    x (GenericVector)

    The vector.

  • Function(V, filename)

    Create function from vector of dofs stored to file

    Arguments
    V (FunctionSpace)

    The function space.

    filename_vector (str)

    The name of the file containing the vector.

    filename_dofdata (str)

    The name of the file containing the dofmap data.

  • Function(V, filename)

    Create function from vector of dofs stored to file (shared data)

    Arguments
    V (FunctionSpace)

    The function space.

    filename_dofdata (str)

    The name of the file containing the dofmap data.

  • Function(v)

    Copy constructor

    Arguments
    v (Function)

    The object to be copied.

  • Function(v, i)

    Sub-function constructor with shallow copy of vector (used in Python interface)

    Arguments
    v (Function)

    The function to be copied.

    i (int)

    Index of subfunction.

child()

Return the child Function in the hierarchy

compute_vertex_values()

Overloaded versions

  • compute_vertex_values(vertex_values, mesh)

    Compute values at all mesh vertices

    Arguments
    vertex_values (numpy.array(float))

    The values at all vertices.

    mesh (Mesh)

    The mesh.

  • compute_vertex_values(vertex_values)

    Compute values at all mesh vertices

    Arguments
    vertex_values (numpy.array(float))

    The values at all vertices.

copy(deepcopy=False)

Return a copy of itself

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

Overloaded versions

  • eval(values, x)

    Evaluate function at given coordinates

    Arguments
    values (numpy.array(float))

    The values.

    x (numpy.array(float))

    The coordinates.

  • eval(values, x, dolfin_cell, ufc_cell)

    Evaluate function at given coordinates in given cell

    Arguments
    values (numpy.array(float))

    The values.

    x (numpy.array(float))

    The coordinates.

    dolfin_cell (Cell)

    The cell.

    ufc_cell (ufc::cell)

    The ufc::cell.

  • eval(values, x, cell)

    Evaluate at given point in given cell

    Arguments
    values (numpy.array(float))

    The values at the point.

    x (numpy.array(float))

    The coordinates of the point.

    cell (ufc::cell)

    The cell which contains the given point.

extrapolate()

Extrapolate function (from a possibly lower-degree function space)

Arguments
v (Function)
The function to be extrapolated.
function_space()

Return the FunctionSpace

geometric_dimension()

Return geometric dimension

Returns
int
The geometric dimension.
interpolate()

Interpolate function (on possibly non-matching meshes)

Arguments
v (GenericFunction)
The function to be interpolated.
leaf_node()

Return the finest Function in hierarchy

non_matching_eval()

Evaluate function for given data (non-matching meshes)

Arguments
values (numpy.array(float))
The values at the point.
x (numpy.array(float))
The coordinates of the point.
cell (ufc::cell)
The cell.
parent()

Return the parent Function in the hierarchy

root_node()

Return the coarsest Function in hierarchy

sub()

Extract subfunction

Arguments
i (int)
Index of subfunction.
Returns
Function
The subfunction.
thisown

The membership flag

vector()

Overloaded versions

  • vector()

    Return vector of expansion coefficients (non-const version)

    Returns
    GenericVector

    The vector of expansion coefficients.

  • vector()

    Return vector of expansion coefficients (const version)

    Returns
    GenericVector

    The vector of expansion coefficients (const).