UFL

Comment 3 for bug 875279

Revision history for this message
Johan Hake (johan-hake) wrote : Re: [Bug 875279] Re: replace fails for Indexed Coefficients

On Friday October 21 2011 07:47:34 Martin Sandve Alnæs wrote:
> Actually, no. It is too messy. The problem is this:
>
> V = VectorElement(...)
> f = Coefficient(V)
> u, v = split(f)
> M = u*v*f*dx
> M2 = replace(M, { u: v })
>
> What does this mean? Replacing terminals is rather unambiguous, this is
> not.

Ok.

> If you instead do:
>
> from ufl import *
> fe = VectorElement("CG", triangle, 1)
> f = Coefficient(fe)
> u0, u1 = split(f)
> f2 = as_vector((u1, u1))
> print str(replace(u0*dx, {f: f2}))
>
> you should hopefully get what you need.

Nice workaround!

> The alternative would be something much more intelligent than replace.

Ok, can you just enlight me why the result from as_vector is a terminal
object, and the result from a split is not.

> ** Changed in: ufl
> Status: Confirmed => Won't Fix

Ok

Johan