Loading...
Searching...
No Matches
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)
| Create function on given function space.
| 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.
Function & | operator= (Function &&v)=default
| Move assignment.
Function & | operator= (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 (const version).
std::shared_ptr< la::Vector< value_type > > | x ()
| Underlying vector.
void | interpolate (const std::function< std::pair< std::vector< value_type >, std::vector< std::size_t > >(md::mdspan< const geometry_type, md::extents< std::size_t, 3, md::dynamic_extent > >)> &f)
| Interpolate an expression f(x) on the whole domain.
void | interpolate (const std::function< std::pair< std::vector< value_type >, std::vector< std::size_t > >(md::mdspan< const geometry_type, md::extents< std::size_t, 3, md::dynamic_extent > >)> &f, std::span< const std::int32_t > cells)
| Interpolate an expression f(x) over a set of cells.
void | interpolate (const Function< value_type, geometry_type > &u)
| Interpolate a Function over all cells.
void | interpolate (const Function< value_type, geometry_type > &u0, std::span< const std::int32_t > cells0, std::span< const std::int32_t > cells1={})
| Interpolate a Function over a subset of cells.
void | interpolate (const Expression< value_type, geometry_type > &e)
| Interpolate an Expression on all cells.
void | interpolate (const Expression< value_type, geometry_type > &e0, std::span< const std::int32_t > cells0, std::span< const std::int32_t > cells1={})
| Interpolate an Expression over a subset of cells.
void | interpolate (const Function< value_type, geometry_type > &v, std::span< const std::int32_t > cells, const geometry::PointOwnershipData< U > &interpolation_data)
| Interpolate a Function defined on a different mesh.
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_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

  T | The function scalar type.
  U | The mesh geometry scalar type.

## Member Typedef Documentation

## value_type

template<dolfinx::scalar T, std::floating_point U = dolfinx::scalar_value_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_t<T>>

Function | ( | std::shared_ptr< const FunctionSpace< geometry_type > > | V | ) |

inline explicit

Create function on given function space.

Parameters

  [in] | V | The function space

## Function() [2/2]

template<dolfinx::scalar T, std::floating_point U = dolfinx::scalar_value_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] | V | The function space.
  [in] | x | The vector.

## Member Function Documentation

## collapse()

template<dolfinx::scalar T, std::floating_point U = dolfinx::scalar_value_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_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] | x | The coordinates of the points. It has shape (num_points, 3) and storage is row-major.
  [in] | xshape | Shape of x.
  [in] | cells | Cell indices such that cells[i] is the index of the cell that contains the point x(i). Negative cell indices can be passed, in which case the corresponding point is ignored.
  [out] | u | 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] | ushape | Shape of u.

## function_space()

template<dolfinx::scalar T, std::floating_point U = dolfinx::scalar_value_t<T>>

std::shared_ptr< const FunctionSpace< geometry_type > > function_space | ( |  | ) | const

inline

Access the function space.

Returns
  The function space.

## interpolate() [1/7]

template<dolfinx::scalar T, std::floating_point U = dolfinx::scalar_value_t<T>>

void interpolate | ( | const Expression< value_type, geometry_type > & | e | ) |

inline

Interpolate an Expression on all cells.

Parameters

  [in] | e | Expression to be interpolated.

Precondition
  If a mesh is associated with Function coefficients of e, it must be the same as the mesh::Mesh associated with this.

## interpolate() [2/7]

template<dolfinx::scalar T, std::floating_point U = dolfinx::scalar_value_t<T>>

void interpolate | ( | const Expression< value_type, geometry_type > & | e0,
|  | std::span< const std::int32_t > | cells0,
|  | std::span< const std::int32_t > | cells1 = {} )

inline

Interpolate an Expression over a subset of cells.

