← Back to team overview

dolfin team mailing list archive

Re: Passing MeshFunction as shared_ptr

 

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 >.

--
Anders



> Garth
>
> > Any hints on what needs to be changed in the SWIG files?
> >
> > When I pass a MeshFunction from Python, I get this:
> >
> > TypeError: in method 'Form_set_cell_domains', argument 2 of type
> > 'boost::shared_ptr< dolfin::MeshFunction< dolfin::uint > const >'
> >
>
> _______________________________________________
> 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