← Back to team overview

dolfin team mailing list archive

Some shared_ptr information

 

Hello!

After I added shared_ptr support for PyDOLFIN things have stabelized, I 
think... but there are some issues you should be aware of. We need swig 
version 1.3.35 or higher. This version comes with ubuntu 08.10 (intrepid). 
Johannes are going to compile the newest swig, 1.3.37 and put it in our apt 
repositories. I assume this also will be done for ubuntu 08.10? This last 
version came this week, and it comes with a fix for std::tr1::shared_ptr, 
making it possible to change back to tr1.

The nice thing with shared_ptrs in PyDOLFIN is that we no longer have to keep 
any references for instances we do not want to get garbage collected in 
python, as swig now use a shared_ptr to store the underlying c++ instance. 
And of course it interact better with the c++ library which now use 
shared_ptrs quite heavily.

Adding shared_ptr support for additional classes in PyDOLFIN is done in the 
file 

   dolfin/swig/dolfin_shared_ptr_classes.i

It should be straight forward. For now these classes are stored using 
shared_ptrs:

   all ufc classes (this is done in ufc/ffc, not in DOLFIN)
   Form, DofMap
   Mesh, and all built in Meshes.
   Function, and for all built in Functions

To be able to run your python code again you also have to run instant-clean.

Please report any problems!


Johan


Follow ups