diff --git a/qpms/cytmatrices.pxd b/qpms/cytmatrices.pxd index 51641d9..183ec29 100644 --- a/qpms/cytmatrices.pxd +++ b/qpms/cytmatrices.pxd @@ -14,6 +14,17 @@ cdef class TMatrixInterpolator: cdef inline qpms_tmatrix_interpolator_t *rawpointer(self): return self.interp +cdef class TMatrixGenerator: + cdef qpms_tmatrix_generator_t g + cdef object holder + cdef inline qpms_tmatrix_generator_t raw(self): + return self.g + cdef inline qpms_tmatrix_generator_t *rawpointer(self): + return &(self.g) + +cdef class TMatrixGeneratorTransformed: + pass + cdef class CTMatrix: # N.B. there is another type called TMatrix in tmatrices.py! cdef readonly np.ndarray m # Numpy array holding the matrix data cdef readonly BaseSpec spec # Here we hold the base spec for the correct reference counting; TODO check if it gets copied diff --git a/qpms/cytmatrices.pyx b/qpms/cytmatrices.pyx index 29c8d7c..6ca8afc 100644 --- a/qpms/cytmatrices.pyx +++ b/qpms/cytmatrices.pyx @@ -231,10 +231,6 @@ cdef class __AxialSymParams: cdef class TMatrixGenerator: - cdef qpms_tmatrix_generator_t g - cdef object holder - cdef qpms_tmatrix_generator_t raw(self): - return self.g def __init__(self, what): if isinstance(what, __MieParams): self.holder = what diff --git a/qpms/qpms_c.pyx b/qpms/qpms_c.pyx index c78e764..7f27b17 100644 --- a/qpms/qpms_c.pyx +++ b/qpms/qpms_c.pyx @@ -315,8 +315,10 @@ cdef class ScatteringSystem: Wrapper over the C qpms_scatsys_t structure. ''' cdef list basespecs # Here we keep the references to occuring basespecs + cdef list tmgens # here we keep the references to occuring TMatrixGenerators #cdef list Tmatrices # Here we keep the references to occuring T-matrices cdef qpms_scatsys_t *s + cdef qpms_tmatrix_function_t *tmg # this will ultimately contain pointers to stuff in basespecs and tmgens. def __cinit__(self, particles, FinitePointGroup sym): '''TODO doc. @@ -341,7 +343,7 @@ cdef class ScatteringSystem: for tm in tmobjs: # create references to BaseSpec objects self.basespecs.append(tm.spec) try: - orig.tm = malloc(orig.tm_count * sizeof(orig.tm[0])) + orig.tm = malloc(orig.tm_count * sizeof(orig.tm[0])) if not orig.tm: raise MemoryError orig.p = malloc(orig.p_count * sizeof(orig.p[0])) if not orig.p: raise MemoryError