ffcx.element_interface
Finite element interface.
Functions
  | 
Get the Basix index of a derivative.  | 
  | 
Create a basix element.  | 
  | 
Create an FFCx element from a UFL element.  | 
  | 
Create a quadrature rule.  | 
  | 
Map points from a reference facet to a physical facet.  | 
  | 
Get the vertices of a reference cell.  | 
Classes
An abstract element class.  | 
|
  | 
An element defined by Basix.  | 
  | 
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 quadrature element.  | 
- class ffcx.element_interface.ABC[source]
 Bases:
objectHelper class that provides a standard way to create an ABC using inheritance.
- class ffcx.element_interface.BaseElement[source]
 Bases:
abc.ABCAn abstract element class.
- abstract property cell_type
 Basix cell type used to initialise the element.
- abstract property dim: int
 Number of DOFs the element has.
- abstract property discontinuous: bool
 True if the discontinuous version of the element is used.
- abstract property dpc_variant
 Basix DPC variant used to initialise the element.
- abstract property element_family
 Basix element family used to initialise the element.
- property element_type
 Element type.
- abstract property entity_closure_dofs
 DOF numbers associated with the closure of each entity.
- abstract property entity_dofs
 DOF numbers associated with each entity.
- abstract property family_name: str
 Family name of the element.
- abstract get_component_element(flat_component: int) tuple[BaseElement, int, int][source]
 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
- property is_custom_element: bool
 True if the element is a custom Basix element.
- abstract property lagrange_variant
 Basix Lagrange variant used to initialise the element.
- abstract property num_entity_closure_dofs
 Number of DOFs associated with the closure of each entity.
- abstract property num_entity_dofs
 Number of DOFs associated with each entity.
- abstract property num_global_support_dofs
 
- abstract property reference_geometry
 Geometry of the reference element.
- abstract property reference_topology
 Topology of the reference element.
- abstract tabulate(nderivs: int, points: numpy.ndarray)[source]
 Tabulate the basis functions of the element.
- Parameters
 nderivs – Number of derivatives to tabulate.
points – Points to tabulate at
- Returns
 Tabulated basis functions
- abstract property value_shape: Tuple[int, ...]
 Value shape of the element basis function.
Note
For scalar elements,
(1,)is returned. This is different from Basix where the value shape for scalar elements is(,).
- abstract property value_size: int
 Value size of the element.
Equal to
numpy.prod(value_shape).
- class ffcx.element_interface.BasixElement(element)[source]
 Bases:
ffcx.element_interface.BaseElementAn element defined by Basix.
- property cell_type
 Basix cell type used to initialise the element.
- property dim
 Number of DOFs the element has.
- property discontinuous
 True if the discontinuous version of the element is used.
- property dpc_variant
 Basix DPC variant used to initialise the element.
- property element_family
 Basix element family used to initialise the element.
- property element_type: str
 Element type.
- property entity_closure_dofs
 DOF numbers associated with the closure of each entity.
- property entity_dofs
 DOF numbers associated with each entity.
- property family_name
 Family name of the element.
- get_component_element(flat_component)[source]
 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
- property is_custom_element: bool
 True if the element is a custom Basix element.
- property lagrange_variant
 Basix Lagrange variant used to initialise the element.
- property num_entity_closure_dofs
 Number of DOFs associated with the closure of each entity.
- property num_entity_dofs
 Number of DOFs associated with each entity.
- property num_global_support_dofs
 
- property reference_geometry
 Geometry of the reference element.
- property reference_topology
 Topology of the reference element.
