firedrakeproject/firedrake — pull request #280 by wence- (2014-04-28 17:26:19+00:00)
Title: Assembly of zero forms with multiple integrals broken in parallel

Consider the following:

```python
from firedrake import *

m = UnitSquareMesh(10, 10)

V = FunctionSpace(m, 'CG', 1)

f = Function(V)

f.assign(1)

assert abs(assemble(f*ds + f*dx) - 5) < 1e-6
```

In serial, passes, in parallel:

```
$ mpiexec -n 2 python foo.py
assert abs(assemble(f*ds + f*dx) - 5) < 1e-7
AssertionError
```

The problem is that we split this form into:

assemble first integral, placing result in a Global. This gets us the global value of f*ds on every process (i.e. 4)

Now we increment into that global with the second integral (f*dx) with the process local contribution giving us something like

[4.42, 4.58]

And then we sum, giving us 9, rather than 5.