← Back to team overview

dolfin team mailing list archive

Re: std::vector SWIG typemaps

 

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). Maybee 
this should be mapped to a tuple instead in Python? 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