Subject: [FFC-dev] shared_ptr code

From: Johan Hake <[email-masked]>
Date: Sun, 23 Nov 2008 18:36:46 +0100

Hello!

When I tried the shared_ptr stuff in pydolfin i included some change for the 
jit genereated swig modules in ffc. 

I think we landed on not including the shared_ptr stuff yet in pydolfin, but I 
would like to "save" the code for any potential use when we some time in the 
future want to include it. 

Is it ok to add the generation of shared_ptr code, only visible in the swig 
interface file, to FFC and then add an option, option["shared_ptr"], which 
will default to False?

Johan

---

From: Anders Logg <[email-masked]>
Date: Mon, 24 Nov 2008 14:09:06 +0100

> interface file, to FFC and then add an option, option["shared_ptr"], which 

Yes, why not. As long as it does not make the code generation code
overly complex.

-- 
Anders

---

From: Johan Hake <[email-masked]>
Date: Mon, 24 Nov 2008 19:56:41 +0100

On Monday 24 November 2008 14:09:06 Anders Logg wrote:
> > When I tried the shared_ptr stuff in pydolfin i included some change for
> > the jit genereated swig modules in ffc.
> >
> > I think we landed on not including the shared_ptr stuff yet in pydolfin,
> > but I would like to "save" the code for any potential use when we some
> > time in the future want to include it.
> >
> > Is it ok to add the generation of shared_ptr code, only visible in the
> > swig interface file, to FFC and then add an option, option["shared_ptr"],
> > which will default to False?
> >
> > Johan
>

Ok, then I hand a boundle with this change. It consists of two commits. One 
makeing the base class Element inherit from object inste, i.e., letting it be 
a new style class. This is needed to overload the __new__ function, which is 
handy in PyDOLFIN. 

The second commit, includes the shared_ptr code generation. It is small and 
will only effect the swig interface code.

It will only work for swig version 1.3.34 or higher, and then only for 
boost::shared_ptr. In the svn version of swig and in the comming 1.3.37 will 
also std::tr1::shared_ptr be supported.

The key point is to %include boost_shared_ptr.i and define which classes shall 
be enabled. This has to be done both for base and derived classes.

Johan

---

From: Johan Hake <[email-masked]>
Date: Mon, 24 Nov 2008 19:57:14 +0100

And so the bundle...

Johan