Note: this is documentation for an old release. View the latest documentation at docs.fenicsproject.org/dolfinx/v0.9.0/cpp/doxygen/d7/d76/classdolfinx_1_1fem_1_1Function.html
DOLFINx  0.5.1
DOLFINx C++ interface
Public Types | Public Member Functions | Public Attributes | List of all members
Function< T > Class Template Reference

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

#include <Function.h>

Public Types

using value_type = T
 Field type for the Function, e.g. double.
 

Public Member Functions

 Function (std::shared_ptr< const FunctionSpace > V)
 Create function on given function space. More...
 
 Function (std::shared_ptr< const FunctionSpace > V, std::shared_ptr< la::Vector< T >> x)
 Create function on given function space with a given vector. More...
 
 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 subfunction (view into the Function) More...
 
Function collapse () const
 Collapse a subfunction (view into a Function) to a stand-alone Function. More...
 
std::shared_ptr< const FunctionSpacefunction_space () const
 Access the function space. More...
 
std::shared_ptr< const la::Vector< T > > x () const
 Underlying vector.
 
std::shared_ptr< la::Vector< T > > x ()
 Underlying vector.
 
void interpolate (const Function< T > &v, std::span< const std::int32_t > cells)
 Interpolate a Function. More...
 
void interpolate (const Function< T > &v)
 Interpolate a Function. More...
 
void interpolate (const std::function< xt::xarray< T >(const xt::xtensor< double, 2 > &)> &f, std::span< const std::int32_t > cells)
 Interpolate an expression function on a list of cells. More...
 
void interpolate (const std::function< xt::xarray< T >(const xt::xtensor< double, 2 > &)> &f)
 Interpolate an expression function on the whole domain. More...
 
void interpolate (const Expression< T > &e, std::span< const std::int32_t > cells)
 Interpolate an Expression (based on UFL) More...
 
void interpolate (const Expression< T > &e)
 Interpolate an Expression (based on UFL) on all cells. More...
 
void eval (std::span< const double > x, std::array< std::size_t, 2 > xshape, std::span< const std::int32_t > cells, std::span< T > u, std::array< std::size_t, 2 > ushape) const
 Evaluate the Function at points. More...
 

Public Attributes

std::string name = "u"
 Name.
 

Detailed Description

template<typename T>
class dolfinx::fem::Function< T >

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

Constructor & Destructor Documentation

◆ Function() [1/2]

Function ( std::shared_ptr< const FunctionSpace V)
inlineexplicit

Create function on given function space.

Parameters
[in]VThe function space

◆ Function() [2/2]

Function ( std::shared_ptr< const FunctionSpace V,
std::shared_ptr< la::Vector< T >>  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()

Function collapse ( ) const
inline

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

Returns
New collapsed Function

◆ eval()

void eval ( std::span< const double >  x,
std::array< std::size_t, 2 >  xshape,
std::span< const std::int32_t >  cells,
std::span< T >  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()

std::shared_ptr<const FunctionSpace> function_space ( ) const
inline

Access the function space.

Returns
The function space

◆ interpolate() [1/6]

void interpolate ( const Expression< T > &  e)
inline

Interpolate an Expression (based on UFL) on all cells.

Parameters
[in]eThe function to be interpolated

◆ interpolate() [2/6]

void interpolate ( const Expression< T > &  e,
std::span< const std::int32_t >  cells 
)
inline

Interpolate an Expression (based on UFL)

Parameters
[in]eThe Expression 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

◆ interpolate() [3/6]

void interpolate ( const Function< T > &  v)
inline

Interpolate a Function.

Parameters
[in]vThe function to be interpolated

◆ interpolate() [4/6]

void interpolate ( const Function< T > &  v,
std::span< const std::int32_t >  cells 
)
inline

Interpolate a Function.

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

◆ interpolate() [5/6]

void interpolate ( const std::function< xt::xarray< T >(const xt::xtensor< double, 2 > &)> &  f)
inline

Interpolate an expression function on the whole domain.

Parameters
[in]fThe expression to be interpolated

◆ interpolate() [6/6]

void interpolate ( const std::function< xt::xarray< T >(const xt::xtensor< double, 2 > &)> &  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()

Function sub ( int  i) const
inline

Extract subfunction (view into the Function)

Parameters
[in]iIndex of subfunction
Returns
The subfunction

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