FFC

Updating FFC to not require replacement of functions in ufl preprocess

Registered by Martin Sandve Alnæs

I'm trying to reduce UFL preprocess to do less, for various reasons.

One unnecessary part is the replacement of coefficients and
arguments with renumbered versions, which was originally done
for signature computation reasons. The signature computation
now does the renumbering as part of the algorithm and the
cost of renumbering can be avoided.

The replacement of coefficients also cover adding
missing cells and elements for pydolfin support,
so we still need to build and store the mapping from
original coefficients/arguments to renumbered ones.
However it is not necessary to actually replace them
in the integrand expression, which is the costly part.

I've added a member to ufl FormData with the mapping from original to renumbered functions:
  renumbered = form_data.function_replace_map[original]
(functions = both coefficients and arguments).

To remove the replace call in ufl preprocess, we need the form compilers to
apply the mapping when they visit functions. I've made the replace call optional
as an argument to preprocess, as a step on the way. If replace is turned on (default),
the mapping becomes
  renumbered = form_data.function_replace_map[renumbered]
which means this mapping can be added to parts of the form compiler code before switching
the replace call off completely.

However I have no idea where and how many places this needs to be changed in FFC.
Can someone with more FFC knowledge chip in on how to make this transition smoothly?

I've also added the members
  form_data.renumbered_arguments
  form_data.renumbered_coefficients
which currently are the same as form_data.arguments etc,
but with unambiguous names. Maybe we don't need them.

Blueprint information

Status:
Complete
Approver:
Martin Sandve Alnæs
Priority:
Medium
Drafter:
Martin Sandve Alnæs
Direction:
Approved
Assignee:
Martin Sandve Alnæs
Definition:
Approved
Series goal:
None
Implementation:
Implemented
Milestone target:
None
Started by
Martin Sandve Alnæs
Completed by
Martin Sandve Alnæs

Related branches

Whiteboard

MER: Given your suggestion "we need the form compilers to apply the mapping when they visit functions", in FFC, this would typically happen in the representation phase, and changes would have to be made in both the tensor and quadrature representation. Key components of both of these are implemented as Transformers so I don't think this should be too much of a hazzle.

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.