Set medium generators
Former-commit-id: 4eceb154349587fdb363a3e46073f065aa70fe61
This commit is contained in:
parent
c445b83593
commit
a16cea4dca
|
@ -13,6 +13,7 @@ from .cybspec cimport BaseSpec
|
||||||
from .cycommon cimport make_c_string
|
from .cycommon cimport make_c_string
|
||||||
from .cycommon import string_c2py, PointGroupClass
|
from .cycommon import string_c2py, PointGroupClass
|
||||||
from .cytmatrices cimport CTMatrix, TMatrixFunction, TMatrixGenerator
|
from .cytmatrices cimport CTMatrix, TMatrixFunction, TMatrixGenerator
|
||||||
|
from .cymaterials cimport EpsMuGenerator
|
||||||
from libc.stdlib cimport malloc, free, calloc
|
from libc.stdlib cimport malloc, free, calloc
|
||||||
import warnings
|
import warnings
|
||||||
|
|
||||||
|
@ -337,6 +338,7 @@ cdef class ScatteringSystem:
|
||||||
'''
|
'''
|
||||||
cdef list tmgobjs # here we keep the references to occuring TMatrixFunctions (and hence BaseSpecs and TMatrixGenerators)
|
cdef list tmgobjs # here we keep the references to occuring TMatrixFunctions (and hence BaseSpecs and 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 EpsMuGenerator medium_holder # Here we keep the reference to medium generator
|
||||||
cdef qpms_scatsys_t *s
|
cdef qpms_scatsys_t *s
|
||||||
|
|
||||||
def check_s(self): # cdef instead?
|
def check_s(self): # cdef instead?
|
||||||
|
@ -345,7 +347,7 @@ cdef class ScatteringSystem:
|
||||||
#TODO is there a way to disable the constructor outside this module?
|
#TODO is there a way to disable the constructor outside this module?
|
||||||
|
|
||||||
@staticmethod # We don't have any "standard" constructor for this right now
|
@staticmethod # We don't have any "standard" constructor for this right now
|
||||||
def create(particles, FinitePointGroup sym, cdouble omega): # TODO tolerances
|
def create(particles, medium, FinitePointGroup sym, cdouble omega): # TODO tolerances
|
||||||
# These we are going to construct
|
# These we are going to construct
|
||||||
cdef ScatteringSystem self
|
cdef ScatteringSystem self
|
||||||
cdef _ScatteringSystemAtOmega pyssw
|
cdef _ScatteringSystemAtOmega pyssw
|
||||||
|
@ -378,7 +380,8 @@ cdef class ScatteringSystem:
|
||||||
tmindices[tm_derived_key] = tm_count
|
tmindices[tm_derived_key] = tm_count
|
||||||
tmlist.append(tm_derived_key)
|
tmlist.append(tm_derived_key)
|
||||||
tm_count += 1
|
tm_count += 1
|
||||||
|
cdef EpsMuGenerator mediumgen = EpsMuGenerator(medium)
|
||||||
|
orig.medium = mediumgen.g
|
||||||
orig.tmg_count = tmg_count
|
orig.tmg_count = tmg_count
|
||||||
orig.tm_count = tm_count
|
orig.tm_count = tm_count
|
||||||
orig.p_count = p_count
|
orig.p_count = p_count
|
||||||
|
@ -393,7 +396,7 @@ cdef class ScatteringSystem:
|
||||||
orig.tmg[tmgi] = (<TMatrixFunction?>tmgobjs[tmgi]).raw()
|
orig.tmg[tmgi] = (<TMatrixFunction?>tmgobjs[tmgi]).raw()
|
||||||
for tmi in range(tm_count):
|
for tmi in range(tm_count):
|
||||||
tm_derived_key = tmlist[tmi]
|
tm_derived_key = tmlist[tmi]
|
||||||
tmgi = tmgindices[tmg_key[0]]
|
tmgi = tmgindices[tm_derived_key[0]]
|
||||||
orig.tm[tmi].tmgi = tmgi
|
orig.tm[tmi].tmgi = tmgi
|
||||||
orig.tm[tmi].op = qpms_tmatrix_operation_noop # TODO adjust when notrivial operations allowed
|
orig.tm[tmi].op = qpms_tmatrix_operation_noop # TODO adjust when notrivial operations allowed
|
||||||
for pi in range(p_count):
|
for pi in range(p_count):
|
||||||
|
@ -409,6 +412,7 @@ cdef class ScatteringSystem:
|
||||||
free(orig.tm)
|
free(orig.tm)
|
||||||
free(orig.p)
|
free(orig.p)
|
||||||
self = ScatteringSystem()
|
self = ScatteringSystem()
|
||||||
|
self.medium_holder = mediumgen
|
||||||
self.s = ss
|
self.s = ss
|
||||||
self.tmgobjs = tmgobjs
|
self.tmgobjs = tmgobjs
|
||||||
pyssw = _ScatteringSystemAtOmega()
|
pyssw = _ScatteringSystemAtOmega()
|
||||||
|
|
|
@ -180,6 +180,7 @@ qpms_scatsys_at_omega_t *qpms_scatsys_apply_symmetry(const qpms_scatsys_t *orig,
|
||||||
QPMS_CRASHING_MALLOC(ss, sizeof(qpms_scatsys_t));
|
QPMS_CRASHING_MALLOC(ss, sizeof(qpms_scatsys_t));
|
||||||
ss->lenscale = lenscale;
|
ss->lenscale = lenscale;
|
||||||
ss->sym = sym;
|
ss->sym = sym;
|
||||||
|
ss->medium = orig->medium;
|
||||||
|
|
||||||
// Copy the qpms_tmatrix_fuction_t from orig
|
// Copy the qpms_tmatrix_fuction_t from orig
|
||||||
ss->tmg_count = orig->tmg_count;
|
ss->tmg_count = orig->tmg_count;
|
||||||
|
|
|
@ -217,7 +217,7 @@ typedef struct qpms_scatsys_at_omega_t {
|
||||||
* so keep them alive until scatsys is destroyed.
|
* so keep them alive until scatsys is destroyed.
|
||||||
*
|
*
|
||||||
* The following fields must be filled in the "proto- scattering system" \a orig:
|
* The following fields must be filled in the "proto- scattering system" \a orig:
|
||||||
* * orig->medium – The pointer is copied to the new qpms_scatsys_t instance;
|
* * orig->medium – The pointers are copied to the new qpms_scatsys_t instance;
|
||||||
* the target qpms_abstract_tmatrix_t objects must be kept alive before all the resulting
|
* the target qpms_abstract_tmatrix_t objects must be kept alive before all the resulting
|
||||||
* qpms_scatsys_t instances are properly destroyed.
|
* qpms_scatsys_t instances are properly destroyed.
|
||||||
* * orig->tmg – The pointers are copied to the new qpms_scatsys_t instance;
|
* * orig->tmg – The pointers are copied to the new qpms_scatsys_t instance;
|
||||||
|
|
Loading…
Reference in New Issue