FFC

Redesign to simplify and cleanup FFC

Registered by Anders Logg

After the recent UFL transition and the ongoing move to the new FIAT interface, we need to reorganize and cleanup FFC.
Proposed plan is as follows.

Each stage of the code generation should take as input the output from the previous stage. There are six stages 0-5, one of which takes place in UFL.

0. UFL

Input: User-defined form
Output: UFL abstract syntax tree

1. Analysis

Input: UFL form
Output: Preprocessed UFL form and FormData

This takes place in FFC and includes preprocessing the form and extracting form data. It should not include computing the FIAT elements.

2. Code representation

Input: Preprocessed UFL form and FormData
Output: Intermediate Representation (IR, see Wikipedia)

The IR is stored as a simple dictionary where the keys are the corresponding UFC function names and should contain any data necessary for later generation of code.

3. Code optimization

Input: IR
Output: Optimized IR

4. Code generation

Input: IR
Output: C++ code

This should be stored as today, in a dictionary corresponding to IR but containing the actual C++ code for each function. For example,
the entry for "local_dimension" would contain the integer 3 in the IR but would contain the string "return 3;" in the output.

5. Code formatting

Takes the generated code and writes it to file in UFC format, adding headers and footers etc.

This allows us to completely remove many abstractions in FFC such as
- FiniteElement
- DofMap
Everything complicated that requires some kind of algorithmic effort should be done in stage 3: intermediate code representation.

Blueprint information

Status:
Complete
Approver:
None
Priority:
Essential
Drafter:
None
Direction:
Needs approval
Assignee:
None
Definition:
Approved
Series goal:
None
Implementation:
Implemented
Milestone target:
milestone icon 0.9.0
Started by
Anders Logg
Completed by
Anders Logg

Related branches

Sprints

Whiteboard

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.