← Back to team overview

dolfin team mailing list archive

Re: shared_ptr and Python

 

On Tuesday 06 January 2009 13:56:55 Garth N. Wells wrote:
> 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.

Ok.

boost::shared_ptr is more natively supported by swig. std::tr1::shared_ptr 
will be supported with the next swig release comming now in januari.

If we get it working we might consider to change to boost::shared_ptr as not 
all will be able to get the newest version of swig.

Johan


References