dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #05549
(Py)Trilinos 8.0
I think PyTrilinos is starting to look good, with very nice numpy integration.
http://trilinos.sandia.gov/packages/pytrilinos/release-8.0/Epetra.html
Epetra.Vector objects can be treated as both numpy arrays and
Epetra_Vector objects, and it's possible to get a numpy view of an
Epetra.Vector or vice versa without copying data. The Epetra.Comm
communicator objects provides typical MPI operations (broadcast,
reductions, ...) with numpy arrays.
We should make sure that the dolfin::GenericVector design is easy to
use with this library. I don't think we need much changes (I'll write
about some sparsity pattern issues in another email).
I think this should be easily possible in Python:
b = dolfin.EpetraVector()
assembler.assemble(b, ...)
eb = Epetra.Vector(Epetra.View, b.vec())
my_slice = eb[0:-1:2]
but also this:
eb = Epetra.Vector(... my own way of initializing the vector ...)
b = dolfin.EpetraVector(eb, view=True) # or own=False
assembler.assemble(b, ..., init=False)
Another possibility is to do the step "b = dolfin.Ep..." in typemaps
in pydolfin, so you can just do:
eb = Epetra.Vector(... my own way of initializing the vector ...)
assembler.assemble(eb, ..., init=False)
or:
nb = numpy.array(... my own way of initializing the vector ...)
assembler.assemble(nb, ..., init=False)
I'll be looking more at this in some weeks, using SyFi/Dolfin/PyTrilinos.
(The Trilinos pages also mention upcoming PetSC support in Trilinos.)
--
Martin