← Back to team overview

dolfin team mailing list archive

Re: GenericTensor and shared_ptr

 

On Thu, Jan 20, 2011 at 03:36:09PM -0800, Johan Hake wrote:
> On Thursday January 20 2011 15:23:07 Anders Logg wrote:
> > B1;2600;0cOn Thu, Jan 20, 2011 at 09:56:39AM -0800, Johan Hake wrote:
> > > It turns out that SWIG has introduced a regression wrt shared ptr
> > > handling in its 2.0.0 release. The bug causes things like
> > > GenericMatrix.data() to not work, as it expects a GenericMatrix but gets
> > > a subclass. So basically the swig handled upcast algorithm is screwed.
> > > See buildbots for error message...
> > >
> > > I have to file a bug for this and try to fix it upstream. Possible
> > > solutions
> > >
> > > are:
> > >   1) Force people to downgrade SWIG to 1.3.40 until a fix excist
> > >   2) Remove shared_ptr handling of GenericTensors until fix excist
> > >   3) Trye to hack a fix fox this for the moment (I tried once and it did
> > >   not
> > >
> > >      work...)
> > >
> > > I reluctantly vote for 2.
> >
> > I vote for (2) too.
> >
> > (1) sounds problematic and if you didn't manage to do (3), there's
> > little chance someone else will. :-)
>
> The fourth option might also work. As the error only turns up when a matrix is
> down_casted. This does not happen very often (if ever?) in user code.
>
> So:
>
>    data = A.data()
>
> works, but:
>
>   A = down_cast(A)
>   data = A.data()
>
> does not. We test this in the la unit test. We can just turn that test off?

Sounds good. We can add a comment on why the test is commented out.

--
Anders



Follow ups

References