← Back to team overview

dolfin team mailing list archive

[Bug 747273] [NEW] Python: LA objects are deleted when Dolfin object goes out of scope

 

Public bug reported:

The following code:
------
import PyTrilinos
from dolfin import *
parameters["linear_algebra_backend"] = "Epetra"

mesh = UnitSquare(2,1)
CG1 = FunctionSpace(mesh, "CG", 1)
q, p = TestFunction(CG1), TrialFunction(CG1)
A = assemble(q*p*dx)

D = down_cast(A).mat()
#del A
print D
------
fails when "del A" is uncommented. (with the petsc backend it always fails, but that's another problem).

In cbc.block I work around this by creating a back-reference in the LA
object to its container, but this should not be necessary given that
shared_ptr is returned by mat().

** Affects: dolfin
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of DOLFIN
Team, which is subscribed to DOLFIN.
https://bugs.launchpad.net/bugs/747273

Title:
  Python: LA objects are deleted when Dolfin object goes out of scope

Status in DOLFIN:
  New

Bug description:
  The following code:
  ------
  import PyTrilinos
  from dolfin import *
  parameters["linear_algebra_backend"] = "Epetra"

  mesh = UnitSquare(2,1)
  CG1 = FunctionSpace(mesh, "CG", 1)
  q, p = TestFunction(CG1), TrialFunction(CG1)
  A = assemble(q*p*dx)

  D = down_cast(A).mat()
  #del A
  print D
  ------
  fails when "del A" is uncommented. (with the petsc backend it always fails, but that's another problem).

  In cbc.block I work around this by creating a back-reference in the LA
  object to its container, but this should not be necessary given that
  shared_ptr is returned by mat().



Follow ups

References