DOLFIN-X
DOLFIN-X C++ interface
Public Types | Public Member Functions | List of all members
dolfinx::function::FunctionSpace Class Reference

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

#include <FunctionSpace.h>

Public Types

using interpolation_function = std::function< void(Eigen::Ref< Eigen::Array< PetscScalar, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > >, const Eigen::Ref< const Eigen::Array< double, Eigen::Dynamic, 3, Eigen::RowMajor > > &)>
 Interpolation function.
 

Public Member Functions

 FunctionSpace (std::shared_ptr< const mesh::Mesh > mesh, std::shared_ptr< const fem::FiniteElement > element, std::shared_ptr< const fem::DofMap > dofmap)
 Create function space for given mesh, element and dofmap. More...
 
 FunctionSpace (const FunctionSpace &V)=delete
 
 FunctionSpace (FunctionSpace &&V)=default
 Move constructor.
 
virtual ~FunctionSpace ()=default
 Destructor.
 
FunctionSpaceoperator= (const FunctionSpace &V)=delete
 
FunctionSpaceoperator= (FunctionSpace &&V)=default
 Move assignment operator.
 
bool operator== (const FunctionSpace &V) const
 Equality operator. More...
 
bool operator!= (const FunctionSpace &V) const
 Inequality operator. More...
 
std::int64_t dim () const
 Return global dimension of the function space. More...
 
void interpolate (Eigen::Ref< Eigen::Array< PetscScalar, Eigen::Dynamic, 1 >> coefficients, const Function &v) const
 Interpolate a finite element Function into this function space, filling the array of expansion coefficients associated with this function space. More...
 
void interpolate (Eigen::Ref< Eigen::Array< PetscScalar, Eigen::Dynamic, 1 >> coefficients, const std::function< Eigen::Array< PetscScalar, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor >(const Eigen::Ref< const Eigen::Array< double, 3, Eigen::Dynamic, Eigen::RowMajor >> &)> &f) const
 Interpolate an expression into this function space, filling the array of expansion coefficients associated with this function space.
 
void interpolate_c (Eigen::Ref< Eigen::Array< PetscScalar, Eigen::Dynamic, 1 >> coefficients, const interpolation_function &f) const
 Interpolate an expression into this function space, filling the array of expansion coefficients associated with this function space. More...
 
std::shared_ptr< FunctionSpacesub (const std::vector< int > &component) const
 Extract subspace for component. More...
 
bool contains (const FunctionSpace &V) const
 Check whether V is subspace of this, or this itself. More...
 
std::pair< std::shared_ptr< FunctionSpace >, std::vector< std::int32_t > > collapse () const
 Collapse a subspace and return a new function space and a map from new to old dofs. More...
 
bool has_element (const fem::FiniteElement &element) const
 Check if function space has given element. More...
 
std::vector< int > component () const
 Get the component with respect to the root superspace. More...
 
Eigen::Array< double, Eigen::Dynamic, 3, Eigen::RowMajor > tabulate_dof_coordinates () const
 Tabulate the physical coordinates of all dofs on this process. More...
 
void set_x (Eigen::Ref< Eigen::Array< PetscScalar, Eigen::Dynamic, 1 >> x, PetscScalar value, int component) const
 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. More...
 
std::size_t id () const
 Unique identifier.
 
std::shared_ptr< const mesh::Meshmesh () const
 The mesh.
 
std::shared_ptr< const fem::FiniteElementelement () const
 The finite element.
 
std::shared_ptr< const fem::DofMapdofmap () const
 The dofmap.
 

Detailed Description

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

Constructor & Destructor Documentation

◆ FunctionSpace()

FunctionSpace::FunctionSpace ( std::shared_ptr< const mesh::Mesh mesh,
std::shared_ptr< const fem::FiniteElement element,
std::shared_ptr< const fem::DofMap dofmap 
)

Create function space for given mesh, element and dofmap.

Parameters
[in]meshThe mesh
[in]elementThe element
[in]dofmapThe dofmap

Member Function Documentation

◆ collapse()

std::pair< std::shared_ptr< FunctionSpace >, std::vector< std::int32_t > > FunctionSpace::collapse ( ) const

Collapse a subspace and return a new function space and a map from new to old dofs.

Returns
The new function space and a map rom new to old dofs

◆ component()

std::vector< int > FunctionSpace::component ( ) const

Get the component with respect to the root superspace.

Returns
The component with respect to the root superspace , i.e. W.sub(1).sub(0) == [1, 0]

◆ contains()

bool FunctionSpace::contains ( const FunctionSpace V) const

Check whether V is subspace of this, or this itself.

Parameters
[in]VThe space to be tested for inclusion
Returns
True if V is contained in or equal to this FunctionSpace

◆ dim()

std::int64_t FunctionSpace::dim ( ) const

Return global dimension of the function space.

Returns
The dimension of the function space

◆ has_element()

bool dolfinx::function::FunctionSpace::has_element ( const fem::FiniteElement element) const
inline

Check if function space has given element.

Parameters
[in]elementThe finite element
Returns
True if the function space has the given element

◆ interpolate()

void FunctionSpace::interpolate ( Eigen::Ref< Eigen::Array< PetscScalar, Eigen::Dynamic, 1 >>  coefficients,
const Function v 
) const

Interpolate a finite element Function into this function space, filling the array of expansion coefficients associated with this function space.

Parameters
[in,out]coefficientsThe expansion coefficients. It must be correctly sized by the calling function.
[in]vThe function to be interpolated

◆ interpolate_c()

void FunctionSpace::interpolate_c ( Eigen::Ref< Eigen::Array< PetscScalar, Eigen::Dynamic, 1 >>  coefficients,
const interpolation_function f 
) const

Interpolate an expression into this function space, filling the array of expansion coefficients associated with this function space.

Note
This interface is not intended for general use. It supports the use of an expression function with a C-signature; it is typically used by compiled Numba functions with C interface.
Parameters
[in,out]coefficientsThe expansion coefficients to be filled. It must be correctly sized by the calling function.
[in]fThe function to be interpolated

◆ operator!=()

bool FunctionSpace::operator!= ( const FunctionSpace V) const

Inequality operator.

Parameters
[in]VAnother function space.

◆ operator==()

bool FunctionSpace::operator== ( const FunctionSpace V) const

Equality operator.

Parameters
[in]VAnother function space

◆ set_x()

void FunctionSpace::set_x ( Eigen::Ref< Eigen::Array< PetscScalar, Eigen::Dynamic, 1 >>  x,
PetscScalar  value,
int  component 
) const

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.

Parameters
[in,out]xThe vector to set
[in]valueThe value to multiply to coordinate by
[in]componentThe coordinate index

◆ sub()

std::shared_ptr< FunctionSpace > FunctionSpace::sub ( const std::vector< int > &  component) const

Extract subspace for component.

Parameters
[in]componentThe subspace component
Returns
The subspace

◆ tabulate_dof_coordinates()

Eigen::Array< double, Eigen::Dynamic, 3, Eigen::RowMajor > FunctionSpace::tabulate_dof_coordinates ( ) const

Tabulate the physical coordinates of all dofs on this process.

Returns
The dof coordinates [([x0, y0, z0], [x1, y1, z1], ...)

The documentation for this class was generated from the following files: