SWIG does not pass correct type to PETScKrylovSolver

Bug #740293 reported by Christian Clason
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
DOLFIN
Fix Released
Medium
Unassigned

Bug Description

The following code fails with
TypeError: in method 'new_Function', argument 1 of type 'dolfin::Function const &'

from dolfin import *

def boundary(x,on_boundary):
    return on_boundary

mesh = UnitSquare(32, 32)
V = FunctionSpace(mesh, 'CG', 1)

bc = DirichletBC(V, Constant(0.0), boundary)
u = TrialFunction(V)
v = TestFunction(V)
a = inner(grad(u), grad(v))*dx

class NewtonMatrix(PETScKrylovMatrix) :
    def __init__(self) :
        PETScKrylovMatrix.__init__(self, V.dim(), V.dim())

    def mult(self, *args) :
        du = Function(V,args[0])
        f = du*v*dx
        problem = VariationalProblem(a, f, bc)
        dy = problem.solve()
        args[1][:] = down_cast(dy.vector())

y_petsc = PETScVector(V.dim()); y_petsc[:] = 1.0
x_petsc = PETScVector(V.dim())

NewtonSolver = PETScKrylovSolver('cg', 'none')
NewtonSolver.solve(NewtonMatrix(), x_petsc, y_petsc)

Changed in dolfin:
status: New → Confirmed
Changed in dolfin:
importance: Undecided → Medium
Johan Hake (johan-hake)
Changed in dolfin:
status: Confirmed → Fix Committed
Changed in dolfin:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Related questions

Remote bug watches

Bug watches keep track of this bug in other bug trackers.