← Back to team overview

dolfin team mailing list archive

Re: shared_ptr and Python

 



Johan Hake wrote:
On Tuesday 06 January 2009 12:33:43 Garth N. Wells wrote:
Kent Andre wrote:
Hi,

I have a function that returns    std::tr1::shared_ptr<FunctionSpace>.
In Python, this turns out to be an object with type 'PySwigObject'.
Hence, I cannot put it into eg. 'TestFunction'.

This file is not read as USE_SHARED_PTR is not defined. I have disabled share_ptr in PyDOLFIN as I couldn't get it to work.

That's same the problem I had when returning a shared_ptr to a Trilinos
object.

Anyone knows how to tell SWIG the type of these shared pointers ?
The dolfin_shared_ptr_classes.i file has been included long
before the function that returns the shared pointer appear
in the .i file.
I think that Johan is planning to look into this.

Ok, I have an other try. Maybe we have more luck with the shared la objects. My previous problem was with shared forms produced by FFC.

I think that the la objects are a good place to start. Feel free to use boost::shared_ptr instead of std::tr1::shared_ptr if that helps.

Garth

Kent can you hand a minimal script that can reproduce the error.
Johan




Follow ups

References