ffcx.analysis

Compiler stage 1: Analysis.

This module implements the analysis/preprocessing of variational forms, including automatic selection of elements, degrees and form representation type.

Functions

analyze_ufl_objects(ufl_objects, options)

Analyze ufl object(s).

Classes

UFLData(form_data, unique_elements, ...)

Create new instance of UFLData(form_data, unique_elements, element_numbers, unique_coordinate_elements, expressions)

class ffcx.analysis.QuadratureElement(cellname: str, 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')[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.analysis.UFLData(form_data, unique_elements, element_numbers, unique_coordinate_elements, expressions)[source]

Bases: tuple

Create new instance of UFLData(form_data, unique_elements, element_numbers, unique_coordinate_elements, expressions)

element_numbers: Dict[_BasixElementBase, int]

Alias for field number 2

expressions: List[Tuple[Expr, ndarray[Any, dtype[float64]], Expr]]

Alias for field number 4

form_data: Tuple[FormData, ...]

Alias for field number 0

unique_coordinate_elements: List[_BasixElementBase]

Alias for field number 3

unique_elements: List[_BasixElementBase]

Alias for field number 1

ffcx.analysis.analyze_ufl_objects(ufl_objects: List, options: Dict) UFLData[source]

Analyze ufl object(s).

Options

ufl_objects options

FFCx options. These options take priority over all other set options.

Returns a data structure holding

form_datas

Form_data objects

unique_elements

Unique elements across all forms and expressions

element_numbers

Mapping to unique numbers for all elements

unique_coordinate_elements

Unique coordinate elements across all forms and expressions

expressions

List of all expressions after post-processing, with its evaluation points and the original expression

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

Convert and element to a FFCx element.

ffcx.analysis.warn(message, category=None, stacklevel=1, source=None)

Issue a warning, or maybe ignore it or raise an exception.