dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #21099
Re: std::vector SWIG typemaps
On 29/01/11 21:59, Johan Hake wrote:
> On Saturday January 29 2011 12:14:36 Garth N. Wells wrote:
>> Do we still have std::vector<uint> SWIG typemaps, or were they removed?
>
> I am cleaning up some of the standalone typemaps we have now, putting them
> into a macro. However we need to have a convention for how these are passed.
> For now:
>
> std::vector<PRIMITIVE>& values
>
> will generate an argout typemap, and
>
> const std::vector<PRIMITIVE>& values
>
> will generate an in typemap.
>
> Both of them need to be instantiated calling the macro at the end of
> std_vector_typemaps.i. They all map a NumPy array to/from a std::vector.
>
> I see that the color_type vector is not a const reference and the typemap will
> not kick in. Is the rationale for this that it is small, (only size 3).
Yes.
> Maybee
> this should be mapped to a tuple instead in Python?
Yes, a tuple is appropriate. It tried it quickly, but it didn't work.
Garth
> We have a similare logic
> logic for the pass by value typemap for Expression(std::vector<uint>
> value_shape), which here maps to a list (not a tuple...).
>
> It makes sense to add a typemap macro for pass by value std::vectors, that
> maps to an iterable in Python.
>
> Johan
Follow ups
References