ffcx.analysis

Compiler stage 1: Analysis.

This module implements the analysis/preprocessing of variational forms, including automatic selection of elements, degrees and form representation type.

Functions

analyze_ufl_objects(ufl_objects, parameters)

Analyze ufl object(s).

Classes

ufl_data(form_data, unique_elements, ...)

Create new instance of ufl_data(form_data, unique_elements, element_numbers, unique_coordinate_elements, expressions)

ffcx.analysis.analyze_ufl_objects(ufl_objects: List, parameters: Dict) ffcx.analysis.ufl_data[source]

Analyze ufl object(s).

Parameters
  • ufl_objects

  • parameters – FFCx parameters. These parameters take priority over all other set parameters.

Returns

  • form_datas – Form_data objects

  • unique_elements – Unique elements across all forms

  • element_numbers – Mapping to unique numbers for all elements

  • unique_coordinate_elements

ffcx.analysis.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)
class ffcx.analysis.ufl_data(form_data, unique_elements, element_numbers, unique_coordinate_elements, expressions)

Bases: tuple

Create new instance of ufl_data(form_data, unique_elements, element_numbers, unique_coordinate_elements, expressions)

element_numbers

Alias for field number 2

expressions

Alias for field number 4

form_data

Alias for field number 0

unique_coordinate_elements

Alias for field number 3

unique_elements

Alias for field number 1