ufl team mailing list archive
-
ufl team
-
Mailing list archive
-
Message #01701
Re: Zero form
On 2 November 2010 14:21, Andy Ray Terrel <andy.terrel@xxxxxxxxx> wrote:
> If you add Zero, you should probably add One as well.
One is not defined in UFL, Identity is, but I don't know if that can
be used as One if the dimension is equal to 1?
If not, it should not be a problem to add One using Zero as the prototype.
Kristian
> -- 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
>>
>
References