← Back to team overview

ufl team mailing list archive

Re: Importing Zero

 

I made that request. If you do not like just remove it and I will grab Zero 
from the library.

I use it to build UFL forms. I start out with a Zero form and then I use += to 
add stuff to it. But then I need a "form" to start with, and the Zero form 
fits that purpose. 

Any other suggestion of getting around that?

Kristian has already suggested collecting the forms in a list and then just do 
a reduce(operator.add, list_of_forms), which would work, but would make me re-
write some code ;)

Johan

On Thursday April 28 2011 02:14:17 Martin Sandve Alnæs wrote:
> In r946 Zero was exposed to the ufl namespace. What is that used for?
> 
> from ufl.constantvalue import PermutationSymbol, Identity, Zero, as_ufl
> 
> If it's for internal ffc usage, it can be retrieved as from ufl.classes
> import Zero.
> If it's needed for users, I would rather add something like:
> 
> def zero(*shape):
>     return Zero(shape)
> 
> Usage:
> d = cell.d
> v = zero(d)
> M = zero(d, d)
> 
> For consistency and to hide the index dimensions details from the user.
> 
> Martin



Follow ups

References