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 ir_custom_element(cell_type, degree, value_shape, wcoeffs, x, M, map_type, discontinuous, highest_complete_degree) |
|
Create new instance of ir_data(elements, dofmaps, integrals, forms, expressions) |
|
Create new instance of ir_dofmap(id, name, signature, num_global_support_dofs, num_element_support_dofs, num_entity_dofs, tabulate_entity_dofs, num_entity_closure_dofs, tabulate_entity_closure_dofs, num_sub_dofmaps, sub_dofmaps, block_size) |
|
Create new instance of ir_element(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 ir_expression(name, element_dimensions, params, unique_tables, unique_table_types, integrand, table_dofmaps, coefficient_numbering, coefficient_offsets, integral_type, entitytype, tensor_shape, expression_shape, original_constant_offsets, original_coefficient_positions, points, coefficient_names, constant_names, needs_facet_permutations, function_spaces, name_from_uflfile) |
|
Create new instance of ir_form(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 ir_integral(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, params, cell_shape, unique_tables, unique_table_types, table_dofmaps, integrand, name, precision, needs_facet_permutations, coordinate_element) |
- 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.
<a = Integral instance> b = a.reconstruct(expand_compounds(a.integrand())) c = a.reconstruct(metadata={‘quadrature_degree’:2})
- ffcx.ir.representation.compute_integral_ir(cell, integral_type, entitytype, integrands, argument_shape, p, visualise)[source]
- ffcx.ir.representation.compute_ir(analysis, object_names, prefix, parameters, visualise)[source]
Compute intermediate representation.
- ffcx.ir.representation.create_element(element: ufl.finiteelement.finiteelementbase.FiniteElementBase) ffcx.element_interface.BaseElement [source]
Create an FFCx element from a UFL element.
- Parameters
element – A UFL finite element
- Returns
A FFCx finite element
- ffcx.ir.representation.create_quadrature_points_and_weights(integral_type, cell, degree, rule)[source]
Create quadrature rule and return points and weights.
- class ffcx.ir.representation.ir_custom_element(cell_type, degree, value_shape, wcoeffs, x, M, map_type, discontinuous, highest_complete_degree)
Bases:
tuple
Create new instance of ir_custom_element(cell_type, degree, value_shape, wcoeffs, x, M, map_type, discontinuous, highest_complete_degree)
- M
Alias for field number 5
- cell_type
Alias for field number 0
- degree
Alias for field number 1
- discontinuous
Alias for field number 7
- highest_complete_degree
Alias for field number 8
- map_type
Alias for field number 6
- value_shape
Alias for field number 2
- wcoeffs
Alias for field number 3
- x
Alias for field number 4
- class ffcx.ir.representation.ir_data(elements, dofmaps, integrals, forms, expressions)
Bases:
tuple
Create new instance of ir_data(elements, dofmaps, integrals, forms, expressions)
- dofmaps
Alias for field number 1
- elements
Alias for field number 0
- expressions
Alias for field number 4
- forms
Alias for field number 3
- integrals
Alias for field number 2
- class ffcx.ir.representation.ir_dofmap(id, name, signature, num_global_support_dofs, num_element_support_dofs, num_entity_dofs, tabulate_entity_dofs, num_entity_closure_dofs, tabulate_entity_closure_dofs, num_sub_dofmaps, sub_dofmaps, block_size)
Bases:
tuple
Create new instance of ir_dofmap(id, name, signature, num_global_support_dofs, num_element_support_dofs, num_entity_dofs, tabulate_entity_dofs, num_entity_closure_dofs, tabulate_entity_closure_dofs, num_sub_dofmaps, sub_dofmaps, block_size)
- block_size
Alias for field number 11
- id
Alias for field number 0
- name
Alias for field number 1
- num_element_support_dofs
Alias for field number 4
- num_entity_closure_dofs
Alias for field number 7
- num_entity_dofs
Alias for field number 5
- num_global_support_dofs
Alias for field number 3
- num_sub_dofmaps
Alias for field number 9
- signature
Alias for field number 2
- sub_dofmaps
Alias for field number 10
- tabulate_entity_closure_dofs
Alias for field number 8
- tabulate_entity_dofs
Alias for field number 6
- class ffcx.ir.representation.ir_element(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)
Bases:
tuple
Create new instance of ir_element(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
Alias for field number 19
- basix_family
Alias for field number 18
- block_size
Alias for field number 12
- cell_shape
Alias for field number 3
- custom_element
Alias for field number 21
- degree
Alias for field number 9
- discontinuous
Alias for field number 20
- dpc_variant
Alias for field number 17
- element_type
Alias for field number 14
- entity_dofs
Alias for field number 15
- family
Alias for field number 10
- geometric_dimension
Alias for field number 5
- id
Alias for field number 0
- lagrange_variant
Alias for field number 16
- name
Alias for field number 1
- num_sub_elements
Alias for field number 11
- reference_value_shape
Alias for field number 8
- signature
Alias for field number 2
- space_dimension
Alias for field number 6
- sub_elements
Alias for field number 13
- topological_dimension
Alias for field number 4
- value_shape
Alias for field number 7
- class ffcx.ir.representation.ir_expression(name, element_dimensions, params, unique_tables, unique_table_types, integrand, table_dofmaps, coefficient_numbering, coefficient_offsets, integral_type, entitytype, tensor_shape, expression_shape, original_constant_offsets, original_coefficient_positions, points, coefficient_names, constant_names, needs_facet_permutations, function_spaces, name_from_uflfile)
Bases:
tuple
Create new instance of ir_expression(name, element_dimensions, params, unique_tables, unique_table_types, integrand, table_dofmaps, coefficient_numbering, coefficient_offsets, integral_type, entitytype, tensor_shape, expression_shape, original_constant_offsets, original_coefficient_positions, points, coefficient_names, constant_names, needs_facet_permutations, function_spaces, name_from_uflfile)
- coefficient_names
Alias for field number 16
- coefficient_numbering
Alias for field number 7
- coefficient_offsets
Alias for field number 8
- constant_names
Alias for field number 17
- element_dimensions
Alias for field number 1
- entitytype
Alias for field number 10
- expression_shape
Alias for field number 12
- function_spaces
Alias for field number 19
- integral_type
Alias for field number 9
- integrand
Alias for field number 5
- name
Alias for field number 0
- name_from_uflfile
Alias for field number 20
- needs_facet_permutations
Alias for field number 18
- original_coefficient_positions
Alias for field number 14
- original_constant_offsets
Alias for field number 13
- params
Alias for field number 2
- points
Alias for field number 15
- table_dofmaps
Alias for field number 6
- tensor_shape
Alias for field number 11
- unique_table_types
Alias for field number 4
- unique_tables
Alias for field number 3
- class ffcx.ir.representation.ir_form(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)
Bases:
tuple
Create new instance of ir_form(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
Alias for field number 9
- constant_names
Alias for field number 10
- dofmaps
Alias for field number 12
- finite_elements
Alias for field number 11
- function_spaces
Alias for field number 7
- id
Alias for field number 0
- integral_names
Alias for field number 13
- name
Alias for field number 1
- name_from_uflfile
Alias for field number 6
- num_coefficients
Alias for field number 4
- num_constants
Alias for field number 5
- original_coefficient_position
Alias for field number 8
- rank
Alias for field number 3
- signature
Alias for field number 2
- subdomain_ids
Alias for field number 14
- class ffcx.ir.representation.ir_integral(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, params, cell_shape, unique_tables, unique_table_types, table_dofmaps, integrand, name, precision, needs_facet_permutations, coordinate_element)
Bases:
tuple
Create new instance of ir_integral(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, params, cell_shape, unique_tables, unique_table_types, table_dofmaps, integrand, name, precision, needs_facet_permutations, coordinate_element)
- cell_shape
Alias for field number 16
- coefficient_numbering
Alias for field number 12
- coefficient_offsets
Alias for field number 13
- coordinate_element
Alias for field number 24
- element_dimensions
Alias for field number 9
- element_ids
Alias for field number 10
- enabled_coefficients
Alias for field number 8
- entitytype
Alias for field number 5
- geometric_dimension
Alias for field number 3
- integral_type
Alias for field number 0
- integrand
Alias for field number 20
- name
Alias for field number 21
- needs_facet_permutations
Alias for field number 23
- num_facets
Alias for field number 6
- num_vertices
Alias for field number 7
- original_constant_offsets
Alias for field number 14
- params
Alias for field number 15
- precision
Alias for field number 22
- rank
Alias for field number 2
- subdomain_id
Alias for field number 1
- table_dofmaps
Alias for field number 19
- tensor_shape
Alias for field number 11
- topological_dimension
Alias for field number 4
- unique_table_types
Alias for field number 18
- unique_tables
Alias for field number 17
- ffcx.ir.representation.namedtuple(typename, field_names, *, rename=False, defaults=None, module=None)[source]
Returns a new subclass of tuple with named fields.
>>> Point = namedtuple('Point', ['x', 'y']) >>> Point.__doc__ # docstring for the new class 'Point(x, y)' >>> p = Point(11, y=22) # instantiate with positional args or keywords >>> p[0] + p[1] # indexable like a plain tuple 33 >>> x, y = p # unpack like a regular tuple >>> x, y (11, 22) >>> p.x + p.y # fields also accessible by name 33 >>> d = p._asdict() # convert to a dictionary >>> d['x'] 11 >>> Point(**d) # convert from a dictionary Point(x=11, y=22) >>> p._replace(x=100) # _replace() is like str.replace() but targets named fields Point(x=100, y=22)