Compare commits

...

3 Commits

Author SHA1 Message Date
Marek Nečada 9193084473 Fix missing import in finiterectlat-scatter.py
continuous-integration/drone/push Build was killed Details
2023-12-26 12:36:21 +02:00
Marek Nečada 8201c6c1d8 Specify cython langauge_level 2023-12-24 16:38:14 +02:00
Marek Nečada bd98ff994b Minimal amount of noexcept to make it compile with cython 3 2023-12-24 16:35:27 +02:00
6 changed files with 10 additions and 10 deletions

View File

@ -1,8 +1,8 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
from qpms.argproc import ArgParser, annotate_pdf_metadata
import math import math
pi = math.pi pi = math.pi
from qpms.argproc import ArgParser
ap = ArgParser(['rectlattice2d_finite', 'single_particle', 'single_lMax', 'omega_seq_real_ng', 'planewave']) ap = ArgParser(['rectlattice2d_finite', 'single_particle', 'single_lMax', 'omega_seq_real_ng', 'planewave'])

View File

@ -179,7 +179,7 @@ lorentz_drude = {
} }
cdef qpms_epsmu_t python_epsmu_generator(cdouble omega, const void *params): cdef qpms_epsmu_t python_epsmu_generator(cdouble omega, const void *params) noexcept:
cdef object fun = <object> params cdef object fun = <object> params
cdef qpms_epsmu_t em cdef qpms_epsmu_t em
em.eps, em.mu = fun(omega) em.eps, em.mu = fun(omega)

View File

@ -161,14 +161,14 @@ cdef class __ArcSphere:
def __init__(self, r): def __init__(self, r):
self.r = r self.r = r
cdef qpms_arc_function_retval_t userarc(double theta, const void *params): cdef qpms_arc_function_retval_t userarc(double theta, const void *params) noexcept:
cdef object fun = <object> params cdef object fun = <object> params
cdef qpms_arc_function_retval_t retval cdef qpms_arc_function_retval_t retval
retval.r, retval.beta = fun(theta) retval.r, retval.beta = fun(theta)
return retval return retval
cdef qpms_errno_t qpms_tmatrix_generator_pythoncallable( cdef qpms_errno_t qpms_tmatrix_generator_pythoncallable(
qpms_tmatrix_t *t, cdouble omega, const void *param): qpms_tmatrix_t *t, cdouble omega, const void *param) noexcept:
'''Use a python callable as a T-matrix generator '''Use a python callable as a T-matrix generator
fun is expected to be callable as fun is expected to be callable as

View File

