← Back to team overview

dolfin team mailing list archive

Re: std::vector& in Python

 

What is the signature?

Have you tried using:

  PY_SEQUENCE_OF_SCALARS_TO_VECTOR_OF_PRIMITIVES(TYPE, 
                                                 TYPE_UPPER, 
                                                 ARG_NAME,
						 TYPE_NAME, 
                                                 SEQ_LENGTH)

Look at the end of std_vector_typemaps.i for example of its use.

Then you can pass any iterable for the values.

If you want to expose 

   add_cell(uint c, const std::vector<uint>& v)

You should be able to use something like:

  IN_TYPEMAP_STD_VECTOR_OF_PRIMITIVES(dolfin::uint, INT32, 
                                      v, NPY_UINT, uint, I)


Johan

On Tuesday February 22 2011 09:29:24 Garth N. Wells wrote:
> I tried to use a function in MeshEditor from the Python interface, but
> failed because it expects a const std::vector<uint>&. What's the status
> of wrapping small std::vectors? Should it work, or should the C++
> interface be changed to use a dolfin::Array?
> 
> Garth
> 
> _______________________________________________
> 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