dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #21964
Re: Passing MeshFunction as shared_ptr
-
To:
Anders Logg <logg@xxxxxxxxx>
-
From:
"Garth N. Wells" <gnw20@xxxxxxxxx>
-
Date:
Sat, 12 Mar 2011 09:06:54 +0000
-
Cc:
dolfin@xxxxxxxxxxxxxxxxxxx
-
In-reply-to:
<20110311001747.GM2127@eowyn>
-
User-agent:
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.14) Gecko/20110223 Thunderbird/3.1.8
On 11/03/11 00:17, Anders Logg wrote:
> On Fri, Mar 11, 2011 at 12:53:16AM +0100, Anders Logg wrote:
>> On Thu, Mar 10, 2011 at 11:39:52PM +0000, Garth N. Wells wrote:
>>>
>>>
>>> On 10/03/11 23:38, Anders Logg wrote:
>>>> I'm having trouble passing a MeshFunction from the Python interface to
>>>> the following function in the C++ Form class:
>>>>
>>>> void set_cell_domains(boost::shared_ptr<const MeshFunction<uint> > cell_domains);
>>>>
>>>
>>> Change this to
>>>
>>> void set_cell_domains(boost::shared_ptr<const MeshFunction<unsigned
>>> int> > cell_domains);
>>>
>>> (uint -> unsigned int)
>>
>> Same problem (but with uint --> unsigned int):
>>
>> TypeError: in method 'Form_set_cell_domains', argument 2 of type
>> 'boost::shared_ptr< dolfin::MeshFunction< unsigned int > const >'
>>
>> Printing out type() for the argument just prior to the call gives
>>
>> <class 'dolfin.cpp.MeshFunctionUInt'>
>>
>> So somehow it is not recognized that dolfin.cpp.MeshFunctionUint can
>> be used as a 'boost::shared_ptr< dolfin::MeshFunction< unsigned int > const >.
>
> I have temporarily added pure pointer versions of the set_foo_domains
> functions in the Form class. These work fine from Python. These should
> be removed as soon as we figure out how to pass the arguments as
> shared ptrs.
>
The shared_ptr version should work now.
Garth
> --
> Anders
>
Follow ups
References