Calling C++ from Python (1)

Instead of just calling
ext_gridloop.gridloop1(a, self.xcoor, self.ycoor, func)
return a
as before, we need some explicit conversions:
# a is a NumPy array
# self.c is the conversion module (class Convert_MyArray)
a_p = self.c.py2my(a)
x_p = self.c.py2my(self.xcoor)
y_p = self.c.py2my(self.ycoor)
f_p = self.c.set_pyfunc(func)
ext_gridloop.gridloop1(a_p, x_p, y_p, f_p)
return a  # a_p and a share data!

previousnexttable of contents