ffcx.element_interface

Finite element interface.

Functions

basix_index(indices)

Get the Basix index of a derivative.

convert_element(element)

Convert and element to a FFCx element.

create_element(element)

Create an FFCx element from a UFL element.

create_quadrature(cellname, degree, rule)

Create a quadrature rule.

map_facet_points(points, facet, cellname)

Map points from a reference facet to a physical facet.

reference_cell_vertices(cellname)

Get the vertices of a reference cell.

Classes

QuadratureElement(cellname, value_shape[, ...])

A quadrature element.

RealElement(element)

A real element.

class ffcx.element_interface.QuadratureElement(cellname: str, value_shape: Tuple[int, ...], scheme: Optional[str] = None, degree: Optional[int] = None, points: Optional[ndarray[Any, dtype[float64]]] = None, weights: Optional[ndarray[Any, dtype[float64]]] = None, mapname: str = 'identity')[source]

Bases: _BasixElementBase

A quadrature element.

Initialise the element.

basix_sobolev_space()[source]

Return the underlying Sobolev space.

property cell_type: 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: DPCVariant

Basix DPC variant used to initialise the element.

property element_family: 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[_BasixElementBase, int, int][source]

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 lagrange_variant: LagrangeVariant

Basix Lagrange variant used to initialise the element.

property map_type: 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: ndarray[Any, dtype[float64]]

Geometry of the reference element.

property reference_topology: List[List[List[int]]]

Topology of the reference element.

tabulate(nderivs: int, points: ndarray[Any, dtype[float64]]) ndarray[Any, dtype[float64]][source]

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 ffcx.element_interface.RealElement(element: FiniteElementBase)[source]

Bases: _BasixElementBase

A real element.

Initialise the element.

basix_sobolev_space()[source]

Return the underlying Sobolev space.

property cell_type: 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: DPCVariant

Basix DPC variant used to initialise the element.

property element_family: 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[_BasixElementBase, int, int][source]

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 lagrange_variant: LagrangeVariant

Basix Lagrange variant used to initialise the element.

property map_type: 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: ndarray[Any, dtype[float64]]

Geometry of the reference element.

property reference_topology: List[List[List[int]]]

Topology of the reference element.

tabulate(nderivs: int, points: ndarray[Any, dtype[float64]]) ndarray[Any, dtype[float64]][source]

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.

ffcx.element_interface.basix_index(indices: Tuple[int]) int[source]

Get the Basix index of a derivative.

ffcx.element_interface.convert_element(element: FiniteElementBase) _BasixElementBase[source]

Convert and element to a FFCx element.

ffcx.element_interface.create_element(element: FiniteElementBase) _BasixElementBase[source]

Create an FFCx element from a UFL element.

Parameters

element – A UFL finite element

Returns

A Basix finite element

ffcx.element_interface.create_quadrature(cellname, degree, rule) Tuple[ndarray[Any, dtype[float64]], ndarray[Any, dtype[float64]]][source]

Create a quadrature rule.

ffcx.element_interface.lru_cache(maxsize=128, typed=False)[source]

Least-recently-used cache decorator.

If maxsize is set to None, the LRU features are disabled and the cache can grow without bound.

If typed is True, arguments of different types will be cached separately. For example, f(3.0) and f(3) will be treated as distinct calls with distinct results.

Arguments to the cached function must be hashable.

View the cache statistics named tuple (hits, misses, maxsize, currsize) with f.cache_info(). Clear the cache and statistics with f.cache_clear(). Access the underlying function with f.__wrapped__.

See: http://en.wikipedia.org/wiki/Cache_replacement_policies#Least_recently_used_(LRU)

ffcx.element_interface.map_facet_points(points: ndarray[Any, dtype[float64]], facet: int, cellname: str) ndarray[Any, dtype[float64]][source]

Map points from a reference facet to a physical facet.

ffcx.element_interface.reference_cell_vertices(cellname: str) ndarray[Any, dtype[float64]][source]

Get the vertices of a reference cell.