← Back to team overview

ufl team mailing list archive

Re: Zero form

 

If you add Zero, you should probably add One as well.

-- Andy

On Tue, Nov 2, 2010 at 5:12 AM, Kristian Ølgaard <k.b.oelgaard@xxxxxxxxx> wrote:
> On 2 November 2010 00:44, Johan Hake <johan.hake@xxxxxxxxx> wrote:
>> Hello!
>>
>> I am automating the building of a ufl form. Something like:
>>
>>  # create list_of_forms
>>  my_form = Zero()*dx
>>  for form in list_of_forms:
>>      my_form += form
>>
>> For the for loop to work I need to initate my_form to Zero()*dx, because it
>> need to be a form.
>>
>> Any other ideas of how this can be done? If this is the only way can
>> someone(TM) expose 'Zero' to the main ufl namespace?
>
> my_form = reduce(lambda x,y:x+y, list_of_forms)
>
> should do the trick.
>
> On the other hand, I don't see a problem in exposing Zero in the ufl
> namespace, it might be convenient in other cases too?
>
> Kristian
>
>> It resides in:
>>
>>  constantvalue.py
>>
>> Johan
>>
>> _______________________________________________
>> Mailing list: https://launchpad.net/~ufl
>> Post to     : ufl@xxxxxxxxxxxxxxxxxxx
>> Unsubscribe : https://launchpad.net/~ufl
>> More help   : https://help.launchpad.net/ListHelp
>>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~ufl
> Post to     : ufl@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~ufl
> More help   : https://help.launchpad.net/ListHelp
>



Follow ups

References