Is it possible to pass a PETSCBaseMatrix from Python into C?
Asked by
Patrick Farrell
I'd like to assemble a matrix in Python, and then pass it into my C library as a PETSc Mat type. If in Python I do
from dolfin import *
mesh = UnitInterval(10)
V = FunctionSpace(mesh, "CG", 1)
u = TrialFunction(V)
v = TestFunction(V)
mass = inner(u, v)*dx
M = down_cast(
mat = M.mat()
I get a
In [9]: mat
Out[9]: <Swig Object of type 'boost::shared_ptr< Mat > *' at 0x373a210>
Is there some swig magic I can perform to get the raw pointer to the underlying Mat to pass to a C function (interfaced with ctypes)?
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- DOLFIN Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- Patrick Farrell
- Solved:
- Last query:
- Last reply:
To post a message you must log in.