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, scalar_type)

Analyze ufl object(s).

Classes

UFLData(form_data, unique_elements, ...)

UFL data.

class ffcx.analysis.UFLData(form_data: tuple[ufl.algorithms.formdata.FormData, ...], unique_elements: list[basix.ufl._ElementBase], element_numbers: dict[basix.ufl._ElementBase, int], unique_coordinate_elements: list[basix.ufl._ElementBase], expressions: list[tuple[ufl.core.expr.Expr, npt.NDArray[np.float64], ufl.core.expr.Expr]])[source]

Bases: NamedTuple

UFL data.

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

element_numbers: dict[_ElementBase, 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[_ElementBase]

Alias for field number 3

unique_elements: list[_ElementBase]

Alias for field number 1

ffcx.analysis.analyze_ufl_objects(ufl_objects: list[Form | AbstractFiniteElement | Mesh | tuple[Expr, ndarray[Any, dtype[floating]]]], scalar_type: dtype[Any] | None | type[Any] | _SupportsDType[dtype[Any]] | str | tuple[Any, int] | tuple[Any, SupportsIndex | Sequence[SupportsIndex]] | list[Any] | _DTypeDict | tuple[Any, Any]) UFLData[source]

Analyze ufl object(s).

Parameters:
  • ufl_objects – UFL objects

  • scalar_type – Scalar type that should be used for the analysis

Returns:

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

Return type:

A data structure holding