firedrakeproject/firedrake — pull request #31 by wence- (2014-03-31 15:20:24+00:00)
Title: Constant behaves differently to Dolfin constant

*NOTE*: This was previously tracked under PyOP2, so I am just moving it here.

In Dolfin I can do:

```
Constant( (1.0, 0.0) )
```

which causes the following error when run in Firedrake:

```
TypeError Traceback (most recent call last)
in ()
----> 1 velocity = Constant( (1.0, 0.0) )

/usr/local/fenics/ufl/master/lib/python2.7/site-packages/ufl/coefficient.pyc in __init__(self, domain, count)
114
115 def __init__(self, domain, count=None):
--> 116 e = FiniteElement("Real", domain, 0)
117 ConstantBase.__init__(self, e, count)
118 self._repr = "Constant(%r, %r)" % (e.domain(), self._count)

/usr/local/fenics/ufl/master/lib/python2.7/site-packages/ufl/finiteelement/finiteelement.pyc in __init__(self, family, domain, degree, quad_scheme, form_degree)
57 cell = None
58 else:
---> 59 domain = as_domain(domain)
60 cell = domain.cell()
61 ufl_assert(cell is not None, "Missing cell in given domain.")

/usr/local/fenics/ufl/master/lib/python2.7/site-packages/ufl/domains.pyc in as_domain(domain)
129 return domain
130 else:
--> 131 cell = as_cell(domain)
132 if isinstance(cell, Cell):
133 if cell not in _default_domains:

/usr/local/fenics/ufl/master/lib/python2.7/site-packages/ufl/geometry.pyc in as_cell(cell)
588 return Cell(cell)
589 else:
--> 590 error("Invalid cell %s." % cell)

TypeError: not all arguments converted during string formatting
```

(I think this is because `Constant` is not yet implemented in Firedrake and it is trying to give me a UFL `Constant`).