# Basix 0.5.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.

## Classes

class  FiniteElement
A finite element. More...

## Functions

FiniteElement create_custom_element (cell::type cell_type, const std::vector< std::size_t > &value_shape, const impl::cmdspan2_t &wcoeffs, const std::array< std::vector< impl::cmdspan2_t >, 4 > &x, const std::array< std::vector< impl::cmdspan4_t >, 4 > &M, int interpolation_nderivs, maps::type map_type, bool discontinuous, int highest_complete_degree, int highest_degree)

FiniteElement create_element (element::family family, cell::type cell, int degree, element::lagrange_variant lvariant, bool discontinuous)

FiniteElement create_element (element::family family, cell::type cell, int degree, element::lagrange_variant lvariant, element::dpc_variant dvariant, bool discontinuous)

FiniteElement create_element (element::family family, cell::type cell, int degree, element::dpc_variant dvariant, bool discontinuous)

FiniteElement create_element (element::family family, cell::type cell, int degree, bool discontinuous)

FiniteElement create_element (element::family family, cell::type cell, int degree, element::lagrange_variant lvariant)

FiniteElement create_element (element::family family, cell::type cell, int degree, element::lagrange_variant lvariant, element::dpc_variant dvariant)

FiniteElement create_element (element::family family, cell::type cell, int degree, element::dpc_variant dvariant)

FiniteElement create_element (element::family family, cell::type cell, int degree)

std::string version ()

std::pair< std::vector< double >, std::array< std::size_t, 2 > > compute_interpolation_operator (const FiniteElement &element_from, const FiniteElement &element_to)

## Detailed Description

Basix: FEniCS runtime basis evaluation library.

## ◆ compute_interpolation_operator()

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

Computes 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()

 basix::FiniteElement basix::create_custom_element ( cell::type cell_type, const std::vector< std::size_t > & value_shape, const impl::cmdspan2_t & wcoeffs, const std::array< std::vector< impl::cmdspan2_t >, 4 > & x, const std::array< std::vector< impl::cmdspan4_t >, 4 > & M, int interpolation_nderivs, maps::type map_type, bool discontinuous, int highest_complete_degree, int highest_degree )

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] 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
Returns
A custom finite element

## ◆ create_element() [1/8]

 basix::FiniteElement basix::create_element ( element::family family, cell::type cell, int degree )

Create a continuous element

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
Returns
A finite element

## ◆ create_element() [2/8]

 basix::FiniteElement basix::create_element ( element::family family, cell::type cell, int degree, bool discontinuous )

Create an element

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] 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.
Returns
A finite element

## ◆ create_element() [3/8]

 basix::FiniteElement basix::create_element ( element::family family, cell::type cell, int degree, element::dpc_variant dvariant )

Create a continuous element using 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] dvariant The variant of DPC to use
Returns
A finite element

## ◆ create_element() [4/8]

 basix::FiniteElement basix::create_element ( element::family family, cell::type cell, int degree, element::dpc_variant dvariant, bool discontinuous )

Create an element using 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] 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.
Returns
A finite element

## ◆ create_element() [5/8]

 basix::FiniteElement basix::create_element ( element::family family, cell::type cell, int degree, element::lagrange_variant lvariant )

Create a continuous element using a given Lagrange 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
Returns
A finite element

## ◆ create_element() [6/8]

 basix::FiniteElement basix::create_element ( element::family family, cell::type cell, int degree, element::lagrange_variant lvariant, bool discontinuous )

Create an element using a given Lagrange 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] 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.
Returns
A finite element

## ◆ create_element() [7/8]

 basix::FiniteElement basix::create_element ( element::family family, cell::type cell, int degree, element::lagrange_variant lvariant, element::dpc_variant dvariant )

Create a continuous 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
Returns
A finite element

## ◆ create_element() [8/8]

 basix::FiniteElement basix::create_element ( element::family family, cell::type cell, int degree, element::lagrange_variant lvariant, element::dpc_variant dvariant, bool discontinuous )

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.
Returns
A finite element

## ◆ version()

 std::string basix::version ( )

Return the Basix version number

Returns
version string