Hi,
I'll repeat it below for convenience. Say I have the following C struct (in dlist.h):
typedef struct {
double dx, dy, dz; // relative vector coordinates.
long i, j; // involved atoms. vector points from i to j.
double gx, gy, gz; // derivative of energy towards relative vector coordinates.
} dlist_row_type;
My corresponding Cython struct is:
cdef extern from "dlist.h":
ctypedef struct dlist_row_type:
double dx, dy, dz
long i, j
double gx, gy, gz
I'm currently creating a compatible Numpy dtype as follows:
cdef dlist.dlist_row_type _dlist_row_tmp
delta_dtype = np.asarray(<dlist.dlist_row_type[:1]>(&_dlist_row_tmp)).dtype
This is a reasonable cross-platform solution but it involves a temporary variable. Is there a way to get this dtype without a temporary variable? I'd like to avoid manually entering all the fields in the dtype, which I did before. That is difficult to get to work on different platforms with the same code. Thanks!
Best Regards,
Toon