FunctionSpace

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

Bases: dolfin.cpp.common.Variable, dolfin.cpp.function.HierarchicalFunctionSpace

This class represents a finite element function space defined by a mesh, a finite element, and a local-to-global mapping of the degrees of freedom (dofmap).

Copy constructor Arguments V (FunctionSpace ) The object to be copied.

Parameters:FunctionSpace & V (const) –
assign()

Assignment operator Arguments V (FunctionSpace ) Another function space.

Parameters:FunctionSpace & V (const) –
Return type:const FunctionSpace &
child()

Return the child FunctionSpace in the hierarchy

collapse()

Collapse a subspace and return a new function space and a map from new to old dofs Arguments collapsed_dofs (std::unordered_map<std::size_t, std::size_t>) The map from new to old dofs. Returns:cpp:any:FunctionSpace The new function space.

Parameters:std::size_t, std::size_t > & collapsed_dofs (std::unordered_map<) –
Return type:std::shared_ptr< FunctionSpace >
component()

Return component w.r.t. to root superspace, i.e. W.sub(1).sub(0) == [1, 0]. Returns std::vector<std::size_t> The component (w.r.t to root superspace).

Return type:std::vector< std::size_t >
contains()

Check whether V is subspace of this, or this itself Arguments V (FunctionSpace ) The space to be tested for inclusion. Returns bool True if V is contained or equal to this.

Parameters:FunctionSpace & V (const) –
Return type:bool
dim()

Return global dimension of the function space. Equivalent to dofmap ->global_dimension() Returns std::size_t The dimension of the function space.

Return type:std::size_t
dofmap()

Return dofmap Returns:cpp:any:GenericDofMap The dofmap.

Return type:std::shared_ptr< const GenericDofMap >
element()

Return finite element Returns:cpp:any:FiniteElement The finite element.

Return type:std::shared_ptr< const FiniteElement >
extract_sub_space()

Extract subspace for component Arguments component (std::vector<std::size_t>) The component. Returns:cpp:any:FunctionSpace The subspace.

Parameters:std::vector< std::size_t > & component (const) –
Return type:std::shared_ptr< FunctionSpace >
has_cell()

Check if function space has given cell Arguments cell (Cell ) The cell. Returns bool True if the function space has the given cell.

Parameters:Cell & cell (const) –
Return type:bool
has_element()

Check if function space has given element Arguments element (FiniteElement ) The finite element. Returns bool True if the function space has the given element.

Parameters:FiniteElement & element (const) –
Return type:bool
interpolate()

Interpolate function v into function space, returning the vector of expansion coefficients Arguments expansion_coefficients (GenericVector ) The expansion coefficients. v (GenericFunction ) The function to be interpolated.

Parameters:
  • & expansion_coefficients (GenericVector) –
  • GenericFunction & v (const) –
Return type:

void

leaf_node()

Return the finest FunctionSpace in hierarchy

mesh()

Return mesh Returns:cpp:any:Mesh The mesh.

Return type:std::shared_ptr< const Mesh >
parent()

Return the parent FunctionSpace in the hierarchy

print_dofmap()

Print dofmap (useful for debugging)

Return type:void
root_node()

Return the coarsest FunctionSpace in hierarchy

set_x()

Set dof entries in vector to value*x[i], where [x][i] is the coordinate of the dof spatial coordinate. Parallel layout of vector must be consistent with dof map range This function is typically used to construct the null space of a matrix operator, e.g. rigid body rotations. Arguments vector (GenericVector ) The vector to set. value (double) The value to multiply to coordinate by. component (std::size_t) The coordinate index. mesh (Mesh ) The mesh.

Parameters:
  • & x (GenericVector) –
  • value (double) –
  • component (std::size_t) –
Return type:

void

sub()

Extract subspace for component Arguments component (std::size_t) Index of the subspace. Returns:cpp:any:FunctionSpace The subspace.

Parameters:component (std::size_t) –
Return type:std::shared_ptr< FunctionSpace >
tabulate_dof_coordinates()

Tabulate the coordinates of all dofs on this process. This function is typically used by preconditioners that require the spatial coordinates of dofs, for example for re-partitioning or nullspace computations. Arguments mesh (Mesh ) The mesh. Returns std::vector<double> The dof coordinates (x0, y0, x1, y1, …)

Return type:std::vector< double >
thisown

The membership flag