← Back to team overview

ffc team mailing list archive

Re: Named Functions

 

2008/12/6 Garth N. Wells <gnw20@xxxxxxxxx>:
> It would be useful if we could somehow associate names with mixed
> functions, e.g.
>
>   P2 = VectorElement("Lagrange", "triangle", 2)
>   P1 = FiniteElement("Lagrange", "triangle", 1)
>   TH = P2 + P1
>   (u, p, "U") = Functions(TH)
>
> so that in the DOLFIN-specific C++ wrapper code we can use
>
>   a.U = u;
>
> to attach mixed functions rather than
>
>   a.w0 = u;
>   a.w1 = v;
>   etc.
>
> which is error prone. Andy suggestions on a nice way to do this in the
> FFC input? Will this be part of UFL?
>
> Garth

I get the problem and idea, but I don't get this code example. You
can't assign to "U".

Also, I think we should remove "Functions" from UFL, using "split"
explicitly instead:

U = Function(TH)
u, p = split(u)

then we will have:

a.U = u; // mixed function

in the dolfin code.

We can add a name attribute to Function in UFL, but I
removed this a short while ago to keep things simple...
Then this would do the same:

u, p = split(Function(TH, name="U"))

--
Martin


Follow ups

References