ffcx.formatting
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 given code in UFC format. |
|
Write code to files. |
- class ffcx.formatting.CodeBlocks(file_pre: list[tuple[str, str]], integrals: list[tuple[str, str]], forms: list[tuple[str, str]], expressions: list[tuple[str, str]], file_post: list[tuple[str, str]])[source]
Bases:
NamedTuple
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)
- expressions: list[tuple[str, str]]
Alias for field number 3
- file_post: list[tuple[str, str]]
Alias for field number 4
- file_pre: list[tuple[str, str]]
Alias for field number 0
- forms: list[tuple[str, str]]
Alias for field number 2
- integrals: list[tuple[str, str]]
Alias for field number 1
- ffcx.formatting.format_code(code: CodeBlocks) tuple[str, str] [source]
Format given code in UFC format. Returns two strings with header and source file contents.