dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #13093
Re: [HG DOLFIN] Added slicing capabilities for GenericVector interface in PyDOLFIN:
On Friday 17 April 2009 09:20:20 DOLFIN wrote:
> One or more new changesets pushed to the primary dolfin repository.
> A short summary of the last three changesets is included below.
>
> changeset: 6003:010f9db3ecb7456374a12e3510ff1c93847d5f6b
> tag: tip
> user: "Johan Hake <hake@xxxxxxxxx>"
> date: Fri Apr 17 09:20:16 2009 +0200
> files: ChangeLog dolfin/swig/dolfin_la_post.i
> dolfin/swig/dolfin_la_pre.i test/unit/la/python/test.py description:
> Added slicing capabilities for GenericVector interface in PyDOLFIN:
>
> We can now e.g. do things like:
> v = Vector(10)
> v[:] = 1.0
> v[0:10:2] = 2.0
> v[0:10:2] = v[1:10:2]
> v[[0,3,4,6,9]] = v[1:10:2]
>
> in the PyDOLFIN interface. A sliced Vector returns a copy of the old
> Vector. I have added a bunch of tests that covers some user cases, but
> please report any missbehaviours.
This is a nice feature that makes python programming more smooth. The
implementation is done totally in an extended c++ layer of the proxy classes
in swig.
There are some code duplications, which probably could be eliminated, and it
does not support numpy arrays on the right hand side, but this could be added
in the future.
Cheers!
Johan
> changeset: 6002:abd917724766fb235c6a88c85ce4666b555905fc
> parent: 6001:1ef950dc36ac0068dec6e3e9bb264545a77ecf81
> parent: 6000:927b246f78e88c44400323122f3bdbe15cd795c7
> user: Anders Logg <logg@xxxxxxxxx>
> date: Thu Apr 16 19:37:15 2009 +0200
> files:
> description:
> merge
>
>
> changeset: 6001:1ef950dc36ac0068dec6e3e9bb264545a77ecf81
> parent: 5998:2e2f33280fa05aef5eb267da94a1c22165a85796
> user: Anders Logg <logg@xxxxxxxxx>
> date: Thu Apr 16 19:37:04 2009 +0200
> files: dolfin/fem/DofMap.cpp dolfin/fem/DofMap.h
> dolfin/fem/DofMapBuilder.cpp dolfin/fem/DofMapBuilder.h
> dolfin/mesh/MeshPartitioning.cpp dolfin/mesh/MeshPartitioning.h
> sandbox/passembly/main.cpp description:
> Work on parallel stuff with Ola. Getting closer.
>
> ----------------------------------------------------------------------
> For more details, visit http://www.fenics.org/hg/dolfin
> _______________________________________________
> DOLFIN-dev mailing list
> DOLFIN-dev@xxxxxxxxxx
> http://www.fenics.org/mailman/listinfo/dolfin-dev
Follow ups
References