← Back to team overview

dolfin team mailing list archive

Re: [Branch ~dolfin-core/dolfin/main] Rev 5656: Fix refinement from Python.

 


On 10/02/11 07:38, Johan Hake wrote:
> On Wednesday February 9 2011 23:32:55 Anders Logg wrote:
>> On Wed, Feb 09, 2011 at 04:40:19PM -0800, Johan Hake wrote:
>>> Nice fix!
>>>
>>> I thought we needed to introduce shared_ptr versions of refinements call.
>>> But I realise this fix only work for SWIG 2.0. As all shared_ptr_foo are
>>> renamed to foo.
>>>
>>> We need to add an extra layer of %rename/%ignore for the SWIG 2.0 case.
>>>
>>> I can do this. But again it introduces another layer of complexity you
>>> mention in your other post.
>>
>> That didn't seem to work. The buildbot now says:
>>
>> File
>> "/home/fenicsslave/jhbuildbot/fenics/lib/python2.6/site-packages/dolfin/mes
>> h/refine.py", line 30, in refine
>>   return mesh.child_shared_ptr()
>> TypeError: in method 'HierarchicalMesh_child_shared_ptr', argument 1
>> of type 'dolfin::Hierarchical< dolfin::Mesh > *'
>>
>> What does that mean? mesh.child_shared_ptr() should return a
>> shared_ptr to an object of class T (in this case Mesh), which it does
>> in the C++ interface. It should not return a pointer to an object of
>> class Hierarchical<T>.
> 
> It is related to the "fix" Garth introduced. He used foo_shared_ptr, but that 
> one does not work for SWIG < 2.0. These methods are now ignored or renamed for 
> all SWIG versions, and everything should be well and fine for both versions of 
> SWIG.
> 

I don't think that this is really a fix. The Python refine should return
a shared_ptr, otherwise we can have problems with things going out of
scope. The underlying problem is SWIG not wrapping the Mesh shared_ptrs
properly.

Garth

> Good night!
> 
> Johan
> 
> _______________________________________________
> Mailing list: https://launchpad.net/~dolfin
> Post to     : dolfin@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dolfin
> More help   : https://help.launchpad.net/ListHelp



Follow ups

References