← Back to team overview

ufl team mailing list archive

Re: [HG UFL] Implemented __iter__ in Expr such that

 

I'm not sure, I was just thinking about this...

Say we have:

  V = VectorElement("CG", triangle, 1)
  P = FiniteElement("CG", triangle, 1)
  TH = V+P
  up = Function(TH)

then up.shape() == (3,) and thus len(up) == 3 and you can do

  ux, uy, p = up # only considers the value shape
  u = as_vector((ux, uy))

while ufl.split works like this:

  u, p = split(up) # deals with the mixed element structure
  len(u) == 2

We can only implement __iter__ to do one thing!
It might be for ambiguities similar to this that I didn't
implement this earlier, but I don't remember any
more compelling reasons...

In PyDOLFIN, Function.split() is something else?
It creates SubFunctions, which can't be used in forms.
Right? I think we should keep that explicit.

Martin



On Mon, Apr 6, 2009 at 1:30 PM, Anders Logg <logg@xxxxxxxxx> wrote:
> On Mon, Apr 06, 2009 at 01:29:08PM +0200, UFL wrote:
>> One or more new changesets pushed to the primary ufl repository.
>> A short summary of the last three changesets is included below.
>>
>> changeset:   803:3fb5d12db6129110f3f434fee27c5a642db698b4
>> tag:         tip
>> user:        "Martin Sandve Alnæs <martinal@xxxxxxxxx>"
>> date:        Mon Apr 06 13:30:50 2009 +0200
>> files:       doc/manual/chapters/formlanguage.tex ufl/expr.py ufl/terminal.py
>> description:
>> Implemented __iter__ in Expr such that
>> a, b = v
>> a, b, c = w
>> etc
>> is allowed for any vector valued expression,
>> e.g. with len(v.shape()) == 1.
>
> Should this be done for Function.split() in (Py)DOLFIN as well?
>
> --
> Anders
>
>
>>
>> changeset:   802:b224b4fcfd7a9c3cc8e42de5aaf0437eef840785
>> user:        "Martin Sandve Alnæs <martinal@xxxxxxxxx>"
>> date:        Mon Apr 06 12:36:07 2009 +0200
>> files:       doc/manual/chapters/formlanguage.tex doc/manual/ufl-user-manual.tex
>> description:
>> Work on forms, integrals and measures part of form language in manual.
>>
>>
>> changeset:   801:72641a62dcd0bae0aa7556dd38999866252028c6
>> user:        "Martin Sandve Alnæs <martinal@xxxxxxxxx>"
>> date:        Mon Apr 06 12:08:25 2009 +0200
>> files:       doc/manual/chapters/formlanguage.tex doc/manual/chapters/introduction.tex
>> description:
>> Rework Form Language introduction.
>>
>> ----------------------------------------------------------------------
>> For more details, visit http://www.fenics.org/hg/ufl
>
>> _______________________________________________
>> UFL-dev mailing list
>> UFL-dev@xxxxxxxxxx
>> http://fenics.org/mailman/listinfo/ufl-dev
>
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (GNU/Linux)
>
> iEYEARECAAYFAknZ5+4ACgkQTuwUCDsYZdGaOQCcCnCBHs5Ge5f5SAUlx30z9sYl
> nCcAn1uIoaMH8Ch0uKZVmWOLkE7N/SN/
> =O9Nh
> -----END PGP SIGNATURE-----
>
> _______________________________________________
> UFL-dev mailing list
> UFL-dev@xxxxxxxxxx
> http://fenics.org/mailman/listinfo/ufl-dev
>
>


Follow ups

References