dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #05598
Segmentation fault
The following code gives me a segmentation fault:
from dolfin import *
def foo():
element = FiniteElement("Lagrange", "triangle", 1)
mesh = UnitSquare(2, 2)
return Function(element, mesh, 1.0)
print foo().mesh().numVertices()
If the mesh is declared outside foo() it works fine.
It seems that Python is calling the Mesh destructor when foo()
returns. It shouldn't since the Function created in foo() keeps a
reference to the mesh.
Does anyone know how to fix this? Is it possible to tell Python that
the mesh is referenced by the function?
/Anders