BaseSpec "constructor" from C pointer.
This commit is contained in:
parent
80ee8b0d53
commit
314cde1b99
|
@ -6,4 +6,6 @@ cdef class BaseSpec:
|
||||||
cdef qpms_vswf_set_spec_t s
|
cdef qpms_vswf_set_spec_t s
|
||||||
cdef np.ndarray __ilist
|
cdef np.ndarray __ilist
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
cdef BaseSpec from_cpointer(const qpms_vswf_set_spec_t *orig)
|
||||||
cdef qpms_vswf_set_spec_t *rawpointer(BaseSpec self)
|
cdef qpms_vswf_set_spec_t *rawpointer(BaseSpec self)
|
||||||
|
|
|
@ -27,6 +27,7 @@ try:
|
||||||
except AttributeError: # For older Python versions, use IntEnum instead
|
except AttributeError: # For older Python versions, use IntEnum instead
|
||||||
VSWFNorm = enum.IntEnum('VSWFNorm', names=__VSWF_norm_dict, module=__name__)
|
VSWFNorm = enum.IntEnum('VSWFNorm', names=__VSWF_norm_dict, module=__name__)
|
||||||
|
|
||||||
|
|
||||||
cdef class BaseSpec:
|
cdef class BaseSpec:
|
||||||
'''Cython wrapper over qpms_vswf_set_spec_t.
|
'''Cython wrapper over qpms_vswf_set_spec_t.
|
||||||
|
|
||||||
|
@ -39,6 +40,16 @@ cdef class BaseSpec:
|
||||||
#cdef np.ndarray __ilist # in pxd
|
#cdef np.ndarray __ilist # in pxd
|
||||||
#cdef const qpms_uvswfi_t[:] __ilist
|
#cdef const qpms_uvswfi_t[:] __ilist
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
cdef BaseSpec from_cpointer(const qpms_vswf_set_spec_t *orig):
|
||||||
|
'''Makes an instance of BaseSpec from an existing
|
||||||
|
C pointer, copying the contents
|
||||||
|
'''
|
||||||
|
cdef const qpms_uvswfi_t[::1] ilist_orig = <qpms_uvswfi_t[:orig[0].n]> orig[0].ilist
|
||||||
|
cdef BaseSpec bs = BaseSpec(ilist_orig)
|
||||||
|
bs.s.norm = orig[0].norm
|
||||||
|
return bs
|
||||||
|
|
||||||
def __cinit__(self, *args, **kwargs):
|
def __cinit__(self, *args, **kwargs):
|
||||||
cdef const qpms_uvswfi_t[:] ilist_memview
|
cdef const qpms_uvswfi_t[:] ilist_memview
|
||||||
if len(args) == 0:
|
if len(args) == 0:
|
||||||
|
|
Loading…
Reference in New Issue