firedrakeproject/firedrake — pull request #230 by wence- (2014-04-04 10:29:11+00:00)
Title: Vector Constant implementation broken

The current test is the following:
```
def test_vector_constant_2d():
m = UnitSquareMesh(1, 1)
n = FacetNormal(m)

c = Constant([1, -1])
# Mesh is:
# ,---.
# |\ |
# | \ |
# | \|
# `---'
# Normal is in (1, 1) direction
assert abs(assemble(dot(c('+'), n('+'))*dS)) < 1e-10

c.assign([1, 1])
assert abs(assemble(dot(c('+'), n('+'))*dS) - 2) < 1e-10
```

Modifying that last line to `assert abs(assemble(dot(c('-'), n('+'))*dS) - 2) < 1e-10` should also pass, since the constant should be the same on both sides of the facet.

But it fails:
```
> assert abs(assemble(dot(c('-'), n('+'))*dS) - 2) < 1e-10
E assert 2.0 < 1e-10
E + where 2.0 = abs((3.2114266979681025e-322 - 2))
E + where 3.2114266979681025e-322 = assemble((Dot(NegativeRestricted(Coefficient(VectorElement('Real', None, 0, 2, None), 13)), PositiveRestricted(FacetNormal(Cell('triangle', 2)))) * dS))
E + where Dot(NegativeRestricted(Coefficient(VectorElement('Real', None, 0, 2, None), 13)), PositiveRestricted(FacetNormal(Cell('triangle', 2)))) = dot(NegativeRestricted(Coefficient(VectorElement('Real', None, 0, 2, None), 13)), PositiveRestricted(FacetNormal(Cell('triangle', 2))))
E + where NegativeRestricted(Coefficient(VectorElement('Real', None, 0, 2, None), 13)) = Coefficient(VectorElement('Real', None, 0, 2, None), 13)('-')
E + and PositiveRestricted(FacetNormal(Cell('triangle', 2))) = FacetNormal(Cell('triangle', 2))('+')

local/firedrake/tests/regression/test_constant.py:35: AssertionError
```

This is closely related to https://github.com/firedrakeproject/firedrake/issues/165