ffcx.ir.representation¶
Compiler stage 2: Code representation.
Module computes intermediate representations of forms, elements and dofmaps. 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
|
Create new instance of CustomElementIR(cell_type, value_shape, wcoeffs, x, M, map_type, sobolev_space, interpolation_nderivs, discontinuous, highest_complete_degree, highest_degree) |
|
Create new instance of DataIR(elements, dofmaps, integrals, forms, expressions) |
|
Create new instance of DofMapIR(id, name, signature, num_global_support_dofs, num_element_support_dofs, entity_dofs, num_entity_dofs, entity_closure_dofs, num_entity_closure_dofs, num_sub_dofmaps, sub_dofmaps, block_size) |
|
Create new instance of ElementIR(id, name, signature, cell_shape, topological_dimension, geometric_dimension, space_dimension, value_shape, reference_value_shape, degree, family, num_sub_elements, block_size, sub_elements, element_type, entity_dofs, lagrange_variant, dpc_variant, basix_family, basix_cell, discontinuous, custom_element) |
|
Create new instance of ExpressionIR(name, element_dimensions, options, unique_tables, unique_table_types, integrand, coefficient_numbering, coefficient_offsets, integral_type, entitytype, tensor_shape, expression_shape, original_constant_offsets, points, coefficient_names, constant_names, needs_facet_permutations, function_spaces, name_from_uflfile, original_coefficient_positions) |
|
Create new instance of FormIR(id, name, signature, rank, num_coefficients, num_constants, name_from_uflfile, function_spaces, original_coefficient_position, coefficient_names, constant_names, finite_elements, dofmaps, integral_names, subdomain_ids) |
|
Create new instance of IntegralIR(integral_type, subdomain_id, rank, geometric_dimension, topological_dimension, entitytype, num_facets, num_vertices, enabled_coefficients, element_dimensions, element_ids, tensor_shape, coefficient_numbering, coefficient_offsets, original_constant_offsets, options, cell_shape, unique_tables, unique_table_types, integrand, name, precision, needs_facet_permutations, coordinate_element) |
- class ffcx.ir.representation.CustomElementIR(cell_type, value_shape, wcoeffs, x, M, map_type, sobolev_space, interpolation_nderivs, discontinuous, highest_complete_degree, highest_degree)[source]¶
Bases:
tuple
Create new instance of CustomElementIR(cell_type, value_shape, wcoeffs, x, M, map_type, sobolev_space, interpolation_nderivs, discontinuous, highest_complete_degree, highest_degree)
- M: List[List[ndarray[Any, dtype[float64]]]]¶
Alias for field number 4
- cell_type: CellType¶
Alias for field number 0
- discontinuous: bool¶
Alias for field number 8
- highest_complete_degree: int¶
Alias for field number 9
- highest_degree: int¶
Alias for field number 10
- interpolation_nderivs: int¶
Alias for field number 7
- map_type: MapType¶
Alias for field number 5
- sobolev_space: SobolevSpace¶
Alias for field number 6
- value_shape: Tuple[int, ...]¶
Alias for field number 1
- wcoeffs: ndarray[Any, dtype[float64]]¶
Alias for field number 2
- x: List[List[ndarray[Any, dtype[float64]]]]¶
Alias for field number 3
- class ffcx.ir.representation.DataIR(elements, dofmaps, integrals, forms, expressions)[source]¶
Bases:
tuple
Create new instance of DataIR(elements, dofmaps, integrals, forms, expressions)
- expressions: List[ExpressionIR]¶
Alias for field number 4
- integrals: List[IntegralIR]¶
Alias for field number 2
- class ffcx.ir.representation.DofMapIR(id, name, signature, num_global_support_dofs, num_element_support_dofs, entity_dofs, num_entity_dofs, entity_closure_dofs, num_entity_closure_dofs, num_sub_dofmaps, sub_dofmaps, block_size)[source]¶
Bases:
tuple
Create new instance of DofMapIR(id, name, signature, num_global_support_dofs, num_element_support_dofs, entity_dofs, num_entity_dofs, entity_closure_dofs, num_entity_closure_dofs, num_sub_dofmaps, sub_dofmaps, block_size)
- block_size: int¶
Alias for field number 11
- entity_closure_dofs: List[List[List[int]]]¶
Alias for field number 7
- entity_dofs: List[List[List[int]]]¶
Alias for field number 5
- id: int¶
Alias for field number 0
- name: str¶
Alias for field number 1
- num_element_support_dofs: int¶
Alias for field number 4
- num_entity_closure_dofs: List[List[int]]¶
Alias for field number 8
- num_entity_dofs: List[List[int]]¶
Alias for field number 6
- num_global_support_dofs: int¶
Alias for field number 3
- num_sub_dofmaps: int¶
Alias for field number 9
- signature: str¶
Alias for field number 2
- sub_dofmaps: List[str]¶
Alias for field number 10
- class ffcx.ir.representation.ElementIR(id, name, signature, cell_shape, topological_dimension, geometric_dimension, space_dimension, value_shape, reference_value_shape, degree, family, num_sub_elements, block_size, sub_elements, element_type, entity_dofs, lagrange_variant, dpc_variant, basix_family, basix_cell, discontinuous, custom_element)[source]¶
Bases:
tuple
Create new instance of ElementIR(id, name, signature, cell_shape, topological_dimension, geometric_dimension, space_dimension, value_shape, reference_value_shape, degree, family, num_sub_elements, block_size, sub_elements, element_type, entity_dofs, lagrange_variant, dpc_variant, basix_family, basix_cell, discontinuous, custom_element)
- basix_cell: CellType¶
Alias for field number 19
- basix_family: ElementFamily¶
Alias for field number 18
- block_size: int¶
Alias for field number 12
- cell_shape: str¶
Alias for field number 3
- custom_element: CustomElementIR¶
Alias for field number 21
- degree: int¶
Alias for field number 9
- discontinuous: bool¶
Alias for field number 20
- dpc_variant: DPCVariant¶
Alias for field number 17
- element_type: str¶
Alias for field number 14
- entity_dofs: List[List[List[int]]]¶
Alias for field number 15
- family: str¶
Alias for field number 10
- geometric_dimension: int¶
Alias for field number 5
- id: int¶
Alias for field number 0
- lagrange_variant: LagrangeVariant¶
Alias for field number 16
- name: str¶
Alias for field number 1
- num_sub_elements: int¶
Alias for field number 11
- reference_value_shape: Tuple[int, ...]¶
Alias for field number 8
- signature: str¶
Alias for field number 2
- space_dimension: int¶
Alias for field number 6
- sub_elements: List[str]¶
Alias for field number 13
- topological_dimension: int¶
Alias for field number 4
- value_shape: Tuple[int, ...]¶
Alias for field number 7
- class ffcx.ir.representation.ExpressionIR(name, element_dimensions, options, unique_tables, unique_table_types, integrand, coefficient_numbering, coefficient_offsets, integral_type, entitytype, tensor_shape, expression_shape, original_constant_offsets, points, coefficient_names, constant_names, needs_facet_permutations, function_spaces, name_from_uflfile, original_coefficient_positions)[source]¶
Bases:
tuple
Create new instance of ExpressionIR(name, element_dimensions, options, unique_tables, unique_table_types, integrand, coefficient_numbering, coefficient_offsets, integral_type, entitytype, tensor_shape, expression_shape, original_constant_offsets, points, coefficient_names, constant_names, needs_facet_permutations, function_spaces, name_from_uflfile, original_coefficient_positions)
- coefficient_names: List[str]¶
Alias for field number 14
- coefficient_numbering: Dict[Coefficient, int]¶
Alias for field number 6
- coefficient_offsets: Dict[Coefficient, int]¶
Alias for field number 7
- constant_names: List[str]¶
Alias for field number 15
- element_dimensions: Dict[FiniteElementBase, int]¶
Alias for field number 1
- entitytype: str¶
Alias for field number 9
- expression_shape: List[int]¶
Alias for field number 11
- function_spaces: Dict[str, Tuple[str, str, str, int, CellType, LagrangeVariant]]¶
Alias for field number 17
- integral_type: str¶
Alias for field number 8
- integrand: Dict[QuadratureRule, dict]¶
Alias for field number 5
- name: str¶
Alias for field number 0
- name_from_uflfile: str¶
Alias for field number 18
- needs_facet_permutations: bool¶
Alias for field number 16
- options: dict¶
Alias for field number 2
- original_coefficient_positions: List[int]¶
Alias for field number 19
- original_constant_offsets: Dict[Constant, int]¶
Alias for field number 12
- points: ndarray[Any, dtype[float64]]¶
Alias for field number 13
- tensor_shape: List[int]¶
Alias for field number 10
- unique_table_types: Dict[str, str]¶
Alias for field number 4
- unique_tables: Dict[str, ndarray[Any, dtype[float64]]]¶
Alias for field number 3
- class ffcx.ir.representation.FormIR(id, name, signature, rank, num_coefficients, num_constants, name_from_uflfile, function_spaces, original_coefficient_position, coefficient_names, constant_names, finite_elements, dofmaps, integral_names, subdomain_ids)[source]¶
Bases:
tuple
Create new instance of FormIR(id, name, signature, rank, num_coefficients, num_constants, name_from_uflfile, function_spaces, original_coefficient_position, coefficient_names, constant_names, finite_elements, dofmaps, integral_names, subdomain_ids)
- coefficient_names: List[str]¶
Alias for field number 9
- constant_names: List[str]¶
Alias for field number 10
- dofmaps: List[str]¶
Alias for field number 12
- finite_elements: List[str]¶
Alias for field number 11
- function_spaces: Dict[str, Tuple[str, str, str, int, CellType, LagrangeVariant]]¶
Alias for field number 7
- id: int¶
Alias for field number 0
- 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 6
- num_coefficients: int¶
Alias for field number 4
- num_constants: int¶
Alias for field number 5
- original_coefficient_position: List[int]¶
Alias for field number 8
- rank: int¶
Alias for field number 3
- signature: str¶
Alias for field number 2
- subdomain_ids: Dict[str, List[int]]¶
Alias for field number 14
- class ffcx.ir.representation.Integral(integrand, integral_type, domain, subdomain_id, metadata, subdomain_data)[source]¶
Bases:
object
An integral over a single domain.
- 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(integral_type, subdomain_id, rank, geometric_dimension, topological_dimension, entitytype, num_facets, num_vertices, enabled_coefficients, element_dimensions, element_ids, tensor_shape, coefficient_numbering, coefficient_offsets, original_constant_offsets, options, cell_shape, unique_tables, unique_table_types, integrand, name, precision, needs_facet_permutations, coordinate_element)[source]¶
Bases:
tuple
Create new instance of IntegralIR(integral_type, subdomain_id, rank, geometric_dimension, topological_dimension, entitytype, num_facets, num_vertices, enabled_coefficients, element_dimensions, element_ids, tensor_shape, coefficient_numbering, coefficient_offsets, original_constant_offsets, options, cell_shape, unique_tables, unique_table_types, integrand, name, precision, needs_facet_permutations, coordinate_element)
- cell_shape: str¶
Alias for field number 16
- coefficient_numbering: Dict[Coefficient, int]¶
Alias for field number 12
- coefficient_offsets: Dict[Coefficient, int]¶
Alias for field number 13
- coordinate_element: str¶
Alias for field number 23
- element_dimensions: Dict[FiniteElementBase, int]¶
Alias for field number 9
- element_ids: Dict[FiniteElementBase, int]¶
Alias for field number 10
- enabled_coefficients: List[bool]¶
Alias for field number 8
- entitytype: str¶
Alias for field number 5
- geometric_dimension: int¶
Alias for field number 3
- integral_type: str¶
Alias for field number 0
- integrand: Dict[QuadratureRule, dict]¶
Alias for field number 19
- name: str¶
Alias for field number 20
- needs_facet_permutations: bool¶
Alias for field number 22
- num_facets: int¶
Alias for field number 6
- num_vertices: int¶
Alias for field number 7
- options: dict¶
Alias for field number 15
- original_constant_offsets: Dict[Constant, int]¶
Alias for field number 14
- precision: int¶
Alias for field number 21
- rank: int¶
Alias for field number 2
- subdomain_id: str | Tuple[int, ...] | int¶
Alias for field number 1
- tensor_shape: List[int]¶
Alias for field number 11
- topological_dimension: int¶
Alias for field number 4
- unique_table_types: Dict[str, str]¶
Alias for field number 18
- unique_tables: Dict[str, ndarray[Any, dtype[float64]]]¶
Alias for field number 17
- class ffcx.ir.representation.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.ir.representation.compute_integral_ir(cell, integral_type, entitytype, integrands, argument_shape, p, visualise)[source]¶
- ffcx.ir.representation.compute_ir(analysis: UFLData, object_names, prefix, options, visualise)[source]¶
Compute intermediate representation.
- ffcx.ir.representation.convert_element(element: FiniteElementBase) _BasixElementBase [source]¶
Convert and element to a FFCx element.