I'm considering another possible change to
compute_form_data/preprocess behaviour.
Today all Coefficient and Argument objects
are relabeled to have contiguous counts.
This requires rebuilding almost the entire
integrand expression (a call to replace in preprocess).
An optimization would be to remove that call and only
store the mapping {original:renumbered} in the form data.
Then form compilers need to apply that mapping whenever
you access an original form argument in the integrand
expression but want the renumbered version.
In fact, you can get this behaviour already by passing
replace_functions=True to compute_form_data/preprocess,
and I made it possible to make the transition gradually.
I think it's easiest to just search for "replace_functions"
and read the code to understand in detail.
We should try passing replace_functions=False to compute_form_data, and removing the code that undoes this relabeling in MCFC. It should simplify our code somewhat since at present, UFL relabels everything then we have to figure out the mapping back to the original labels.
Martin Alnaes says:
We should try passing
replace_functions=False
tocompute_form_data
, and removing the code that undoes this relabeling in MCFC. It should simplify our code somewhat since at present, UFL relabels everything then we have to figure out the mapping back to the original labels.