This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

What is the numpy type corresponding to std::vector<std::size_t> in dolfin?

0 votes

I have a c++ function that takes

std::vector<std::size_t>

as argument. I tried to pass a numpy array to it unsucessfully. I am getting

TypeError: in method 'MeshDomains_get_indices', argument 2 of type 'std::vector< std::size_t >'

I tried

np.empty(0,dtype=np.intp)
np.empty(0,dtype=np.int32)
np.empty(0,dtype=np.uint)
asked Jan 30, 2014 by chaffra FEniCS User (1,830 points)

1 Answer

0 votes

Try:

np.empty(0,dtype=np.uintp)

and most probably you also need to send in an array with the correct size.

answered Jan 30, 2014 by johanhake FEniCS Expert (22,480 points)
...