Expose single vswf functions to cython.
Former-commit-id: 7fd1183cdab2d6f60b446879a875dab4d673da73
This commit is contained in:
parent
1bf9c0b44e
commit
5a9219a4f6
|
@ -18,11 +18,12 @@ except ImportError as ex:
|
||||||
raise ex
|
raise ex
|
||||||
from .qpms_p import *
|
from .qpms_p import *
|
||||||
from .cyquaternions import CQuat, IRot3
|
from .cyquaternions import CQuat, IRot3
|
||||||
from .cybspec import VSWFNorm, BaseSpec
|
from .cybspec import VSWFNorm, BaseSpec, default_bspec
|
||||||
from .cytmatrices import CTMatrix, TMatrixInterpolator, TMatrixGenerator
|
from .cytmatrices import CTMatrix, TMatrixInterpolator, TMatrixGenerator
|
||||||
from .cytranslations import trans_calculator
|
from .cytranslations import trans_calculator
|
||||||
from .cymaterials import MaterialInterpolator, EpsMu, LorentzDrudeModel, lorentz_drude, EpsMuGenerator
|
from .cymaterials import MaterialInterpolator, EpsMu, LorentzDrudeModel, lorentz_drude, EpsMuGenerator
|
||||||
from .cycommon import dbgmsg_enable, dbgmsg_disable, dbgmsg_active, BesselType
|
from .cycommon import dbgmsg_enable, dbgmsg_disable, dbgmsg_active, BesselType, VSWFType
|
||||||
|
from .cywaves import vswf_single
|
||||||
from .lattices2d import *
|
from .lattices2d import *
|
||||||
from .hexpoints import *
|
from .hexpoints import *
|
||||||
from .tmatrices import *
|
from .tmatrices import *
|
||||||
|
|
|
@ -119,3 +119,4 @@ cdef class BaseSpec:
|
||||||
def __get__(self):
|
def __get__(self):
|
||||||
return VSWFNorm(self.s.norm)
|
return VSWFNorm(self.s.norm)
|
||||||
|
|
||||||
|
default_bspec = BaseSpec(lMax=2)
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
from qpms_cdefs cimport *
|
||||||
|
|
||||||
|
from .cybspec cimport BaseSpec
|
||||||
|
from .cybspec import VSWFNorm, default_bspec
|
||||||
|
from .cycommon import VSWFType, BesselType
|
||||||
|
|
||||||
|
def vswf_single(kr_csph, qpms_vswf_type_t t, qpms_l_t l, qpms_m_t m,
|
||||||
|
qpms_bessel_t btyp = QPMS_BESSEL_REGULAR, qpms_normalisation_t norm = default_bspec.norm):
|
||||||
|
cdef csph_t kr
|
||||||
|
kr.r, kr.theta, kr.phi = kr_csph
|
||||||
|
if t == QPMS_VSWF_ELECTRIC:
|
||||||
|
return qpms_vswf_single_el_csph(m, l, kr, btyp, norm)
|
||||||
|
elif t == QPMS_VSWF_MAGNETIC:
|
||||||
|
return qpms_vswf_single_mg_csph(m, l, kr, btyp, norm)
|
||||||
|
elif t == QPMS_VSWF_LONGITUDINAL:
|
||||||
|
raise NotImplementedError("Longitudinal single waves not yet implemented, sorry.")
|
||||||
|
else:
|
||||||
|
raise ValueError("Invalid wave type specified")
|
||||||
|
|
||||||
|
|
|
@ -488,7 +488,7 @@ cdef class ScatteringMatrix:
|
||||||
qpms_scatsys_scatter_solve(&f_view[0], &a_view[0], self.lu)
|
qpms_scatsys_scatter_solve(&f_view[0], &a_view[0], self.lu)
|
||||||
return f
|
return f
|
||||||
|
|
||||||
def pitau(double theta, qpms_l_t lMax, double csphase = 1):
|
def pitau(double theta, qpms_l_t lMax, double csphase = -1):
|
||||||
if(abs(csphase) != 1):
|
if(abs(csphase) != 1):
|
||||||
raise ValueError("csphase must be 1 or -1, is %g" % csphase)
|
raise ValueError("csphase must be 1 or -1, is %g" % csphase)
|
||||||
cdef size_t nelem = qpms_lMax2nelem(lMax)
|
cdef size_t nelem = qpms_lMax2nelem(lMax)
|
||||||
|
|
|
@ -160,6 +160,8 @@ cdef extern from "vswf.h":
|
||||||
qpms_incfield_planewave_params_E E
|
qpms_incfield_planewave_params_E E
|
||||||
qpms_errno_t qpms_incfield_planewave(cdouble target, const qpms_vswf_set_spec_t *bspec,
|
qpms_errno_t qpms_incfield_planewave(cdouble target, const qpms_vswf_set_spec_t *bspec,
|
||||||
const cart3_t evalpoint, const void *args, bint add)
|
const cart3_t evalpoint, const void *args, bint add)
|
||||||
|
csphvec_t qpms_vswf_single_el_csph(qpms_m_t m, qpms_l_t n, csph_t kdlj, qpms_bessel_t btyp, qpms_normalisation_t norm)
|
||||||
|
csphvec_t qpms_vswf_single_mg_csph(qpms_m_t m, qpms_l_t n, csph_t kdlj, qpms_bessel_t btyp, qpms_normalisation_t norm)
|
||||||
|
|
||||||
cdef extern from "indexing.h":
|
cdef extern from "indexing.h":
|
||||||
qpms_y_t qpms_lMax2nelem(qpms_l_t lMax)
|
qpms_y_t qpms_lMax2nelem(qpms_l_t lMax)
|
||||||
|
|
|
@ -128,16 +128,16 @@ qpms_errno_t qpms_incfield_planewave(
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
|
|
||||||
/// Electric wave N.
|
/// Electric wave N.
|
||||||
csphvec_t qpms_vswf_single_el(int m, int n, sph_t kdlj,
|
csphvec_t qpms_vswf_single_el(qpms_m_t m, qpms_l_t n, sph_t kdlj,
|
||||||
qpms_bessel_t btyp, qpms_normalisation_t norm);
|
qpms_bessel_t btyp, qpms_normalisation_t norm);
|
||||||
/// Magnetic wave M.
|
/// Magnetic wave M.
|
||||||
csphvec_t qpms_vswf_single_mg(int m, int n, sph_t kdlj,
|
csphvec_t qpms_vswf_single_mg(qpms_m_t m, qpms_l_t n, sph_t kdlj,
|
||||||
qpms_bessel_t btyp, qpms_normalisation_t norm);
|
qpms_bessel_t btyp, qpms_normalisation_t norm);
|
||||||
/// Electric wave N, complex wave number version.
|
/// Electric wave N, complex wave number version.
|
||||||
csphvec_t qpms_vswf_single_el_csph(int m, int n, csph_t kdlj,
|
csphvec_t qpms_vswf_single_el_csph(qpms_m_t m, qpms_l_t n, csph_t kdlj,
|
||||||
qpms_bessel_t btyp, qpms_normalisation_t norm);
|
qpms_bessel_t btyp, qpms_normalisation_t norm);
|
||||||
/// Magnetic wave M, complex wave number version..
|
/// Magnetic wave M, complex wave number version..
|
||||||
csphvec_t qpms_vswf_single_mg_csph(int m, int n, csph_t kdlj,
|
csphvec_t qpms_vswf_single_mg_csph(qpms_m_t m, qpms_l_t n, csph_t kdlj,
|
||||||
qpms_bessel_t btyp, qpms_normalisation_t norm);
|
qpms_bessel_t btyp, qpms_normalisation_t norm);
|
||||||
|
|
||||||
/// Set of electric and magnetic VSWF values in spherical coordinate basis.
|
/// Set of electric and magnetic VSWF values in spherical coordinate basis.
|
||||||
|
|
6
setup.py
6
setup.py
|
@ -92,6 +92,10 @@ cytmatrices = Extension('qpms.cytmatrices',
|
||||||
#extra_link_args=['qpms/libqpms.a', 'amos/libamos.a'],
|
#extra_link_args=['qpms/libqpms.a', 'amos/libamos.a'],
|
||||||
libraries=['qpms', 'gsl', 'lapacke', 'blas', 'gslcblas', 'pthread',]
|
libraries=['qpms', 'gsl', 'lapacke', 'blas', 'gslcblas', 'pthread',]
|
||||||
)
|
)
|
||||||
|
cywaves = Extension('qpms.cywaves',
|
||||||
|
sources = ['qpms/cywaves.pyx'],
|
||||||
|
libraries=['qpms', 'gsl', 'lapacke', 'blas', 'gslcblas', 'pthread',]
|
||||||
|
)
|
||||||
cytranslations = Extension('qpms.cytranslations',
|
cytranslations = Extension('qpms.cytranslations',
|
||||||
sources = ['qpms/cytranslations.pyx',
|
sources = ['qpms/cytranslations.pyx',
|
||||||
'qpms/translations_python.c',
|
'qpms/translations_python.c',
|
||||||
|
@ -140,7 +144,7 @@ setup(name='qpms',
|
||||||
#'quaternion','spherical_functions',
|
#'quaternion','spherical_functions',
|
||||||
'scipy>=0.18.0', 'sympy>=1.2'],
|
'scipy>=0.18.0', 'sympy>=1.2'],
|
||||||
#dependency_links=['https://github.com/moble/quaternion/archive/v2.0.tar.gz','https://github.com/moble/spherical_functions/archive/master.zip'],
|
#dependency_links=['https://github.com/moble/quaternion/archive/v2.0.tar.gz','https://github.com/moble/spherical_functions/archive/master.zip'],
|
||||||
ext_modules=cythonize([qpms_c, cytranslations, cytmatrices, cycommon, cyquaternions, cybspec, cymaterials], include_path=['qpms', 'amos'], gdb_debug=True),
|
ext_modules=cythonize([qpms_c, cywaves, cytranslations, cytmatrices, cycommon, cyquaternions, cybspec, cymaterials], include_path=['qpms', 'amos'], gdb_debug=True),
|
||||||
cmdclass = {'build_ext': build_ext},
|
cmdclass = {'build_ext': build_ext},
|
||||||
zip_safe=False
|
zip_safe=False
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue