<div dir="ltr">I have a struct with an associated SIP specification file:<div><font face="monospace, monospace"><br></font></div><div><div><font face="monospace, monospace">class SiftPoint{</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">    %TypeHeaderCode</font></div><div><font face="monospace, monospace">      #include "cudaSift.h"</font></div><div><font face="monospace, monospace">      #include "numpy/arrayobject.h"</font></div><div><font face="monospace, monospace">    %End</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">    %TypeCode</font></div><div><font face="monospace, monospace">      PyObject *makearray(float array[], size_t size)</font></div><div><font face="monospace, monospace">      {</font></div><div><font face="monospace, monospace">      import_array();</font></div><div><font face="monospace, monospace">      npy_intp dim = size;</font></div><div><font face="monospace, monospace">      return PyArray_SimpleNewFromData(1, &dim, NPY_FLOAT32, (void *)array);</font></div><div><font face="monospace, monospace">      }</font></div><div><font face="monospace, monospace">    %End</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">    public:</font></div><div><font face="monospace, monospace">      float xpos;</font></div><div><font face="monospace, monospace">      float ypos;</font></div><div><font face="monospace, monospace">      float scale;</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">      //float data[128];</font></div><div><font face="monospace, monospace">      float get_descriptor();</font></div><div><font face="monospace, monospace">      %MethodCode</font></div><div><font face="monospace, monospace">        return makearray(sipCpp->data, 128);</font></div><div><font face="monospace, monospace">      %End</font></div></div><div><br></div><div>I have been able to work with the array data by using method code and passing out to a numpy array (which is working well).</div><div><br></div><div>I then have a second struct also exposed as a class that contains a pointer to some number of SiftPoint instances.</div><div><br></div><div><div><font face="monospace, monospace">  //SiftData</font></div><div><font face="monospace, monospace">  class SiftData{</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">  %TypeHeaderCode</font></div><div><font face="monospace, monospace">    #include "cudaSift.h"</font></div><div><font face="monospace, monospace">  %End</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">  public:</font></div><div><font face="monospace, monospace">    int numPts;</font></div><div><font face="monospace, monospace">    int maxPts;</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">    //SiftPoint *h_data;</font></div><div><font face="monospace, monospace">    SIP_PYLIST host_data();</font></div><div><font face="monospace, monospace">    %MethodCode</font></div><div><font face="monospace, monospace">      size_t size = sipCpp->numPts;</font></div><div><font face="monospace, monospace">      PyObject *l = PyList_New(sipCpp->numPts);</font></div><div><font face="monospace, monospace">      for (size_t i = 0; i != size; i++){</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">        SiftPoint sp = sipCpp->h_data[i];</font></div><div><font face="monospace, monospace">        printf("%f, %f\n", sp.xpos, sp.ypos);</font></div><div><font face="monospace, monospace">        PyObject *p = sipConvertFromType((void*)(&sp),sipType_SiftPoint, NULL);</font></div><div><span style="font-family:monospace,monospace">        PyList_SetItem(l, i, p);</span><br></div><div><font face="monospace, monospace">      }</font></div><div><font face="monospace, monospace">      return l;</font></div><div><font face="monospace, monospace">    %End</font></div><div><font face="monospace, monospace">    //Not exposed via Python</font></div><div><font face="monospace, monospace">    //SiftPoint *d_data;</font></div><div><font face="monospace, monospace">  };</font></div></div><div><font face="monospace, monospace"><br></font></div>Here, I am trying to expose a PyList of SiftPoint instances.  My understanding is that I need to use sipConvertFromType to convert the already mapped type to a python type before entry into a PyList.  The above code is compiling without issue, and I can see all of the SiftPoint class attributes.  Unfortunately, all of the attributes are returning NaN (as opposed to some float value).<div><br></div><div>Am I missing something in the conversion of an already mapped type?  </div><div><br></div><div>Thanks!</div></div>