Fix PETScMatrix(mat) constructor in python

Issue #247 duplicate
Jan Blechta created an issue

PETScMatrix constructor does not work for petsc4py.PETSc.Mat.

MWE:

from dolfin import *

mesh = UnitSquareMesh(3, 3)
V = FunctionSpace(mesh, 'CG', 1)
u, v = TrialFunction(V), TestFunction(V)
a = inner(grad(u), grad(v))*dx

A = PETScMatrix()
assemble(a, tensor=A)

mat = A.mat()
print type(mat)

B = PETScMatrix(mat)

Out:

<type 'petsc4py.PETSc.Mat'>
...
*** Error:   Unable to create GPU matrix.
*** Reason:  PETSc not compiled with Cusp support.
*** Where:   This error was encountered inside PETScMatrix.cpp.

Comments (1)

  1. Log in to comment