Parameters

  [in] | e0 | Expression to be interpolated. The Expression must have been created using the reference coordinates created by FiniteElement::interpolation_points for the element associated with this.
  [in] | cells0 | Cells in the mesh associated with e0 to interpolate from if e0 has Function coefficients. If no mesh can be associated with e0 then the mesh associated with this is used.
  [in] | cells1 | Cell indices associated with the mesh of this that will be interpolated to. If cells0[i] is the index of a cell in the mesh associated with u0, then cells1[i] is the index of the same cell but in the mesh associated with this. This argument can be empty when this and u0 share the same mesh. Otherwise the length of cells and the length of cells0 must be the same.

## interpolate() [3/7]

template<dolfinx::scalar T, std::floating_point U = dolfinx::scalar_value_t<T>>

void interpolate | ( | const Function< value_type, geometry_type > & | u | ) |

inline

Interpolate a Function over all cells.

Parameters

  [in] | u | Function to be interpolated.

Precondition
  The mesh associated with this and the mesh associated with u must be the same mesh::Mesh.

## interpolate() [4/7]

template<dolfinx::scalar T, std::floating_point U = dolfinx::scalar_value_t<T>>

void interpolate | ( | const Function< value_type, geometry_type > & | u0,
|  | std::span< const std::int32_t > | cells0,
|  | std::span< const std::int32_t > | cells1 = {} )

inline

Interpolate a Function over a subset of cells.

The Function being interpolated from and the Function being interpolated into can be defined on different sub-meshes, i.e. views into a subset a cells.

Parameters

  [in] | u0 | Function to be interpolated.
  [in] | cells0 | Cells to interpolate from. These are the indices of the cells in the mesh associated with u0.
  [in] | cells1 | Cell indices associated with the mesh of this that will be interpolated to. If cells0[i] is the index of a cell in the mesh associated with u0, then cells1[i] is the index of the same cell but in the mesh associated with this. This argument can be empty when this and u0 share the same mesh. Otherwise the length of cells and the length of cells0 must be the same.

## interpolate() [5/7]

template<dolfinx::scalar T, std::floating_point U = dolfinx::scalar_value_t<T>>

void interpolate | ( | const Function< value_type, geometry_type > & | v,
|  | std::span< const std::int32_t > | cells,
|  | const geometry::PointOwnershipData< U > & | interpolation_data )

inline

Interpolate a Function defined on a different mesh.

Parameters

  [in] | v | Function to be interpolated.
  [in] | cells | Cells in the mesh associated with this to interpolate into.
  [in] | interpolation_data | Data required for associating the interpolation points of this with cells in v. Can be computed with fem::create_interpolation_data.

## interpolate() [6/7]

template<dolfinx::scalar T, std::floating_point U = dolfinx::scalar_value_t<T>>

void interpolate | ( | const std::function< std::pair< std::vector< value_type >, std::vector< std::size_t > >(md::mdspan< const geometry_type, md::extents< std::size_t, 3, md::dynamic_extent > >)> & | f | ) |

inline

Interpolate an expression f(x) on the whole domain.

Parameters

  [in] | f | Expression to be interpolated.

## interpolate() [7/7]

template<dolfinx::scalar T, std::floating_point U = dolfinx::scalar_value_t<T>>

void interpolate | ( | const std::function< std::pair< std::vector< value_type >, std::vector< std::size_t > >(md::mdspan< const geometry_type, md::extents< std::size_t, 3, md::dynamic_extent > >)> & | f,
|  | std::span< const std::int32_t > | cells )

inline

Interpolate an expression f(x) over a set of cells.

Parameters

  [in] | f | Expression function to be interpolated.
  [in] | cells | Cells to interpolate on.

## sub()

template<dolfinx::scalar T, std::floating_point U = dolfinx::scalar_value_t<T>>

Function sub | ( | int | i | ) | const

inline

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

Parameters

  [in] | i | Index of subfunction

Returns
  The sub-function

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

- /build/fenics-dolfinx-PdyzCE/fenics-dolfinx-0.10.0.post5/cpp/dolfinx/fem/Expression.h
- /build/fenics-dolfinx-PdyzCE/fenics-dolfinx-0.10.0.post5/cpp/dolfinx/fem/Function.h