| FENICSFORMCOMPILERX(1) | FEniCS Form Compiler X | FENICSFORMCOMPILERX(1) |
fenicsformcompilerx - FEniCS Form Compiler X Documentation
The is an experimental version of the FEniCS Form Compiler. It is developed at https://github.com/FEniCS/ffcx.
| ffcx | FEniCS Form Compiler (FFCx). |
| ffcx.__main__ | Run ffcx on a UFL file. |
| ffcx.analysis | Compiler stage 1: Analysis. |
| ffcx.compiler | Main interface for compilation of forms. |
| ffcx.element_interface | Finite element interface. |
| ffcx.formatting | Compiler stage 5: Code formatting. |
| ffcx.main | Command-line interface to FFCx. |
| ffcx.naming | Naming. |
| ffcx.codegeneration | FFCx code generation. |
| ffcx.options | Options. |
| ffcx.ir.representation | Compiler stage 2: Code representation. |
| ffcx.ir.representationutils | Utility functions for some code shared between representations. |
FEniCS Form Compiler (FFCx).
FFCx compiles finite element variational forms into C code.
NOTE:
The ffcx_options.json files are cached on the first call. Subsequent calls to this function use this cache.
Priority ordering of options from highest to lowest is:
XDG_CONFIG_HOME is ~/.config/ if the environment variable is not set.
Example ffcx_options.json file:
Run ffcx on a UFL file.
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, scalar_type) | Analyze ufl object(s). |
Classes
| UFLData(form_data, unique_elements, ...) | UFL data. |
UFL data.
Create new instance of UFLData(form_data, unique_elements, element_numbers, unique_coordinate_elements, expressions)
Main interface for compilation of forms.
Breaks the compilation into several sequential stages. The output of each stage is the input of the next stage.
This stage consists of parsing and expressing a form in the UFL form language. This stage is handled by UFL.
This stage preprocesses the UFL form and extracts form metadata. It may also perform simplifications on the form.
This stage examines the input and generates all data needed for code generation. This includes generation of finite element basis functions, extraction of data for mapping of degrees of freedom and possible precomputation of integrals. Most of the complexity of compilation is handled in this stage.
The IR is stored as a dictionary, mapping names of UFC functions to data needed for generation of the corresponding code.
This stage examines the IR and generates the actual C code for the body of each UFC function.
The code is stored as a dictionary, mapping names of UFC functions to strings containing the C code of the body of each function.
This stage examines the generated C++ code and formats it according to the UFC format, generating as output one or more .h/.c files conforming to the UFC format.
Functions
| compile_ufl_objects(ufl_objects, options[, ...]) | Generate UFC code for a given UFL objects. |
Finite element interface.
Functions
| basix_index(indices) | Get the Basix index of a derivative. |
| create_quadrature(cellname, degree, rule, ...) | Create a quadrature rule. |
| map_facet_points(points, facet, cellname) | Map points from a reference facet to a physical facet. |
| reference_cell_vertices(cellname) | Get the vertices of a reference cell. |
Compiler stage 5: Code formatting.
This module implements the formatting of UFC code from a given dictionary of generated C++ code for the body of each UFC function.
It relies on templates for UFC code available as part of the module ufcx_utils.
Functions
| format_code(code) | Format given code in UFC format. |
| write_code(code_h, code_c, prefix, output_dir) | Write code to files. |
Storage of code blocks of the form (declaration, implementation).
Blocks for integrals, forms and expressions, and start and end of file output
Create new instance of CodeBlocks(file_pre, integrals, forms, expressions, file_post)
Command-line interface to FFCx.
Parse command-line arguments and generate code from input UFL form files.
Functions
| main([args]) | Run ffcx on a UFL file. |
NOTE:
The ffcx_options.json files are cached on the first call. Subsequent calls to this function use this cache.
Priority ordering of options from highest to lowest is:
XDG_CONFIG_HOME is ~/.config/ if the environment variable is not set.
Example ffcx_options.json file:
Naming.
Functions
| compute_signature(ufl_objects, tag) | Compute the signature hash. |
| expression_name(expression, prefix) | Get expression name. |
| form_name(original_form, form_id, prefix) | Get form name. |
| integral_name(original_form, integral_type, ...) | Get integral name. |
Based on the UFL type of the objects and an additional optional ‘tag’.
FFCx code generation.
Functions
| get_include_path() | Return location of UFCx header files. |
| get_signature() | Return SHA-1 hash of the contents of ufcx.h. |
In this implementation, the value is computed on import.
Options.
Functions
| get_options([priority_options]) | Return (a copy of) the merged option values for FFCX. |
PurePath subclass that can make system calls.
Path represents a filesystem path but unlike PurePath, also offers methods to do system calls on path objects. Depending on your system, instantiating a Path will return either a PosixPath or a WindowsPath object. You can also instantiate a PosixPath or WindowsPath directly, but cannot instantiate a WindowsPath on a POSIX system or vice versa.
Construct a PurePath from one or several strings and or existing PurePath objects. The strings and path objects are combined so as to yield a canonicalized path, which is incorporated into the new PurePath object.
Use resolve() to get the canonical path to a file.
This method normally follows symlinks; to check whether a symlink exists, add the argument follow_symlinks=False.
Note the order of arguments (self, target) is the reverse of os.link’s.
The children are yielded in arbitrary order, and the special entries ‘.’ and ‘..’ are not included.
The target path may be absolute or relative. Relative paths are interpreted relative to the current working directory, not the directory of the Path object.
Returns the new Path instance pointing to the target path.
The target path may be absolute or relative. Relative paths are interpreted relative to the current working directory, not the directory of the Path object.
Returns the new Path instance pointing to the target path.
NOTE:
The ffcx_options.json files are cached on the first call. Subsequent calls to this function use this cache.
Priority ordering of options from highest to lowest is:
XDG_CONFIG_HOME is ~/.config/ if the environment variable is not set.
Example ffcx_options.json file:
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_ir(analysis, object_names, prefix, ...) | Compute intermediate representation. |
Classes
| CommonExpressionIR(integral_type, ...) | Common-ground for IntegralIR and ExpressionIR. |
| 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. |
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)
Intermediate representation of data.
Create new instance of DataIR(integrals, forms, expressions)
Intermediate representation of a DOLFINx Expression.
Create new instance of ExpressionIR(expression, original_coefficient_positions, coefficient_names, constant_names, name_from_uflfile)
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)
An integral over a single domain.
Initialise.
Example
<a = Integral instance> b = a.reconstruct(expand_compounds(a.integrand())) c = a.reconstruct(metadata={‘quadrature_degree’:2})
Intermediate representation of an integral.
Create new instance of IntegralIR(expression, rank, enabled_coefficients, coordinate_element_hash)
Intermediate representation of a quadrature rule.
Create new instance of QuadratureIR(cell_shape, points, weights)
A quadrature rule.
Initialise.
NOTE:
UFL data.
Create new instance of UFLData(form_data, unique_elements, element_numbers, unique_coordinate_elements, expressions)
Utility functions for some code shared between representations.
Functions
| create_quadrature_points_and_weights(...[, ...]) | Create quadrature rule and return points and weights. |
| integral_type_to_entity_dim(integral_type, tdim) | Given integral_type and domain tdim, return the tdim of the integration entity. |
| map_integral_points(points, integral_type, ...) | Map points from reference entity to its parent reference cell. |
Classes
| QuadratureRule(points, weights[, tensor_factors]) | A quadrature rule. |
A quadrature rule.
Initialise.
NOTE:
FEniCS Project
2024, FEniCS Project
| November 5, 2024 | 0.9.0 |