basix.ufl_wrapper¶
Functions to directly wrap Basix elements in UFL.
Functions
|
Convert a UFL element to a wrapped Basix element. |
|
Create a UFL element using Basix. |
|
Create a UFL tensor element using Basix. |
|
Create a UFL vector element using Basix. |
Classes
|
A wrapper allowing Basix elements to be used directly with UFL. |
|
An element with a block size that contains multiple copies of a sub element. |
|
An element representing one component of a BasixElement. |
|
A mixed element that combines two or more elements. |
|
A tensor element. |
|
A vector element. |
- class basix.ufl_wrapper.BasixElement(element: basix._basixcpp.FiniteElement)¶
Bases:
basix.ufl_wrapper._BasixElementBase
A wrapper allowing Basix elements to be used directly with UFL.
Create a Basix element.
- property cell_type: basix._basixcpp.CellType¶
Basix cell type used to initialise the element.
- property dim: int¶
Number of DOFs the element has.
- property discontinuous: bool¶
True if the discontinuous version of the element is used.
- property dpc_variant: Optional[basix._basixcpp.DPCVariant]¶
Basix DPC variant used to initialise the element.
- element: basix._basixcpp.FiniteElement¶
- property element_family: Optional[basix._basixcpp.ElementFamily]¶
Basix element family used to initialise the element.
- property entity_closure_dofs: List[List[List[int]]]¶
DOF numbers associated with the closure of each entity.
- property entity_dofs: List[List[List[int]]]¶
DOF numbers associated with each entity.
- property family_name: str¶
Family name of the element.
- get_component_element(flat_component: int) Tuple[basix.ufl_wrapper._BasixElementBase, int, int] ¶
Get element that represents a component of the element, and the offset and stride of the component.
For example, for a MixedElement, this will return the sub-element that represents the given component, the offset of that sub-element, and a stride of 1. For a BlockedElement, this will return the sub-element, an offset equal to the component number, and a stride equal to the block size. For vector-valued element (eg H(curl) and H(div) elements), this returns a ComponentElement (and as offset of 0 and a stride of 1). When tabulate is called on the ComponentElement, only the part of the table for the given component is returned.
- Parameters
flat_component – The component
- Returns
component element, offset of the component, stride of the component
- get_tensor_product_representation()¶
Get the element’s tensor product factorisation.
- has_tensor_product_factorisation() bool ¶
Indicates whether or not this element has a tensor product factorisation.
If this value is true, this element’s basis functions can be computed as a tensor product of the basis elements of the elements in the factoriaation.
- property highest_complete_degree: int¶
The highest complete degree of the element.
- property highest_degree: int¶
The highest degree of the element.
- property interpolation_nderivs: int¶
The number of derivatives needed when interpolating.
- property is_custom_element: bool¶
True if the element is a custom Basix element.
- property lagrange_variant: Optional[basix._basixcpp.LagrangeVariant]¶
Basix Lagrange variant used to initialise the element.
- property map_type: basix._basixcpp.MapType¶
The Basix map type.
- property num_entity_closure_dofs: List[List[int]]¶
Number of DOFs associated with the closure of each entity.
- property num_entity_dofs: List[List[int]]¶
Number of DOFs associated with each entity.
- property num_global_support_dofs: int¶
Get the number of global support DOFs.
- property reference_geometry: numpy.ndarray[Any, numpy.dtype[numpy.float64]]¶
Geometry of the reference element.
- property reference_topology: List[List[List[int]]]¶
Topology of the reference element.
- tabulate(nderivs: int, points: numpy.ndarray[Any, numpy.dtype[numpy.float64]]) numpy.ndarray[Any, numpy.dtype[numpy.float64]] ¶
Tabulate the basis functions of the element.
- Parameters
nderivs – Number of derivatives to tabulate.
points – Points to tabulate at
- Returns
Tabulated basis functions
- property ufcx_element_type: str¶
Element type.
- class basix.ufl_wrapper.BlockedElement(repr: str, sub_element: basix.ufl_wrapper._BasixElementBase, block_size: int, block_shape: Optional[Tuple[int, ...]] = None, symmetric: bool = False)¶
Bases:
basix.ufl_wrapper._BasixElementBase
An element with a block size that contains multiple copies of a sub element.
Initialise the element.
- block_shape: Tuple[int, ...]¶
- property block_size: int¶
The block size of the element.
- property cell_type: basix._basixcpp.CellType¶
Basix cell type used to initialise the element.
- property dim: int¶
Number of DOFs the element has.
- property discontinuous: bool¶
True if the discontinuous version of the element is used.
- property dpc_variant: Optional[basix._basixcpp.DPCVariant]¶
Basix DPC variant used to initialise the element.
- property element_family: Optional[basix._basixcpp.ElementFamily]¶
Basix element family used to initialise the element.
- property entity_closure_dofs: List[List[List[int]]]¶
DOF numbers associated with the closure of each entity.
- property entity_dofs: List[List[List[int]]]¶
DOF numbers associated with each entity.
- property family_name: str¶
Family name of the element.
- get_component_element(flat_component: int) Tuple[basix.ufl_wrapper._BasixElementBase, int, int] ¶
Get element that represents a component of the element, and the offset and stride of the component.
- Parameters
flat_component – The component
- Returns
component element, offset of the component, stride of the component
- get_tensor_product_representation()¶
Get the element’s tensor product factorisation.
- has_tensor_product_factorisation() bool ¶
Indicates whether or not this element has a tensor product factorisation.
If this value is true, this element’s basis functions can be computed as a tensor product of the basis elements of the elements in the factoriaation.
- property highest_complete_degree: int¶
The highest complete degree of the element.
- property highest_degree: int¶
The highest degree of the element.
- property interpolation_nderivs: int¶
The number of derivatives needed when interpolating.
- property lagrange_variant: Optional[basix._basixcpp.LagrangeVariant]¶
Basix Lagrange variant used to initialise the element.
- property map_type: basix._basixcpp.MapType¶
The Basix map type.
- property num_entity_closure_dofs: List[List[int]]¶
Number of DOFs associated with the closure of each entity.
- property num_entity_dofs: List[List[int]]¶
Number of DOFs associated with each entity.
- property num_global_support_dofs: int¶
Get the number of global support DOFs.
- property reference_geometry: numpy.ndarray[Any, numpy.dtype[numpy.float64]]¶
Geometry of the reference element.
- property reference_topology: List[List[List[int]]]¶
Topology of the reference element.
- reference_value_shape() Tuple[int, ...] ¶
Reference value shape of the element basis function.
- sub_element: basix.ufl_wrapper._BasixElementBase¶
- sub_elements() List[basix.ufl_wrapper._BasixElementBase] ¶
Return a list of sub elements.
- tabulate(nderivs: int, points: numpy.ndarray[Any, numpy.dtype[numpy.float64]]) numpy.ndarray[Any, numpy.dtype[numpy.float64]] ¶
Tabulate the basis functions of the element.
- Parameters
nderivs – Number of derivatives to tabulate.
points – Points to tabulate at
- Returns
Tabulated basis functions
- property ufcx_element_type: str¶
Element type.
- class basix.ufl_wrapper.ComponentElement(element: basix.ufl_wrapper._BasixElementBase, component: int)¶
Bases:
basix.ufl_wrapper._BasixElementBase
An element representing one component of a BasixElement.
Initialise the element.
- property cell_type: basix._basixcpp.CellType¶
Basix cell type used to initialise the element.
- component: int¶
- property dim: int¶
Number of DOFs the element has.
- property discontinuous: bool¶
True if the discontinuous version of the element is used.
- property dpc_variant: Optional[basix._basixcpp.DPCVariant]¶
Basix DPC variant used to initialise the element.
- element: basix.ufl_wrapper._BasixElementBase¶
- property element_family: Optional[basix._basixcpp.ElementFamily]¶
Basix element family used to initialise the element.
- property entity_closure_dofs: List[List[List[int]]]¶
DOF numbers associated with the closure of each entity.
- property entity_dofs: List[List[List[int]]]¶
DOF numbers associated with each entity.
- property family_name: str¶
Family name of the element.
- get_component_element(flat_component: int) Tuple[basix.ufl_wrapper._BasixElementBase, int, int] ¶
Get element that represents a component of the element, and the offset and stride of the component.
- Parameters
flat_component – The component
- Returns
component element, offset of the component, stride of the component
- property interpolation_nderivs: int¶
The number of derivatives needed when interpolating.
- property lagrange_variant: Optional[basix._basixcpp.LagrangeVariant]¶
Basix Lagrange variant used to initialise the element.
- property num_entity_closure_dofs: List[List[int]]¶
Number of DOFs associated with the closure of each entity.
- property num_entity_dofs: List[List[int]]¶
Number of DOFs associated with each entity.
- property num_global_support_dofs: int¶
Get the number of global support DOFs.
- property reference_geometry: numpy.ndarray[Any, numpy.dtype[numpy.float64]]¶
Geometry of the reference element.
- property reference_topology: List[List[List[int]]]¶
Topology of the reference element.
- tabulate(nderivs: int, points: numpy.ndarray[Any, numpy.dtype[numpy.float64]]) numpy.ndarray[Any, numpy.dtype[numpy.float64]] ¶
Tabulate the basis functions of the element.
- Parameters
nderivs – Number of derivatives to tabulate.
points – Points to tabulate at
- Returns
Tabulated basis functions
- class basix.ufl_wrapper.MixedElement(sub_elements: List[basix.ufl_wrapper._BasixElementBase])¶
Bases:
basix.ufl_wrapper._BasixElementBase
A mixed element that combines two or more elements.
Initialise the element.
- property cell_type: basix._basixcpp.CellType¶
Basix cell type used to initialise the element.
- property dim: int¶
Number of DOFs the element has.
- property discontinuous: bool¶
True if the discontinuous version of the element is used.
- property dpc_variant: Optional[basix._basixcpp.DPCVariant]¶
Basix DPC variant used to initialise the element.
- property element_family: Optional[basix._basixcpp.ElementFamily]¶
Basix element family used to initialise the element.
- property entity_closure_dofs: List[List[List[int]]]¶
DOF numbers associated with the closure of each entity.
- property entity_dofs: List[List[List[int]]]¶
DOF numbers associated with each entity.
- property family_name: str¶
Family name of the element.
- get_component_element(flat_component: int) Tuple[basix.ufl_wrapper._BasixElementBase, int, int] ¶
Get element that represents a component of the element, and the offset and stride of the component.
- Parameters
flat_component – The component
- Returns
component element, offset of the component, stride of the component
- property interpolation_nderivs: int¶
The number of derivatives needed when interpolating.
- property lagrange_variant: Optional[basix._basixcpp.LagrangeVariant]¶
Basix Lagrange variant used to initialise the element.
- property num_entity_closure_dofs: List[List[int]]¶
Number of DOFs associated with the closure of each entity.
- property num_entity_dofs: List[List[int]]¶
Number of DOFs associated with each entity.
- property num_global_support_dofs: int¶
Get the number of global support DOFs.
- property reference_geometry: numpy.ndarray[Any, numpy.dtype[numpy.float64]]¶
Geometry of the reference element.
- property reference_topology: List[List[List[int]]]¶
Topology of the reference element.
- sub_elements() List[basix.ufl_wrapper._BasixElementBase] ¶
Return a list of sub elements.
- tabulate(nderivs: int, points: numpy.ndarray[Any, numpy.dtype[numpy.float64]]) numpy.ndarray[Any, numpy.dtype[numpy.float64]] ¶
Tabulate the basis functions of the element.
- Parameters
nderivs – Number of derivatives to tabulate.
points – Points to tabulate at
- Returns
Tabulated basis functions
- property ufcx_element_type: str¶
Get the element type.
- class basix.ufl_wrapper.TensorElement(sub_element: basix.ufl_wrapper._BasixElementBase, shape: Optional[Tuple[int, int]] = None, symmetric: bool = False)¶
Bases:
basix.ufl_wrapper.BlockedElement
A tensor element.
Initialise the element.
- class basix.ufl_wrapper.VectorElement(sub_element: basix.ufl_wrapper._BasixElementBase, size: Optional[int] = None)¶
Bases:
basix.ufl_wrapper.BlockedElement
A vector element.
Initialise the element.
- basix.ufl_wrapper.convert_ufl_element(element: ufl.finiteelement.finiteelementbase.FiniteElementBase) basix.ufl_wrapper._BasixElementBase ¶
Convert a UFL element to a wrapped Basix element.
- basix.ufl_wrapper.create_element(family: typing.Union[basix._basixcpp.ElementFamily, str], cell: typing.Union[basix._basixcpp.CellType, str], degree: int, lagrange_variant: basix._basixcpp.LagrangeVariant = <LagrangeVariant.unset: -1>, dpc_variant: basix._basixcpp.DPCVariant = <DPCVariant.unset: -1>, discontinuous=False) basix.ufl_wrapper.BasixElement ¶
Create a UFL element using Basix.
- Parameters
family – The element’s family as a Basix enum or a string.
cell – The cell type as a Basix enum or a string.
degree – The degree of the finite element.
lagrange_variant – The variant of Lagrange to be used.
dpc_variant – The variant of DPC to be used.
discontinuous – If set to True, the discontinuous version of this element will be created.
- basix.ufl_wrapper.create_tensor_element(family: typing.Union[basix._basixcpp.ElementFamily, str], cell: typing.Union[basix._basixcpp.CellType, str], degree: int, lagrange_variant: basix._basixcpp.LagrangeVariant = <LagrangeVariant.unset: -1>, dpc_variant: basix._basixcpp.DPCVariant = <DPCVariant.unset: -1>, discontinuous=False) basix.ufl_wrapper.TensorElement ¶
Create a UFL tensor element using Basix.
A tensor element is an element which uses multiple copies of a scalar element to represent a tensor-valued function.
- Parameters
family – The element’s family as a Basix enum or a string.
cell – The cell type as a Basix enum or a string.
degree – The degree of the finite element.
lagrange_variant – The variant of Lagrange to be used.
dpc_variant – The variant of DPC to be used.
discontinuous – If set to True, the discontinuous version of this element will be created.
- basix.ufl_wrapper.create_vector_element(family: typing.Union[basix._basixcpp.ElementFamily, str], cell: typing.Union[basix._basixcpp.CellType, str], degree: int, lagrange_variant: basix._basixcpp.LagrangeVariant = <LagrangeVariant.unset: -1>, dpc_variant: basix._basixcpp.DPCVariant = <DPCVariant.unset: -1>, discontinuous=False) basix.ufl_wrapper.VectorElement ¶
Create a UFL vector element using Basix.
A vector element is an element which uses multiple copies of a scalar element to represent a vector-valued function.
- Parameters
family – The element’s family as a Basix enum or a string.
cell – The cell type as a Basix enum or a string.
degree – The degree of the finite element.
lagrange_variant – The variant of Lagrange to be used.
dpc_variant – The variant of DPC to be used.
discontinuous – If set to True, the discontinuous version of this element will be created.