There are no way of passing the data without copying the values from the NumPy array to the std containers. The reason is that there are AFAIK not way of initializing these structures with external data and that is why we have added our own Array<Foo> wrapper of a contiguous array.
If you are OK with copying you can just have a look at the: IN_TYPEMAP_STD_VECTOR_OF_PRIMITIVES in dolfin/swig/typemaps/std_vector.i This typemap only works for passing data in to the method (const std::Foo<Bar>& ). If you want to return data through let say std::Foo<Bar>& you need to implement a argout typemap. Then you can have a look at: ARGOUT_TYPEMAP_STD_VECTOR_OF_PRIMITIVES in the same file. Johan On Sun, Mar 9, 2014 at 9:54 PM, Jan Blechta <[email protected]>wrote: > I'd like to pass numpy array of indices to compiled module as a > shared array. I was thinking about types > > std::shared_ptr<std::vector<std::size_t> > > std::shared_ptr<dolfin::Array<std::size_t> > > boost::shared_array<std::size_t> > std::shared_ptr<std::size_t[]> (with appropriate deleter) > > but I did not figure out how to add typemap using existing macros. Is > there some easy solution? > > Thanks, > Jan > _______________________________________________ > fenics mailing list > [email protected] > http://fenicsproject.org/mailman/listinfo/fenics >
_______________________________________________ fenics mailing list [email protected] http://fenicsproject.org/mailman/listinfo/fenics
