It is not, it is the key (f) that has to be a terminal.
Martin
Den 21. okt. 2011 kl. 18:01 skrev Johan Hake <email address hidden>:
> 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
>
> --
> You received this bug notification because you are subscribed to FEniCS
> Project.
> https://bugs.launchpad.net/bugs/875279
>
> Title:
> replace fails for Indexed Coefficients
>
> Status in Unified Form Language:
> Won't Fix
>
> Bug description:
> This code:
>
> from ufl import *
> fe = FiniteElement("CG", triangle, 1)*FiniteElement("CG", triangle, 1)
> u0, u1 = Coefficients(fe)
> replace(u0*dx ,{u0:u1})
>
> triggers an assertion:
> UFLException: This implementation can only replace Terminal objects.
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/ufl/+bug/875279/+subscriptions
It is not, it is the key (f) that has to be a terminal.
Martin
Den 21. okt. 2011 kl. 18:01 skrev Johan Hake <email address hidden>:
> On Friday October 21 2011 07:47:34 Martin Sandve Alnæs wrote: /bugs.launchpad .net/bugs/ 875279 t("CG", triangle, 1) /bugs.launchpad .net/ufl/ +bug/875279/ +subscriptions
>> 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
>
> --
> You received this bug notification because you are subscribed to FEniCS
> Project.
> https:/
>
> Title:
> replace fails for Indexed Coefficients
>
> Status in Unified Form Language:
> Won't Fix
>
> Bug description:
> This code:
>
> from ufl import *
> fe = FiniteElement("CG", triangle, 1)*FiniteElemen
> u0, u1 = Coefficients(fe)
> replace(u0*dx ,{u0:u1})
>
> triggers an assertion:
> UFLException: This implementation can only replace Terminal objects.
>
> To manage notifications about this bug go to:
> https:/