dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #21962
Re: Passing MeshFunction as shared_ptr
On Sat, Mar 12, 2011 at 01:01:43AM +0000, Garth N. Wells wrote:
>
>
> On 11/03/11 15:51, Johan Hake wrote:
> > On Mar 11, 2011, at 3:10, "Garth N. Wells" <gnw20@xxxxxxxxx> wrote:
> >
> >>
> >>
> >> On 11/03/11 00:24, Anders Logg wrote:
> >>> On Thu, Mar 10, 2011 at 04:20:51PM -0800, Johan Hake wrote:
> >>>> On Thursday March 10 2011 16:17:49 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.
> >>>>
> >>>> I need some time to get into the changes Garth has done. If it
> >>>> is not fixed by then I can take a look at it, weekendish...
> >>>
> >>
> >> I looks like shared_ptrs are not declared for MeshFunctions in the
> >> SWIG version < 2 part of the interface.
> >
> > That should be easily fixed.
> >
> >> When do we want to move to SWIG 2 only?
> >
> > I think it would be nice to try this for the next release. If we
> > decide for it I can take a shot at it sometime next week.
> >
>
> I say that we do it now - I'm tired of wasting time making the old
> version of SWIG work (I need SWIG 2.0 for Trilinos). 2.0 is *much*
> better for shared pointers.
>
> We can make the change now and developers can install the SWIG 2. We can
> figure out the swig2.0 executable issue during the next week.
>
> If anyone has an objection, please speak up quickly.
No objections.
--
Anders
References