dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #14041
Re: PyDOLFIN and overloading '='
On Sun, Jun 21, 2009 at 08:32:23PM +0200, Johan Hake wrote:
> On Saturday 20 June 2009 13:10:46 Garth N. Wells wrote:
> > I tried to do
> >
> > u0.vector() = u1.vector()
> >
> > where u0 and u1 are both discrete functions, in PyDOLFIN but it doesn't
> > work so I'm using
> >
> > u0.vector().assign( u1.vector() )
>
> This is the correct way to do it. Assignment operators are just ignored for
> the dynamically typed languges supported by SWIG. We therefore rename the
> foo.operator= to foo.assign.
>
> However for the Vector and Matrix interfaces we also support the numpy
> lookalike assignment:
>
> v[:] = u
>
> and
>
> A[:,:] = B
>
> I have talked to Anders about removing both v.assign and v.set(double *)
> and "force" the PyDOLFIN users to use the numpy assignments.
>
> Johan
Yes, I think that's a good idea. It reduces the number of options and
makes users aware of the nice slicing interface.
--
Anders
Attachment:
signature.asc
Description: Digital signature
References