On Thursday August 22 2013 21:41:18 Anders Logg wrote:
> How do I add a typemap for
>
> std::pair<std::vector<unsigned int>, std::vector<unsigned int> >?
What do you want to map it to? A tuple of 2 numpy arrays?
> I know simple types can be added at the bottom om std_pair.i by
>
> %typemap(out) std::pair<unsigned int, double>
> {
> $result = Py_BuildValue("id", $1.first, $1.second);
> }
>
> and similiar, but will this work for std::vector?
No, these are just for primitive types. A new macro needs to be constructed
for this one, which should be straight forward.
Just construct two numpy arrays and populate them with values from the two
std::vectors, for which there are numerous examples in std_vector.i or
std_map.i. Then call Py_BuildValue using "oo" as the types and pass the two
numpy arrays.
Johan
> --
> Anders
> _______________________________________________
> fenics mailing list
> [email protected]
> http://fenicsproject.org/mailman/listinfo/fenics
_______________________________________________
fenics mailing list
[email protected]
http://fenicsproject.org/mailman/listinfo/fenics