Hi,
I have wrapped a c++ code with SWIG.
Now that code used to read input from ASCII files. I'm trying to replace that part with an input coming from numpy.
I would rather not use setup.py if I have to (but if I can't avoid fine)
I'm looking at SWIG/numpy tutorials
looks like you need to do something like
%apply
2 questions:
1- How do use "apply" for class functions %apply (bla) myobject::foo ?
2-that's ok if your C++ deals with arrays but what if I actually want to receive the Numpy object so that I can manipulate it directly (or if for example the array isn't contiguous in memory)
An"dummy"example of foo function I'd like to wrap:
void FOO::fooNumpy(PyArrayObject *nparray) {
int j;
for(j=0;j<nparray->nd;j++) {
printf("Ok array dim %i has length: %i\n",j,nparray->dimensions[j]);
}
}
Thanks,
C.