[petsc-users] Extending petsc4py
Ingo Gaertner
ingogaertner.tus at gmail.com
Tue Jul 10 12:17:07 CDT 2018
Hello,
can I find somewhere an example how to wrap my own PETSc-based code so that
it can be used together with petsc4py?
Let's assume I have a C function, which I want to access from python:
Vec createMyVec();
I have written a SWIG interface file to generate a python wrapper for this
function. The wrapper works, but I cannot use the return value as input for
mpi4py routines that expect a Vec, because mpi4py's Vec type is different
from the SWIG generated Vec type in my python wrapper. Any idea, how I can
create mpi4py-compatible types?
If the mpi4py wrapping technique is described somewhere, this may help as
well, although some working example would be perfect.
As a final remark, I'd like to keep my project decoupled from mpi4py.
Therefore, including my extensions in the build process of mpi4py is not
quite what I am looking for, although I could live with this as a
workaround if no other solution is possible.
(I am using petsc-3.9.1 built from source and mpi4py installed using pip on
Ubuntu 18.04.)
Thanks
Ingo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20180710/d9ddfe1c/attachment.html>
More information about the petsc-users
mailing list