ffcx.ir.representation#
Compiler stage 2: Code representation.
Module computes intermediate representations of forms. For each UFC function, we extract the data needed for code generation at a later stage.
The representation should conform strictly to the naming and order of functions in UFC. Thus, for code generation of the function “foo”, one should only need to use the data stored in the intermediate representation under the key “foo”.
Functions
|
Convert a string to a Basix CellType. |
|
Compute intermediate representation. |
Classes
|
Intermediate representation of data. |
|
Intermediate representation of a DOLFINx Expression. |
|
Intermediate representation of a form. |
|
Intermediate representation of an integral. |
|
Intermediate representation of a quadrature rule. |
|
Intermediate representation of a call to a sub-kernel. |
- class ffcx.ir.representation.DataIR(integrals: list[IntegralIR], forms: list[FormIR], expressions: list[ExpressionIR])[source]#
Bases:
NamedTupleIntermediate representation of data.
Create new instance of DataIR(integrals, forms, expressions)
- expressions: list[ExpressionIR]#
Alias for field number 2
- integrals: list[IntegralIR]#
Alias for field number 0
- class ffcx.ir.representation.ExpressionIR(expression: CommonExpressionIR, original_coefficient_positions: list[int], coefficient_names: list[str], constant_names: list[str], name_from_uflfile: str, sub_kernels: list[SubKernelIR], is_sub_kernel: bool)[source]#
Bases:
NamedTupleIntermediate representation of a DOLFINx Expression.
Create new instance of ExpressionIR(expression, original_coefficient_positions, coefficient_names, constant_names, name_from_uflfile, sub_kernels, is_sub_kernel)
- coefficient_names: list[str]#
Alias for field number 2
- constant_names: list[str]#
Alias for field number 3
- expression: CommonExpressionIR#
Alias for field number 0
- is_sub_kernel: bool#
Whether it evaluates an interpolation for the kernels that hold it, rather than being an expression asked for. Such a kernel is internal to the generated code, and not exported as an expression.
- name_from_uflfile: str#
Alias for field number 4
- original_coefficient_positions: list[int]#
Alias for field number 1
- sub_kernels: list[SubKernelIR]#
The sub-kernels the kernel calls, see IntegralIR
- class ffcx.ir.representation.FormIR(id: int, name: str, signature: str, rank: int, num_coefficients: int, name_from_uflfile: str, original_coefficient_positions: list[int], coefficient_names: list[str], num_constants: int, constant_ranks: list[int], constant_shapes: list[list[int]], constant_names: list[str], finite_element_hashes: list[int], integral_names: dict[str, list[str]], integral_domains: dict[str, list[basix.CellType]], subdomain_ids: dict[str, list[int]])[source]#
Bases:
NamedTupleIntermediate representation of a form.
Create new instance of FormIR(id, name, signature, rank, num_coefficients, name_from_uflfile, original_coefficient_positions, coefficient_names, num_constants, constant_ranks, constant_shapes, constant_names, finite_element_hashes, integral_names, integral_domains, subdomain_ids)
- coefficient_names: list[str]#
Alias for field number 7
- constant_names: list[str]#
Alias for field number 11
- constant_ranks: list[int]#
Alias for field number 9
- constant_shapes: list[list[int]]#
Alias for field number 10
- finite_element_hashes: list[int]#
Alias for field number 12
- id: int#
Alias for field number 0
- integral_domains: dict[str, list[CellType]]#
Alias for field number 14
- integral_names: dict[str, list[str]]#
Alias for field number 13
- name: str#
Alias for field number 1
- name_from_uflfile: str#
Alias for field number 5
- num_coefficients: int#
Alias for field number 4
- num_constants: int#
Alias for field number 8
- original_coefficient_positions: list[int]#
Alias for field number 6
- rank: int#
Alias for field number 3
- signature: str#
Alias for field number 2
- subdomain_ids: dict[str, list[int]]#
Alias for field number 15
- class ffcx.ir.representation.IntegralIR(expression: CommonExpressionIR, rank: int, enabled_coefficients: list[bool], part: TensorPart, sub_kernels: list[SubKernelIR], kernel_name: str | None, kernel_name_is_explicit: bool)[source]#
Bases:
NamedTupleIntermediate representation of an integral.
Create new instance of IntegralIR(expression, rank, enabled_coefficients, part, sub_kernels, kernel_name, kernel_name_is_explicit)
- enabled_coefficients: list[bool]#
Alias for field number 2
- expression: CommonExpressionIR#
Alias for field number 0
- kernel_name: str | None#
Alias for field number 5
- kernel_name_is_explicit: bool#
Alias for field number 6
- part: TensorPart#
Alias for field number 3
- rank: int#
Alias for field number 1
- sub_kernels: list[SubKernelIR]#
The sub-kernels the kernel calls, for its proxy coefficients and the tables it builds for each cell
- class ffcx.ir.representation.QuadratureIR(cell_shape: str, points: npt.NDArray[np.float64], weights: npt.NDArray[np.float64])[source]#
Bases:
NamedTupleIntermediate representation of a quadrature rule.
Create new instance of QuadratureIR(cell_shape, points, weights)
- cell_shape: str#
Alias for field number 0
- points: NDArray[float64]#
Alias for field number 1
- weights: NDArray[float64]#
Alias for field number 2
- class ffcx.ir.representation.SubKernelIR(target: ProxyCoefficient | ufl.Interpolate, name: str, coefficients: list[ufl.Coefficient], constants: list[ufl.Constant], shape: tuple[int, ...])[source]#
Bases:
NamedTupleIntermediate representation of a call to a sub-kernel.
The kernel is passed the coefficients and constants it reads packed into contiguous arrays. The sub-kernel of an interpolation evaluates the interpolated expression at the interpolation points of the target element, and writes
[point][component][dof]..., with one dof axis for each argument the expression is linear in.Create new instance of SubKernelIR(target, name, coefficients, constants, shape)
- coefficients: list[Coefficient]#
The coefficients the kernel reads, in the order it reads them
- constants: list[Constant]#
The constants the kernel reads, in the order it reads them
- name: str#
Name of the sub-kernel, which each backend names its function from
- shape: tuple[int, ...]#
the number of points, the reference value size and the number of dofs of each argument
- Type:
Shape of the values the kernel writes
- target: ProxyCoefficient | Interpolate#
the degrees of freedom of a proxy coefficient, or the table of an interpolation built for each cell
- Type:
What the sub-kernel builds