← Back to team overview

dolfin team mailing list archive

Re: std::vector& in Python

 


On 22/02/11 17:35, Johan Hake wrote:
> 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)
> 

That's the one.

> You should be able to use something like:
> 
>   IN_TYPEMAP_STD_VECTOR_OF_PRIMITIVES(dolfin::uint, INT32, 
>                                       v, NPY_UINT, uint, I)
> 
> 

Where should I put it?

Winding this back, is it desirable to wrap std::vector, or should we use
Array in the C++ interface?

Garth


> 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