← Back to team overview

ufl team mailing list archive

Re: [HG UFL] Implemented better version of tuple syntax:

 

On Mon, Mar 30, 2009 at 02:00:51PM +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:   780:bc9680be05bfd5048c3de1fbcc2f9281c3f2c5ef
> tag:         tip
> user:        "Martin Sandve Alnæs <martinal@xxxxxxxxx>"
> date:        Mon Mar 30 14:02:24 2009 +0200
> files:       ufl/algorithms/formfiles.py ufl/integral.py
> description:
> Implemented better version of tuple syntax:
> 
>   a = (u,v)*dx + (f,v)*dx
> 
> in this case a is a Form, so no changes are needed anywhere else.

Nice. I thought about this (implementing __rmul__ to handle tuples)
but wanted the even shorter version (without dx).

Can we keep both options?

I haven't figured out how to make load_forms work though. The current
implementation seems to extract *all* forms from a file, which may not
always be appropriate. One might want to keep contributions in
separate variables and then add up the results:

  CONV = (v, dot(beta, grad(u)))*dx
  DIFF = (grad(v), grad(u))*dx
  a = CONV + DIFF

Code should here be generated only for the form a, not CONV and DIFF.

FFC solves this by using reserved variable names for forms:

  a: bilinear form
  L: linear form
  M: functional

  element: single element

-- 
Anders

Attachment: signature.asc
Description: Digital signature


Follow ups

References