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

basix_cell_from_string(string)

Convert a string to a Basix CellType.

compute_ir(analysis, object_names, prefix, ...)

Compute intermediate representation.

Classes

DataIR(integrals, forms, expressions)

Intermediate representation of data.

ExpressionIR(expression, ...)

Intermediate representation of a DOLFINx Expression.

FormIR(id, name, signature, rank, ...)

Intermediate representation of a form.

IntegralIR(expression, rank, ...)

Intermediate representation of an integral.

QuadratureIR(cell_shape, points, weights)

Intermediate representation of a quadrature rule.

class ffcx.ir.representation.DataIR(integrals: list[IntegralIR], forms: list[FormIR], expressions: list[ExpressionIR])[source]#

Bases: NamedTuple

Intermediate representation of data.

Create new instance of DataIR(integrals, forms, expressions)

expressions: list[ExpressionIR]#

Alias for field number 2

forms: list[FormIR]#

Alias for field number 1

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)[source]#

Bases: NamedTuple

Intermediate representation of a DOLFINx Expression.

Create new instance of ExpressionIR(expression, original_coefficient_positions, coefficient_names, constant_names, name_from_uflfile)

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

name_from_uflfile: str#

Alias for field number 4

original_coefficient_positions: list[int]#

Alias for field number 1

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: NamedTuple

Intermediate 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)[source]#

Bases: NamedTuple

Intermediate representation of an integral.

Create new instance of IntegralIR(expression, rank, enabled_coefficients, part)

enabled_coefficients: list[bool]#

Alias for field number 2

expression: CommonExpressionIR#

Alias for field number 0

part: TensorPart#

Alias for field number 3

rank: int#

Alias for field number 1

class ffcx.ir.representation.QuadratureIR(cell_shape: str, points: npt.NDArray[np.float64], weights: npt.NDArray[np.float64])[source]#

Bases: NamedTuple

Intermediate representation of a quadrature rule.

Create new instance of QuadratureIR(cell_shape, points, weights)

cell_shape: str#

Alias for field number 0

points: ndarray[tuple[Any, ...], dtype[float64]]#

Alias for field number 1

weights: ndarray[tuple[Any, ...], dtype[float64]]#

Alias for field number 2

ffcx.ir.representation.basix_cell_from_string(string: str) CellType[source]#

Convert a string to a Basix CellType.

ffcx.ir.representation.compute_ir(analysis: UFLData, object_names: dict[int, str], prefix: str, options: dict[str, DTypeLike | int | float | bool], visualise: bool) DataIR[source]#

Compute intermediate representation.