cell_avg/facet_avg on general expressions

Issue #102 resolved
Lawrence Mitchell created an issue

The cell_avg and facet_avg operators are currently defined as being terminal modifiers. But I think this is insufficient for many cases. Consider cell_avg(x*x), on the single cell [0, 1]. Unless I'm being dense, this should evaluate to 1/3 (\int_0^1 x*x dx). But we can't get there if we can only compute averages of terminal quantities: cell_avg(x)*cell_avg(x) == 1/4.

If it turns out I'm being dense, there are still issues in the form processing pipeline: it's easy to end up in situations where after compute_form_data, cell_avg is not applied to terminals (or modified terminals).

So I would propose making CellAvg and FacetAvg general (rather than just terminal) operators.

I think I know how to implement this in at least tsfc. I don't know how it would work in the other form compilers.

Thoughts?