fix: use of noexcept

This commit is contained in:
Guilhem Lavaux 2024-11-01 17:41:00 +02:00
parent f61839c82e
commit 7e6419e0f0
2 changed files with 13 additions and 13 deletions

View File

@ -27,7 +27,7 @@ cdef extern from "openmp.hpp" namespace "sphereproj":
@cython.wraparound(False) @cython.wraparound(False)
cdef void interp3d_INTERNAL_periodic(DTYPE_t x, DTYPE_t y, cdef void interp3d_INTERNAL_periodic(DTYPE_t x, DTYPE_t y,
DTYPE_t z, DTYPE_t z,
DTYPE_t[:,:,:] d, DTYPE_t Lbox, DTYPE_t *retval) nogil: DTYPE_t[:,:,:] d, DTYPE_t Lbox, DTYPE_t *retval) noexcept nogil:
cdef int Ngrid = d.shape[0] cdef int Ngrid = d.shape[0]
cdef DTYPE_t inv_delta = Ngrid/Lbox cdef DTYPE_t inv_delta = Ngrid/Lbox
@ -86,7 +86,7 @@ cdef void interp3d_INTERNAL_periodic(DTYPE_t x, DTYPE_t y,
@cython.wraparound(False) @cython.wraparound(False)
cdef void ngp3d_INTERNAL_periodic(DTYPE_t x, DTYPE_t y, cdef void ngp3d_INTERNAL_periodic(DTYPE_t x, DTYPE_t y,
DTYPE_t z, DTYPE_t z,
DTYPE_t[:,:,:] d, DTYPE_t Lbox, DTYPE_t *retval) nogil: DTYPE_t[:,:,:] d, DTYPE_t Lbox, DTYPE_t *retval) noexcept nogil:
cdef int Ngrid = d.shape[0] cdef int Ngrid = d.shape[0]
cdef DTYPE_t inv_delta = Ngrid/Lbox cdef DTYPE_t inv_delta = Ngrid/Lbox
@ -116,7 +116,7 @@ cdef void ngp3d_INTERNAL_periodic(DTYPE_t x, DTYPE_t y,
@cython.wraparound(False) @cython.wraparound(False)
cdef void ngp3d_INTERNAL(DTYPE_t x, DTYPE_t y, cdef void ngp3d_INTERNAL(DTYPE_t x, DTYPE_t y,
DTYPE_t z, DTYPE_t z,
DTYPE_t[:,:,:] d, DTYPE_t Lbox, DTYPE_t *retval, DTYPE_t inval) nogil: DTYPE_t[:,:,:] d, DTYPE_t Lbox, DTYPE_t *retval, DTYPE_t inval) noexcept nogil:
cdef int Ngrid = d.shape[0] cdef int Ngrid = d.shape[0]
cdef DTYPE_t inv_delta = Ngrid/Lbox cdef DTYPE_t inv_delta = Ngrid/Lbox
@ -145,7 +145,7 @@ cdef void ngp3d_INTERNAL(DTYPE_t x, DTYPE_t y,
@cython.wraparound(False) @cython.wraparound(False)
cdef void interp3d_INTERNAL(DTYPE_t x, DTYPE_t y, cdef void interp3d_INTERNAL(DTYPE_t x, DTYPE_t y,
DTYPE_t z, DTYPE_t z,
DTYPE_t[:,:,:] d, DTYPE_t Lbox, DTYPE_t *retval, DTYPE_t inval) nogil: DTYPE_t[:,:,:] d, DTYPE_t Lbox, DTYPE_t *retval, DTYPE_t inval) noexcept nogil:
cdef int Ngrid = d.shape[0] cdef int Ngrid = d.shape[0]
cdef DTYPE_t inv_delta = Ngrid/Lbox cdef DTYPE_t inv_delta = Ngrid/Lbox
@ -386,7 +386,7 @@ def interp2d(x not None, y not None,
@cython.boundscheck(False) @cython.boundscheck(False)
@cython.cdivision(True) @cython.cdivision(True)
cdef void INTERNAL_project_cic_no_mass(DTYPE_t[:,:,:] g, cdef void INTERNAL_project_cic_no_mass(DTYPE_t[:,:,:] g,
DTYPE_t[:,:] x, int Ngrid, double Lbox, double shifter) nogil: DTYPE_t[:,:] x, int Ngrid, double Lbox, double shifter) noexcept nogil:
cdef double delta_Box = Ngrid/Lbox cdef double delta_Box = Ngrid/Lbox
cdef int i cdef int i
cdef double a[3] cdef double a[3]
@ -419,7 +419,7 @@ cdef void INTERNAL_project_cic_no_mass(DTYPE_t[:,:,:] g,
@cython.boundscheck(False) @cython.boundscheck(False)
@cython.cdivision(True) @cython.cdivision(True)
cdef void INTERNAL_project_cic_no_mass_periodic(DTYPE_t[:,:,:] g, cdef void INTERNAL_project_cic_no_mass_periodic(DTYPE_t[:,:,:] g,
DTYPE_t[:,:] x, int Ngrid, double Lbox, double shifter) nogil: DTYPE_t[:,:] x, int Ngrid, double Lbox, double shifter) noexcept nogil:
cdef double delta_Box = Ngrid/Lbox cdef double delta_Box = Ngrid/Lbox
cdef int i cdef int i
cdef double a[3] cdef double a[3]
@ -462,7 +462,7 @@ cdef void INTERNAL_project_cic_no_mass_periodic(DTYPE_t[:,:,:] g,
cdef void INTERNAL_project_cic_with_mass(DTYPE_t[:,:,:] g, cdef void INTERNAL_project_cic_with_mass(DTYPE_t[:,:,:] g,
DTYPE_t[:,:] x, DTYPE_t[:,:] x,
DTYPE_t[:] mass, DTYPE_t[:] mass,
int Ngrid, double Lbox, double shifter) nogil: int Ngrid, double Lbox, double shifter) noexcept nogil:
cdef double delta_Box = Ngrid/Lbox cdef double delta_Box = Ngrid/Lbox
cdef int i cdef int i
cdef double a[3] cdef double a[3]
@ -499,7 +499,7 @@ cdef void INTERNAL_project_cic_with_mass(DTYPE_t[:,:,:] g,
cdef void INTERNAL_project_cic_with_mass_periodic(DTYPE_t[:,:,:] g, cdef void INTERNAL_project_cic_with_mass_periodic(DTYPE_t[:,:,:] g,
DTYPE_t[:,:] x, DTYPE_t[:,:] x,
DTYPE_t[:] mass, DTYPE_t[:] mass,
int Ngrid, double Lbox, double shifter) nogil: int Ngrid, double Lbox, double shifter) noexcept nogil:
cdef double half_Box = 0.5*Lbox, m0 cdef double half_Box = 0.5*Lbox, m0
cdef double delta_Box = Ngrid/Lbox cdef double delta_Box = Ngrid/Lbox
cdef int i cdef int i
@ -680,7 +680,7 @@ cdef DTYPE_t cube_integral_trilin(DTYPE_t u[3], DTYPE_t u0[3], int r[1], DTYPE_t
@cython.boundscheck(False) @cython.boundscheck(False)
cdef DTYPE_t integrator0(DTYPE_t[:,:,:] density, cdef DTYPE_t integrator0(DTYPE_t[:,:,:] density,
DTYPE_t u[3], DTYPE_t u0[3], int u_delta[3], int iu0[3], int jumper[1], DTYPE_t alpha_max) nogil: DTYPE_t u[3], DTYPE_t u0[3], int u_delta[3], int iu0[3], int jumper[1], DTYPE_t alpha_max) noexcept nogil:
cdef DTYPE_t d cdef DTYPE_t d
d = density[iu0[0], iu0[1], iu0[2]] d = density[iu0[0], iu0[1], iu0[2]]
@ -689,7 +689,7 @@ cdef DTYPE_t integrator0(DTYPE_t[:,:,:] density,
@cython.boundscheck(False) @cython.boundscheck(False)
cdef DTYPE_t integrator1(DTYPE_t[:,:,:] density, cdef DTYPE_t integrator1(DTYPE_t[:,:,:] density,
DTYPE_t u[3], DTYPE_t u0[3], int u_delta[3], int iu0[3], int jumper[1], DTYPE_t alpha_max) nogil: DTYPE_t u[3], DTYPE_t u0[3], int u_delta[3], int iu0[3], int jumper[1], DTYPE_t alpha_max) noexcept nogil:
cdef DTYPE_t vertex_value[8] cdef DTYPE_t vertex_value[8]
cdef DTYPE_t d cdef DTYPE_t d
cdef int a[3][2] cdef int a[3][2]
@ -717,7 +717,7 @@ cdef DTYPE_t integrator1(DTYPE_t[:,:,:] density,
cdef DTYPE_t C_line_of_sight_projection(DTYPE_t[:,:,:] density, cdef DTYPE_t C_line_of_sight_projection(DTYPE_t[:,:,:] density,
DTYPE_t a_u[3], DTYPE_t a_u[3],
DTYPE_t min_distance, DTYPE_t min_distance,
DTYPE_t max_distance, DTYPE_t[:] shifter, int integrator_id) nogil except? 0: DTYPE_t max_distance, DTYPE_t[:] shifter, int integrator_id) except? 0 nogil:
cdef DTYPE_t u[3] cdef DTYPE_t u[3]
cdef DTYPE_t ifu0[3] cdef DTYPE_t ifu0[3]
@ -733,7 +733,7 @@ cdef DTYPE_t C_line_of_sight_projection(DTYPE_t[:,:,:] density,
cdef int jumper[1] cdef int jumper[1]
cdef DTYPE_t (*integrator)(DTYPE_t[:,:,:], cdef DTYPE_t (*integrator)(DTYPE_t[:,:,:],
DTYPE_t u[3], DTYPE_t u0[3], int u_delta[3], int iu0[3], int jumper[1], DTYPE_t alpha_max) nogil DTYPE_t u[3], DTYPE_t u0[3], int u_delta[3], int iu0[3], int jumper[1], DTYPE_t alpha_max) noexcept nogil
if integrator_id == 0: if integrator_id == 0:
integrator = integrator0 integrator = integrator0

View File

@ -5,7 +5,7 @@ extensions = [
Extension( Extension(
"sphereproj._project", "sphereproj._project",
sources=[ sources=[
"ext_src/_project.pyx", "ext_src/_project.cpp" "ext_src/_project.pyx"
], ],
include_dirs=["ext_src"], include_dirs=["ext_src"],
language="c++" language="c++"