@ -44,7 +44,7 @@ In simple words, it works like this:
# This one is probably not used anymore an can perhaps be removed: # This one is probably not used anymore an can perhaps be removed:
cdef void loop_D_iiiidddii_As_D_lllldddbl(char **args, np.npy_intp *dims, np.npy_intp *steps, void *data) nogil: cdef void loop_D_iiiidddii_As_D_lllldddbl(char **args, np.npy_intp *dims, np.npy_intp *steps, void *data) noexcept nogil:
cdef np.npy_intp i, n = dims[0] cdef np.npy_intp i, n = dims[0]
cdef void *func = (<void**>data)#[0] cdef void *func = (<void**>data)#[0]
#cdef char *func_name= <char*>(<void**>data)[1] # i am not using this, nor have I saved func_name to data #cdef char *func_name= <char*>(<void**>data)[1] # i am not using this, nor have I saved func_name to data
@ -142,7 +142,7 @@ ctypedef struct trans_calculator_get_X_data_t:
qpms_trans_calculator* c qpms_trans_calculator* c
void* cmethod void* cmethod
cdef void trans_calculator_loop_D_Ciiiidddii_As_D_lllldddbl(char **args, np.npy_intp *dims, np.npy_intp *steps, void *data) nogil: cdef void trans_calculator_loop_D_Ciiiidddii_As_D_lllldddbl(char **args, np.npy_intp *dims, np.npy_intp *steps, void *data) noexcept nogil:
cdef np.npy_intp i, n = dims[0] cdef np.npy_intp i, n = dims[0]
cdef void *func = (<trans_calculator_get_X_data_t*>data)[0].cmethod cdef void *func = (<trans_calculator_get_X_data_t*>data)[0].cmethod
#cdef cdouble (*func)(qpms_trans_calculator*, int, int, int, int, double, double, double, int, int) nogil = (<trans_calculator_get_X_data_t*>data)[0].cmethod #cdef cdouble (*func)(qpms_trans_calculator*, int, int, int, int, double, double, double, int, int) nogil = (<trans_calculator_get_X_data_t*>data)[0].cmethod
@ -188,7 +188,7 @@ cdef void trans_calculator_loop_D_Ciiiidddii_As_D_lllldddbl(char **args, np.npy_
# sf_error.check_fpe(func_name) # sf_error.check_fpe(func_name)
cdef void trans_calculator_loop_E_C_DD_iiiidddii_As_lllldddbl_DD(char **args, np.npy_intp *dims, np.npy_intp *steps, void *data) nogil: cdef void trans_calculator_loop_E_C_DD_iiiidddii_As_lllldddbl_DD(char **args, np.npy_intp *dims, np.npy_intp *steps, void *data) noexcept nogil:
# E stands for error value (int), C for qpms_trans_calculator* # E stands for error value (int), C for qpms_trans_calculator*
cdef np.npy_intp i, n = dims[0] cdef np.npy_intp i, n = dims[0]
cdef void *func = (<trans_calculator_get_X_data_t*>data)[0].cmethod cdef void *func = (<trans_calculator_get_X_data_t*>data)[0].cmethod
@ -241,7 +241,7 @@ cdef void trans_calculator_loop_E_C_DD_iiiidddii_As_lllldddbl_DD(char **args, np
@cython.boundscheck(False) @cython.boundscheck(False)
@cython.wraparound(False) @cython.wraparound(False)
cdef void trans_calculator_parallel_loop_E_C_DD_iiiidddii_As_lllldddbl_DD(char **args, np.npy_intp *dims, np.npy_intp *steps, void *data) nogil: cdef void trans_calculator_parallel_loop_E_C_DD_iiiidddii_As_lllldddbl_DD(char **args, np.npy_intp *dims, np.npy_intp *steps, void *data) noexcept nogil:
# E stands for error value (int), C for qpms_trans_calculator* # E stands for error value (int), C for qpms_trans_calculator*
cdef np.npy_intp i, n = dims[0] cdef np.npy_intp i, n = dims[0]
cdef void *func = (<trans_calculator_get_X_data_t*>data)[0].cmethod cdef void *func = (<trans_calculator_get_X_data_t*>data)[0].cmethod

View File

@ -31,7 +31,7 @@ cdef int pgsl_errno = 0
cdef int *pgsl_errno_ignorelist = NULL # list of ignored error codes, terminated by zero cdef int *pgsl_errno_ignorelist = NULL # list of ignored error codes, terminated by zero
# This error handler only sets the variables above # This error handler only sets the variables above
cdef void pgsl_error_handler(const char *reason, const char *_file, const int line, const int gsl_errno): cdef void pgsl_error_handler(const char *reason, const char *_file, const int line, const int gsl_errno) noexcept:
global pgsl_err_reason, pgsl_err_file, pgsl_err_line, pgsl_errno, pgsl_errno_ignorelist global pgsl_err_reason, pgsl_err_file, pgsl_err_line, pgsl_errno, pgsl_errno_ignorelist
cdef size_t i cdef size_t i
if(pgsl_errno_ignorelist): if(pgsl_errno_ignorelist):

View File

@ -163,7 +163,7 @@ setup(name='qpms',
#'quaternion','spherical_functions', #'quaternion','spherical_functions',
'sympy>=1.2', 'numpy>=1.2'], 'sympy>=1.2', 'numpy>=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, cywaves, cytranslations, cytmatrices, cycommon, cyquaternions, cybspec, cymaterials, cyewaldtest], include_path=['qpms', 'amos'], gdb_debug=True), ext_modules=cythonize([qpms_c, cywaves, cytranslations, cytmatrices, cycommon, cyquaternions, cybspec, cymaterials, cyewaldtest], include_path=['qpms', 'amos'], gdb_debug=True, language_level=3),
cmdclass = {'build_ext': build_ext}, cmdclass = {'build_ext': build_ext},
zip_safe=False zip_safe=False
) )