Working on the wrappers.
Former-commit-id: b957673da9dfcff41c76212de92ee788d7ab844a
This commit is contained in:
parent
97ec91da03
commit
a8488cf18a
|
@ -1037,7 +1037,17 @@ cdef class TMatrix:
|
||||||
'''
|
'''
|
||||||
Wrapper over the C qpms_tmatrix_t stucture.
|
Wrapper over the C qpms_tmatrix_t stucture.
|
||||||
'''
|
'''
|
||||||
pass
|
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 qpms_tmatrix_t t
|
||||||
|
|
||||||
|
def __cinit__(TMatrix self, BaseSpec spec, matrix):
|
||||||
|
self.t.spec = spec.rawpointer();
|
||||||
|
# The following will raise an exception if shape is wrong
|
||||||
|
self.m = np.array(matrix, dtype=complex, copy=True, order='C').reshape((len(spec), len(spec)))
|
||||||
|
cdef cdouble[:,::1] m_memview = self.m
|
||||||
|
self.t.m = &(m_memview[0,0])
|
||||||
|
self.t.owns_m = False # Memory in self.t.m is "owned" by self.m, not by self.t...
|
||||||
|
|
||||||
cdef class FinitePointGroup:
|
cdef class FinitePointGroup:
|
||||||
'''
|
'''
|
||||||
|
@ -1049,8 +1059,14 @@ cdef class Particle:
|
||||||
'''
|
'''
|
||||||
Wrapper over the qpms_particle_t structure.
|
Wrapper over the qpms_particle_t structure.
|
||||||
'''
|
'''
|
||||||
|
cdef readonly qpms_particle_t p
|
||||||
|
cdef readonly TMatrix t # We hold the reference to the T-matrix to ensure correct reference counting
|
||||||
|
|
||||||
|
def __cinit__(Particle self, position, TMatrix t):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
cdef class ScatteringSystem:
|
cdef class ScatteringSystem:
|
||||||
'''
|
'''
|
||||||
Wrapper over the C qpms_scatsys_t structure.
|
Wrapper over the C qpms_scatsys_t structure.
|
||||||
|
|
Loading…
Reference in New Issue