← Back to team overview

ufl team mailing list archive

Re: Bug in purge_list_tensors?

 

On Wed, Mar 4, 2009 at 2:12 PM, Anders Logg <logg@xxxxxxxxx> wrote:
> I get an error when trying purge_list_tensors.
>
> Here's a simple example:
>
>  element = VectorElement("Lagrange", "triangle", 1)
>
>  v = TestFunction(element)
>  u = TrialFunction(element)
>
>  a = inner(as_tensor([v[0], v[1]]), as_tensor([u[0], u[1]]))
>
> This seems to work if I first call expand_compounds, but not without.
> Is expand_compounds a requirement before calling purge_list_tensors?

Yes. Actually, I assumed expand_derivatives had been applied.


> Another example that fails is
>
>  b = inner(as_tensor([v[0], v[1]]), as_tensor([u[0], u[1].dx(0)]))
>
> If I call this without first calling expand_derivatives, I get
>
>  File "/usr/lib/python2.5/site-packages/ufl/algorithms/transformations.py",
>  line 727, in list_tensor
>     c0, c1 = c[0], c[1:]
>  IndexError: tuple index out of range
>
> If I first call expand_derivatives, I get
>
>  File
>  "/usr/lib/python2.5/site-packages/ufl/algorithms/transformations.py",
>  line 133, in reuse_if_possible
>    r = o.reconstruct(*operands)
>  File "/usr/lib/python2.5/site-packages/ufl/expr.py", line 159, in
>  reconstruct
>    return self._uflclass(*operands)
>  File "/usr/lib/python2.5/site-packages/ufl/algebra.py", line 139, in
>  __new__
>    or error("Product can only represent products of scalars.")
>  File "/usr/lib/python2.5/site-packages/ufl/log.py", line 64, in
>  error
>    raise UFLException(self._format_raw(*message))
>  ufl.log.UFLException: Product can only represent products of scalars.
>
> I've attached a small test script.
>
> --
> Anders
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (GNU/Linux)
>
> iEYEARECAAYFAkmuflcACgkQTuwUCDsYZdFd4gCfbo499KfWxiCk9Ga6BmosqO1z
> AIgAoI5bvZwAKbgcCnjUHtgTqsAzMq1q
> =8ZIm
> -----END PGP SIGNATURE-----
>
> _______________________________________________
> UFL-dev mailing list
> UFL-dev@xxxxxxxxxx
> http://fenics.org/mailman/listinfo/ufl-dev
>
>


Follow ups

References