DOLFINx 0.8.0
DOLFINx C++ interface
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Public Attributes | List of all members
Function< T, U > Class Template Reference

#include <Function.h>

Public Types

using value_type = T
 
using geometry_type = U
 Geometry type of the Mesh that the Function is defined on.
 

Public Member Functions

 Function (std::shared_ptr< const FunctionSpace< geometry_type > > V)
 
 Function (std::shared_ptr< const FunctionSpace< geometry_type > > V, std::shared_ptr< la::Vector< value_type > > x)
 Create function on given function space with a given vector.
 
 Function (const Function &v)=delete
 
 Function (Function &&v)=default
 Move constructor.
 
 ~Function ()=default
 Destructor.
 
Functionoperator= (Function &&v)=default
 Move assignment.
 
Functionoperator= (const Function &v)=delete
 
Function sub (int i) const
 Extract a sub-function (a view into the Function).
 
Function collapse () const
 Collapse a subfunction (view into a Function) to a stand-alone Function.
 
std::shared_ptr< const FunctionSpace< geometry_type > > function_space () const
 Access the function space.
 
std::shared_ptr< const la::Vector< value_type > > x () const
 Underlying vector.
 
std::shared_ptr< la::Vector< value_type > > x ()
 Underlying vector.
 
void interpolate (const Function< value_type, geometry_type > &v, std::span< const std::int32_t > cells, std::span< const std::int32_t > cell_map, const std::tuple< std::span< const std::int32_t >, std::span< const std::int32_t >, std::span< const geometry_type >, std::span< const std::int32_t > > &nmm_interpolation_data={})
 Interpolate a provided Function.
 
void interpolate (const Function< value_type, geometry_type > &v, std::span< const std::int32_t > cell_map=std::span< const std::int32_t >()={}, const std::tuple< std::span< const std::int32_t >, std::span< const std::int32_t >, std::span< const geometry_type >, std::span< const std::int32_t > > &nmm_interpolation_data={})
 Interpolate a provided Function.
 
void interpolate (const std::function< std::pair< std::vector< value_type >, std::vector< std::size_t > >(MDSPAN_IMPL_STANDARD_NAMESPACE::mdspan< const geometry_type, MDSPAN_IMPL_STANDARD_NAMESPACE::extents< std::size_t, 3, MDSPAN_IMPL_STANDARD_NAMESPACE::dynamic_extent > >)> &f, std::span< const std::int32_t > cells)
 
void interpolate (const std::function< std::pair< std::vector< value_type >, std::vector< std::size_t > >(MDSPAN_IMPL_STANDARD_NAMESPACE::mdspan< const geometry_type, MDSPAN_IMPL_STANDARD_NAMESPACE::extents< std::size_t, 3, MDSPAN_IMPL_STANDARD_NAMESPACE::dynamic_extent > >)> &f)
 Interpolate an expression function on the whole domain.
 
void interpolate (const Expression< value_type, geometry_type > &e, std::span< const std::int32_t > cells, const dolfinx::mesh::Mesh< geometry_type > &expr_mesh, std::span< const std::int32_t > cell_map=std::span< const std::int32_t >())
 Interpolate an Expression (based on UFL)
 
void interpolate (const Expression< value_type, geometry_type > &e, const dolfinx::mesh::Mesh< geometry_type > &expr_mesh, std::span< const std::int32_t > cell_map=std::span< const std::int32_t >()={})
 
void eval (std::span< const geometry_type > x, std::array< std::size_t, 2 > xshape, std::span< const std::int32_t > cells, std::span< value_type > u, std::array< std::size_t, 2 > ushape) const
 Evaluate the Function at points.
 

Public Attributes

std::string name = "u"
 Name.
 

Detailed Description

template<dolfinx::scalar T, std::floating_point U = dolfinx::scalar_value_type_t<T>>
class dolfinx::fem::Function< T, U >

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

Template Parameters
TThe function scalar type.
UThe mesh geometry scalar type.

Member Typedef Documentation

◆ value_type

template<dolfinx::scalar T, std::floating_point U = dolfinx::scalar_value_type_t<T>>
using value_type = T

Field type for the Function, e.g. double, std::complex<float>, etc.

Constructor & Destructor Documentation

◆ Function() [1/2]

template<dolfinx::scalar T, std::floating_point U = dolfinx::scalar_value_type_t<T>>
Function ( std::shared_ptr< const FunctionSpace< geometry_type > > V)
inlineexplicit

Create function on given function space

Parameters
[in]VThe function space

◆ Function() [2/2]

template<dolfinx::scalar T, std::floating_point U = dolfinx::scalar_value_type_t<T>>
Function ( std::shared_ptr< const FunctionSpace< geometry_type > > V,
std::shared_ptr< la::Vector< value_type > > x )
inline

Create function on given function space with a given vector.

Warning
This constructor is intended for internal library use only
Parameters
[in]VThe function space
[in]xThe vector

Member Function Documentation

◆ collapse()

template<dolfinx::scalar T, std::floating_point U = dolfinx::scalar_value_type_t<T>>
Function collapse ( ) const
inline

Collapse a subfunction (view into a Function) to a stand-alone Function.

Returns
New collapsed Function.

◆ eval()

template<dolfinx::scalar T, std::floating_point U = dolfinx::scalar_value_type_t<T>>
void eval ( std::span< const geometry_type > x,
std::array< std::size_t, 2 > xshape,
std::span< const std::int32_t > cells,
std::span< value_type > u,
std::array< std::size_t, 2 > ushape ) const
inline

