WIP Updating the cython scatsystem etc.

Former-commit-id: ead1919c099cb2a0953310953685df69b7e1cbfb
This commit is contained in:
Marek Nečada 2020-01-10 17:11:55 +02:00
parent be8f55eb1f
commit b708b74292
3 changed files with 14 additions and 5 deletions

View File

@ -14,6 +14,17 @@ cdef class TMatrixInterpolator:
cdef inline qpms_tmatrix_interpolator_t *rawpointer(self): cdef inline qpms_tmatrix_interpolator_t *rawpointer(self):
return self.interp 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 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 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 cdef readonly BaseSpec spec # Here we hold the base spec for the correct reference counting; TODO check if it gets copied

View File

@ -231,10 +231,6 @@ cdef class __AxialSymParams:
cdef class TMatrixGenerator: 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): def __init__(self, what):
if isinstance(what, __MieParams): if isinstance(what, __MieParams):
self.holder = what self.holder = what

View File

@ -315,8 +315,10 @@ cdef class ScatteringSystem:
Wrapper over the C qpms_scatsys_t structure. Wrapper over the C qpms_scatsys_t structure.
''' '''
cdef list basespecs # Here we keep the references to occuring basespecs 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 list Tmatrices # Here we keep the references to occuring T-matrices
cdef qpms_scatsys_t *s 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): def __cinit__(self, particles, FinitePointGroup sym):
'''TODO doc. '''TODO doc.
@ -341,7 +343,7 @@ cdef class ScatteringSystem:
for tm in tmobjs: # create references to BaseSpec objects for tm in tmobjs: # create references to BaseSpec objects
self.basespecs.append(tm.spec) self.basespecs.append(tm.spec)
try: try:
orig.tm = <qpms_tmatrix_t **>malloc(orig.tm_count * sizeof(orig.tm[0])) orig.tm = <qpms_ss_derived_tmatrix_t **>malloc(orig.tm_count * sizeof(orig.tm[0]))
if not orig.tm: raise MemoryError if not orig.tm: raise MemoryError
orig.p = <qpms_particle_tid_t *>malloc(orig.p_count * sizeof(orig.p[0])) orig.p = <qpms_particle_tid_t *>malloc(orig.p_count * sizeof(orig.p[0]))
if not orig.p: raise MemoryError if not orig.p: raise MemoryError