# Basix 0.7.0.0

## HomeInstallationDemosC++ docsPython docs

basix Namespace Reference

Basix: FEniCS runtime basis evaluation library. More...

## Namespaces

cell

doftransforms

element
Interfaces for creating finite elements.

indexing
Indexing.

lattice
Lattices of points.

maps

math

moments
Functions to create integral moment DOFs.

polynomials
Polynomials.

polyset
Polynomial expansion sets.

precompute
Matrix and permutation precomputation.

sobolev

## Classes

class  FiniteElement
A finite element. More...

## Functions

template<std::floating_point T>
FiniteElement< T > create_custom_element (cell::type cell_type, const std::vector< std::size_t > &value_shape, impl::mdspan_t< const T, 2 > wcoeffs, const std::array< std::vector< impl::mdspan_t< const T, 2 >>, 4 > &x, const std::array< std::vector< impl::mdspan_t< const T, 4 >>, 4 > &M, int interpolation_nderivs, maps::type map_type, sobolev::space sobolev_space, bool discontinuous, int highest_complete_degree, int highest_degree, polyset::type poly_type)

template<std::floating_point T>
FiniteElement< T > create_element (element::family family, cell::type cell, int degree, element::lagrange_variant lvariant, element::dpc_variant dvariant, bool discontinuous, std::vector< int > dof_ordering={})

std::string version ()

template<std::floating_point T>
std::pair< std::vector< T >, std::array< std::size_t, 2 > > compute_interpolation_operator (const FiniteElement< T > &element_from, const FiniteElement< T > &element_to)
Compute a matrix that represents the interpolation between two elements. More...

## Detailed Description

Basix: FEniCS runtime basis evaluation library.

## ◆ compute_interpolation_operator()

template<std::floating_point T>
 std::pair< std::vector< T >, std::array< std::size_t, 2 > > basix::compute_interpolation_operator ( const FiniteElement< T > & element_from, const FiniteElement< T > & element_to )

Compute a matrix that represents the interpolation between two elements.

If the two elements have the same value size, this function returns the interpolation between them.

If element_from has value size 1 and element_to has value size > 1, then this function returns a matrix to interpolate from a blocked element_from (ie multiple copies of element_from) into element_to.

If element_to has value size 1 and element_from has value size > 1, then this function returns a matrix that interpolates the components of element_from into copies of element_to.

Note
If the elements have different value sizes and both are greater than 1, this function throws a runtime error

In order to interpolate functions between finite element spaces on arbitrary cells, the functions must be pulled back to the reference element (this pull back includes applying DOF transformations). The matrix that this function returns can then be applied, then the result pushed forward to the cell. If element_from and element_to have the same map type, then only the DOF transformations need to be applied, as the pull back and push forward cancel each other out.

Parameters
 [in] element_from The element to interpolate from [in] element_to The element to interpolate to
Returns
Matrix operator that maps the 'from' degrees-of-freedom to the 'to' degrees-of-freedom. Shape is (ndofs(element_to), ndofs(element_from))

## ◆ create_custom_element()

template<std::floating_point T>
 FiniteElement< T > basix::create_custom_element ( cell::type cell_type, const std::vector< std::size_t > & value_shape, impl::mdspan_t< const T, 2 > wcoeffs, const std::array< std::vector< impl::mdspan_t< const T, 2 >>, 4 > & x, const std::array< std::vector< impl::mdspan_t< const T, 4 >>, 4 > & M, int interpolation_nderivs, maps::type map_type, sobolev::space sobolev_space, bool discontinuous, int highest_complete_degree, int highest_degree, polyset::type poly_type )

Create a custom finite element

Parameters
 [in] cell_type The cell type [in] value_shape The value shape of the element [in] wcoeffs Matrices for the kth value index containing the expansion coefficients defining a polynomial basis spanning the polynomial space for this element. Shape is (dim(finite element polyset), dim(Legendre polynomials)) [in] x Interpolation points. Indices are (tdim, entity index, point index, dim) [in] M The interpolation matrices. Indices are (tdim, entity index, dof, vs, point_index, derivative) [in] interpolation_nderivs The number of derivatives that need to be used during interpolation [in] map_type The type of map to be used to map values from the reference to a cell [in] sobolev_space The underlying Sobolev space for the element [in] discontinuous Indicates whether or not this is the discontinuous version of the element [in] highest_complete_degree The highest degree n such that a Lagrange (or vector Lagrange) element of degree n is a subspace of this element [in] highest_degree The degree of a polynomial in this element's polyset [in] poly_type The type of polyset to use for this element
Returns
A custom finite element

## ◆ create_element()

template<std::floating_point T>
 template basix::FiniteElement< double > basix::create_element ( element::family family, cell::type cell, int degree, element::lagrange_variant lvariant, element::dpc_variant dvariant, bool discontinuous, std::vector< int > dof_ordering = {} )

Create an element using a given Lagrange variant and a given DPC variant

Parameters
 [in] family The element family [in] cell The reference cell type that the element is defined on [in] degree The degree of the element [in] lvariant The variant of Lagrange to use [in] dvariant The variant of DPC to use [in] discontinuous Indicates whether the element is discontinuous between cells points of the element. The discontinuous element will have the same DOFs, but they will all be associated with the interior of the cell. [in] dof_ordering Ordering of dofs for ElementDofLayout
Returns
A finite element

## ◆ version()

 std::string basix::version ( )

Return the Basix version number

Returns
version string