firedrakeproject/firedrake — pull request #79 by kynan (2013-11-19 18:22:25+00:00)
Title: Expressions on mixed spaces

Split expressions into a subtree for each component

Introduce a transformer ExpressionSplitter, that splits an expression
tree into a subtree for each component of the appropriate function
space.

If the expression is an assignment, that function space is the one
being assigned into. Otherwise the function spaces of the operands of
the root node in the expression tree have to match.

Any Function in the expression tree needs to either be defined on the
canonical function space, in which case it is split into components.
Functions on scalar function spaces are not modified.

The only other legal case is a Function defined on a function space
extracted from the canonical function space at a given index. In this
case, the function is inserted at the given index and a zero is
inserted into the expression tree for all other components.