On Friday October 21 2011 10:02:56 Martin Sandve Alnæs wrote:
> It is not, it is the key (f) that has to be a terminal.
Ahhh, slowly getting there!
Johan
> 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
On Friday October 21 2011 10:02:56 Martin Sandve Alnæs wrote:
> It is not, it is the key (f) that has to be a terminal.
Ahhh, slowly getting there!
Johan
> 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