basix.ufl¶
Functions to directly wrap Basix elements in UFL.
Functions
|
Create a UFL compatible blocked element. |
|
Convert a UFL element to a UFL compatible Basix element. |
|
Create a UFL compatible custom Basix element. |
|
Create a UFL compatible element using Basix. |
|
Create an UFL compatible enriched element from a list of elements. |
|
Create a UFL compatible mixed element from a list of elements. |
|
Create a quadrature element. |
|
Create a real element. |
- basix.ufl.blocked_element(sub_element: _ElementBase, shape: Tuple[int, ...], symmetry: bool | None = None, gdim: int | None = None) _ElementBase ¶
Create a UFL compatible blocked element.
- Parameters:
sub_element – Element used for each block.
shape – Value shape of the element. For scalar-valued families, this can be used to create vector and tensor elements.
symmetry – Set to
True
if the tensor is symmetric. Valid for rank 2 elements only.gdim – Geometric dimension. If not set the geometric dimension is set equal to the topological dimension of the cell.
- Returns:
A blocked finite element.
- basix.ufl.convert_ufl_element(ufl_element: FiniteElementBase) _ElementBase ¶
Convert a UFL element to a UFL compatible Basix element.
- basix.ufl.custom_element(cell_type: ~basix._basixcpp.CellType, value_shape: ~typing.List[int] | ~typing.Tuple[int, ...], wcoeffs: ~numpy.ndarray[~typing.Any, ~numpy.dtype[~numpy.float64]], x: ~typing.List[~typing.List[~numpy.ndarray[~typing.Any, ~numpy.dtype[~numpy.float64]]]], M: ~typing.List[~typing.List[~numpy.ndarray[~typing.Any, ~numpy.dtype[~numpy.float64]]]], interpolation_nderivs: int, map_type: ~basix._basixcpp.MapType, sobolev_space: ~basix._basixcpp.SobolevSpace, discontinuous: bool, highest_complete_degree: int, highest_degree: int, polyset_type: ~basix._basixcpp.PolysetType = <PolysetType.standard: 0>, gdim: int | None = None) _ElementBase ¶
Create a UFL compatible custom Basix element.
- Parameters:
cell_type – The cell type
value_shape – The value shape of the element
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(Legenre polynomials))
.x – Interpolation points. Indices are
(tdim, entity index, point index, dim)
M – The interpolation matrices. Indices are
(tdim, entity index, dof, vs, point_index, derivative)
.interpolation_nderivs – The number of derivatives that need to be used during interpolation.
map_type – The type of map to be used to map values from the reference to a cell.
sobolev_space – Underlying Sobolev space for the element.
discontinuous – Indicates whether or not this is the discontinuous version of the element.
highest_complete_degree – The highest degree
n
such that a Lagrange (or vector Lagrange) element of degreen
is a subspace of this element.highest_degree – The degree of a polynomial in this element’s polyset.
polyset_type – Polyset type for the element.
gdim – Geometric dimension. If not set the geometric dimension is set equal to the topological dimension of the cell.
- Returns:
A custom finite element.
- basix.ufl.element(family: ~basix._basixcpp.ElementFamily | str, cell: ~basix._basixcpp.CellType | str, degree: int, lagrange_variant: ~basix._basixcpp.LagrangeVariant = <LagrangeVariant.unset: -1>, dpc_variant: ~basix._basixcpp.DPCVariant = <DPCVariant.unset: -1>, discontinuous: bool = False, shape: ~typing.Tuple[int, ...] | None = None, symmetry: bool | None = None, gdim: int | None = None) _ElementBase ¶
Create a UFL compatible element using Basix.
- Parameters:
family – Element family/type.
cell – Element cell type.
degree – Degree of the finite element.
lagrange_variant – Variant of Lagrange to be used.
dpc_variant – Variant of DPC to be used.
discontinuous – If
True
, the discontinuous version of the element is created.shape – Value shape of the element. For scalar-valued families, this can be used to create vector and tensor elements.
symmetry – Set to
True
if the tensor is symmetric. Valid for rank 2 elements only.gdim – Geometric dimension. If not set the geometric dimension is set equal to the topological dimension of the cell.
- Returns:
A finite element.
- basix.ufl.enriched_element(elements: List[_ElementBase], map_type: MapType | None = None, gdim: int | None = None) _ElementBase ¶
Create an UFL compatible enriched element from a list of elements.
- Parameters:
elements – The list of elements
map_type – The map type for the enriched element.
gdim – Geometric dimension. If not set the geometric dimension is set equal to the topological dimension of the cell.
- Returns:
An enriched finite element.
- basix.ufl.mixed_element(elements: List[_ElementBase], gdim: int | None = None) _ElementBase ¶
Create a UFL compatible mixed element from a list of elements.
- Parameters:
elements – The list of elements
gdim – Geometric dimension. If not set the geometric dimension is set equal to the topological dimension of the cell.
- Returns:
A mixed finite element.
- basix.ufl.quadrature_element(cell: str | CellType, value_shape: Tuple[int, ...], scheme: str | None = None, degree: int | None = None, points: ndarray[Any, dtype[float64]] | None = None, weights: ndarray[Any, dtype[float64]] | None = None, mapname: str = 'identity') _ElementBase ¶
Create a quadrature element.
When creating this element, either the quadrature scheme and degree must be input or the quadrature points and weights must be.
- Parameters:
cell – Cell to create the element on.
value_shape – Value shape of the element.
scheme – Quadrature scheme.
degree – Quadrature degree.
points – Quadrature points.
weights – Quadrature weights.
mapname – Map name.
- Returns:
A ‘quadrature’ finite element.