Evaluate the Function at points.

Parameters
[in]xThe coordinates of the points. It has shape (num_points, 3) and storage is row-major.
[in]xshapeThe shape of x.
[in]cellsAn array of cell indices. cells[i] is the index of the cell that contains the point x(i). Negative cell indices can be passed, and the corresponding point will be ignored.
[out]uThe values at the points. Values are not computed for points with a negative cell index. This argument must be passed with the correct size. Storage is row-major.
[in]ushapeThe shape of u.

◆ function_space()

template<dolfinx::scalar T, std::floating_point U = dolfinx::scalar_value_type_t<T>>
std::shared_ptr< const FunctionSpace< geometry_type > > function_space ( ) const
inline

Access the function space.

Returns
The function space

◆ interpolate() [1/6]

template<dolfinx::scalar T, std::floating_point U = dolfinx::scalar_value_type_t<T>>
void interpolate ( const Expression< value_type, geometry_type > & e,
const dolfinx::mesh::Mesh< geometry_type > & expr_mesh,
std::span< const std::int32_t > cell_map = std::span<const std::int32_t>() = {} )
inline

Interpolate an Expression (based on UFL) on all cells

Parameters
[in]eThe function to be interpolated
[in]expr_meshMesh the Expression e is defined on.
[in]cell_mapMap from cells to cells in expression if receiving function is defined on a different mesh than the expression

◆ interpolate() [2/6]

template<dolfinx::scalar T, std::floating_point U = dolfinx::scalar_value_type_t<T>>
void interpolate ( const Expression< value_type, geometry_type > & e,
std::span< const std::int32_t > cells,
const dolfinx::mesh::Mesh< geometry_type > & expr_mesh,
std::span< const std::int32_t > cell_map = std::span<const std::int32_t>() )
inline

Interpolate an Expression (based on UFL)

Parameters
[in]eExpression to be interpolated. The Expression must have been created using the reference coordinates FiniteElement::interpolation_points() for the element associated with u.
[in]cellsThe cells to interpolate on
[in]expr_meshThe mesh to evaluate the expression on
[in]cell_mapMap from cells to cells in expression

◆ interpolate() [3/6]

template<dolfinx::scalar T, std::floating_point U = dolfinx::scalar_value_type_t<T>>
void interpolate ( const Function< value_type, geometry_type > & v,
std::span< const std::int32_t > cell_map = std::span<const std::int32_t>() = {},
const std::tuple< std::span< const std::int32_t >, std::span< const std::int32_t >, std::span< const geometry_type >, std::span< const std::int32_t > > & nmm_interpolation_data = {} )
inline

Interpolate a provided Function.

Parameters
[in]vThe function to be interpolated
[in]cell_mapMap from cells in self to cell indices in v
[in]nmm_interpolation_dataAuxiliary data to interpolate on nonmatching meshes. This data can be generated with generate_nonmatching_meshes_interpolation_data (optional).

◆ interpolate() [4/6]

template<dolfinx::scalar T, std::floating_point U = dolfinx::scalar_value_type_t<T>>
void interpolate ( const Function< value_type, geometry_type > & v,
std::span< const std::int32_t > cells,
std::span< const std::int32_t > cell_map,
const std::tuple< std::span< const std::int32_t >, std::span< const std::int32_t >, std::span< const geometry_type >, std::span< const std::int32_t > > & nmm_interpolation_data = {} )
inline

Interpolate a provided Function.

Parameters
[in]vThe function to be interpolated
[in]cellsThe cells to interpolate on
[in]cell_mapA map from cells in the mesh associated with this function to cells in mesh associated with v
[in]nmm_interpolation_dataAuxiliary data to interpolate on nonmatching meshes. This data can be generated with generate_nonmatching_meshes_interpolation_data (optional).

◆ interpolate() [5/6]

template<dolfinx::scalar T, std::floating_point U = dolfinx::scalar_value_type_t<T>>
void interpolate ( const std::function< std::pair< std::vector< value_type >, std::vector< std::size_t > >(MDSPAN_IMPL_STANDARD_NAMESPACE::mdspan< const geometry_type, MDSPAN_IMPL_STANDARD_NAMESPACE::extents< std::size_t, 3, MDSPAN_IMPL_STANDARD_NAMESPACE::dynamic_extent > >)> & f)
inline

Interpolate an expression function on the whole domain.

Parameters
[in]fExpression to be interpolated

◆ interpolate() [6/6]

template<dolfinx::scalar T, std::floating_point U = dolfinx::scalar_value_type_t<T>>
void interpolate ( const std::function< std::pair< std::vector< value_type >, std::vector< std::size_t > >(MDSPAN_IMPL_STANDARD_NAMESPACE::mdspan< const geometry_type, MDSPAN_IMPL_STANDARD_NAMESPACE::extents< std::size_t, 3, MDSPAN_IMPL_STANDARD_NAMESPACE::dynamic_extent > >)> & f,
std::span< const std::int32_t > cells )
inline

Interpolate an expression function on a list of cells

Parameters
[in]fThe expression function to be interpolated
[in]cellsThe cells to interpolate on

◆ sub()

template<dolfinx::scalar T, std::floating_point U = dolfinx::scalar_value_type_t<T>>
Function sub ( int i) const
inline

Extract a sub-function (a view into the Function).

Parameters
[in]iIndex of subfunction
Returns
The sub-function

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