- tabulate(nderivs, points)[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 value_shape
 Get the value shape of the element.
- property value_size
 Value size of the element.
Equal to
numpy.prod(value_shape).
- class ffcx.element_interface.BlockedElement(sub_element, block_size, block_shape=None)[source]
 Bases:
ffcx.element_interface.BaseElementAn element with a block size that contains multiple copies of a sub element.
- property cell_type
 Basix cell type used to initialise the element.
- property dim
 Number of DOFs the element has.
- property discontinuous
 True if the discontinuous version of the element is used.
- property dpc_variant
 Basix DPC variant used to initialise the element.
- property element_family
 Basix element family used to initialise the element.
- property element_type
 Element type.
- property entity_closure_dofs
 DOF numbers associated with the closure of each entity.
- property entity_dofs
 DOF numbers associated with each entity.
- property family_name
 Family name of the element.
- get_component_element(flat_component)[source]
 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
- property lagrange_variant
 Basix Lagrange variant used to initialise the element.
- property num_entity_closure_dofs
 Number of DOFs associated with the closure of each entity.
- property num_entity_dofs
 Number of DOFs associated with each entity.
- property num_global_support_dofs
 
- property reference_geometry
 Geometry of the reference element.
- property reference_topology
 Topology of the reference element.
- tabulate(nderivs, points)[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 value_shape
 Value shape of the element basis function.
Note
For scalar elements,
(1,)is returned. This is different from Basix where the value shape for scalar elements is(,).
- property value_size
 Value size of the element.
Equal to
numpy.prod(value_shape).
- class ffcx.element_interface.ComponentElement(element, component)[source]
 Bases:
ffcx.element_interface.BaseElementAn element representing one component of a BasixElement.
- property cell_type
 Basix cell type used to initialise the element.
- property dim
 Number of DOFs the element has.
- property discontinuous
 True if the discontinuous version of the element is used.
- property dpc_variant
 Basix DPC variant used to initialise the element.
- property element_family
 Basix element family used to initialise the element.
- property entity_closure_dofs
 DOF numbers associated with the closure of each entity.
- property entity_dofs
 DOF numbers associated with each entity.
- property family_name: str
 Family name of the element.
- get_component_element(flat_component)[source]
 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
- property lagrange_variant
 Basix Lagrange variant used to initialise the element.
- property num_entity_closure_dofs
 Number of DOFs associated with the closure of each entity.
- property num_entity_dofs
 Number of DOFs associated with each entity.
- property num_global_support_dofs
 
- property reference_geometry
 Geometry of the reference element.
- property reference_topology
 Topology of the reference element.
- tabulate(nderivs, points)[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 value_shape
 Value shape of the element basis function.
Note
For scalar elements,
(1,)is returned. This is different from Basix where the value shape for scalar elements is(,).
- property value_size
 Value size of the element.
Equal to
numpy.prod(value_shape).
- class ffcx.element_interface.MixedElement(sub_elements)[source]
 Bases:
ffcx.element_interface.BaseElementA mixed element that combines two or more elements.
- property cell_type
 Basix cell type used to initialise the element.
- property dim
 Number of DOFs the element has.
- property discontinuous
 True if the discontinuous version of the element is used.
- property dpc_variant
 Basix DPC variant used to initialise the element.
- property element_family
 Basix element family used to initialise the element.
- property element_type: str
 Get the element type.
- property entity_closure_dofs
 DOF numbers associated with the closure of each entity.
- property entity_dofs
 DOF numbers associated with each entity.
- property family_name
 Family name of the element.
- get_component_element(flat_component)[source]
 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
- property lagrange_variant
 Basix Lagrange variant used to initialise the element.
- property num_entity_closure_dofs
 Number of DOFs associated with the closure of each entity.
- property num_entity_dofs
 Number of DOFs associated with each entity.
- property num_global_support_dofs
 
- property reference_geometry
 Geometry of the reference element.
- property reference_topology
 Topology of the reference element.
- tabulate(nderivs, points)[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 value_shape
 Value shape of the element basis function.
Note
For scalar elements,
(1,)is returned. This is different from Basix where the value shape for scalar elements is(,).
- property value_size
 Value size of the element.
Equal to
numpy.prod(value_shape).
- class ffcx.element_interface.QuadratureElement(ufl_element)[source]
 Bases:
ffcx.element_interface.BaseElementA quadrature element.
- property cell_type: None
 Basix cell type used to initialise the element.
- property dim
 Number of DOFs the element has.
- property discontinuous
 True if the discontinuous version of the element is used.
- property dpc_variant
 Basix DPC variant used to initialise the element.
- property element_family
 Basix element family used to initialise the element.
- property element_type: str
 Element type.
- property entity_closure_dofs
 DOF numbers associated with the closure of each entity.
- property entity_dofs
 DOF numbers associated with each entity.
- property family_name
 Family name of the element.
- get_component_element(flat_component)[source]
 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
- property lagrange_variant
 Basix Lagrange variant used to initialise the element.
- property num_entity_closure_dofs
 Number of DOFs associated with the closure of each entity.
- property num_entity_dofs
 Number of DOFs associated with each entity.
- property num_global_support_dofs
 
- property reference_geometry
 Geometry of the reference element.
- property reference_topology
 Topology of the reference element.
- tabulate(nderivs, points)[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 value_shape
 Value shape of the element basis function.
Note
For scalar elements,
(1,)is returned. This is different from Basix where the value shape for scalar elements is(,).
- property value_size
 Value size of the element.
Equal to
numpy.prod(value_shape).
- ffcx.element_interface.abstractmethod(funcobj)[source]
 A decorator indicating abstract methods.
Requires that the metaclass is ABCMeta or derived from it. A class that has a metaclass derived from ABCMeta cannot be instantiated unless all of its abstract methods are overridden. The abstract methods can be called using any of the normal ‘super’ call mechanisms. abstractmethod() may be used to declare abstract methods for properties and descriptors.
Usage:
- class C(metaclass=ABCMeta):
 @abstractmethod def my_abstract_method(self, …):
…
- ffcx.element_interface.create_basix_element(family_type, cell_type, degree, variant_info, discontinuous)[source]
 Create a basix element.
- ffcx.element_interface.create_element(element: ufl.finiteelement.finiteelementbase.FiniteElementBase) ffcx.element_interface.BaseElement[source]
 Create an FFCx element from a UFL element.
- Parameters
 element – A UFL finite element
- Returns
 A FFCx finite element