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
|
Compute intermediate representation. |
Classes
|
Common-ground for IntegralIR and ExpressionIR. |
|
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. |
- class ffcx.ir.representation.CommonExpressionIR(integral_type: str, entity_type: str, tensor_shape: list[int], coefficient_numbering: dict[ufl.Coefficient, int], coefficient_offsets: dict[ufl.Coefficient, int], original_constant_offsets: dict[ufl.Constant, int], unique_tables: dict[str, npt.NDArray[np.float64]], unique_table_types: dict[str, str], integrand: dict[QuadratureRule, dict], name: str, needs_facet_permutations: bool, shape: list[int])[source]
Bases:
NamedTuple
Common-ground for IntegralIR and ExpressionIR.
Create new instance of CommonExpressionIR(integral_type, entity_type, tensor_shape, coefficient_numbering, coefficient_offsets, original_constant_offsets, unique_tables, unique_table_types, integrand, name, needs_facet_permutations, shape)
- coefficient_numbering: dict[Coefficient, int]
Alias for field number 3
- coefficient_offsets: dict[Coefficient, int]
Alias for field number 4
- entity_type: str
Alias for field number 1
- integral_type: str
Alias for field number 0
- integrand: dict[QuadratureRule, dict]
Alias for field number 8
- name: str
Alias for field number 9
- needs_facet_permutations: bool
Alias for field number 10
- original_constant_offsets: dict[Constant, int]
Alias for field number 5
- shape: list[int]
Alias for field number 11
- tensor_shape: list[int]
Alias for field number 2
- unique_table_types: dict[str, str]
Alias for field number 7
- unique_tables: dict[str, ndarray[Any, dtype[float64]]]
Alias for field number 6
- 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
- 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, num_constants: int, name_from_uflfile: str, original_coefficient_positions: list[int], coefficient_names: list[str], constant_names: list[str], finite_element_hashes: list[int], integral_names: dict[str, list[str]], 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, num_constants, name_from_uflfile, original_coefficient_positions, coefficient_names, constant_names, finite_element_hashes, integral_names, subdomain_ids)
- coefficient_names: list[str]
Alias for field number 8
- constant_names: list[str]
Alias for field number 9
- finite_element_hashes: list[int]
Alias for field number 10
- id: int
Alias for field number 0
- integral_names: dict[str, list[str]]
Alias for field number 11
- name: str
Alias for field number 1
- name_from_uflfile: str
Alias for field number 6
- num_coefficients: int
Alias for field number 4
- num_constants: int
Alias for field number 5
- original_coefficient_positions: list[int]
Alias for field number 7
- rank: int
Alias for field number 3
- signature: str
Alias for field number 2
- subdomain_ids: dict[str, list[int]]
Alias for field number 12
- class ffcx.ir.representation.Integral(integrand, integral_type, domain, subdomain_id, metadata, subdomain_data)[source]
Bases:
object
An integral over a single domain.
Initialise.
- reconstruct(integrand=None, integral_type=None, domain=None, subdomain_id=None, metadata=None, subdomain_data=None)[source]
Construct a new Integral object with some properties replaced with new values.
Example
<a = Integral instance> b = a.reconstruct(expand_compounds(a.integrand())) c = a.reconstruct(metadata={‘quadrature_degree’:2})
- class ffcx.ir.representation.IntegralIR(expression: CommonExpressionIR, rank: int, enabled_coefficients: list[bool], coordinate_element_hash: str)[source]
Bases:
NamedTuple
Intermediate representation of an integral.
Create new instance of IntegralIR(expression, rank, enabled_coefficients, coordinate_element_hash)
- coordinate_element_hash: str
Alias for field number 3
- enabled_coefficients: list[bool]
Alias for field number 2
- expression: CommonExpressionIR
Alias for field number 0
- 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[Any, dtype[float64]]
Alias for field number 1
- weights: ndarray[Any, dtype[float64]]
Alias for field number 2
- class ffcx.ir.representation.QuadratureRule(points, weights, tensor_factors=None)[source]
Bases:
object
A quadrature rule.
Initialise.
- class ffcx.ir.representation.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.ir.representation.compute_integral_ir(cell, integral_type, entity_type, integrands, argument_shape, p, visualise)[source]
Compute intermediate representation for an integral.
- ffcx.ir.representation.compute_ir(analysis: UFLData, object_names: dict[int, str], prefix: str, options: dict[str, dtype[Any] | None | type[Any] | _SupportsDType[dtype[Any]] | str | tuple[Any, int] | tuple[Any, SupportsIndex | Sequence[SupportsIndex]] | list[Any] | _DTypeDict | tuple[Any, Any] | int | float], visualise: bool) DataIR [source]
Compute intermediate representation.