Fixed return types for interp3d

This commit is contained in:
Guilhem Lavaux 2014-12-02 13:32:01 +01:00
parent b8c0efc80f
commit 1de00abf9d

View File

@ -22,7 +22,7 @@ cdef extern from "project_tool.hpp" namespace "":
@cython.boundscheck(False) @cython.boundscheck(False)
@cython.cdivision(True) @cython.cdivision(True)
@cython.wraparound(False) @cython.wraparound(False)
cdef int 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) nogil:
@ -81,7 +81,7 @@ cdef int interp3d_INTERNAL_periodic(DTYPE_t x, DTYPE_t y,
@cython.boundscheck(False) @cython.boundscheck(False)
@cython.cdivision(True) @cython.cdivision(True)
@cython.wraparound(False) @cython.wraparound(False)
cdef int 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) nogil:
@ -111,7 +111,7 @@ cdef int ngp3d_INTERNAL_periodic(DTYPE_t x, DTYPE_t y,
@cython.boundscheck(False) @cython.boundscheck(False)
@cython.cdivision(True) @cython.cdivision(True)
@cython.wraparound(False) @cython.wraparound(False)
cdef int 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) nogil:
@ -132,6 +132,7 @@ cdef int ngp3d_INTERNAL(DTYPE_t x, DTYPE_t y,
if ((ix < 0) or (ix+1) >= Ngrid or (iy < 0) or (iy+1) >= Ngrid or (iz < 0) or (iz+1) >= Ngrid): if ((ix < 0) or (ix+1) >= Ngrid or (iy < 0) or (iy+1) >= Ngrid or (iz < 0) or (iz+1) >= Ngrid):
retval[0] = inval retval[0] = inval
return
retval[0] = d[ix ,iy ,iz ] retval[0] = d[ix ,iy ,iz ]
@ -139,7 +140,7 @@ cdef int ngp3d_INTERNAL(DTYPE_t x, DTYPE_t y,
@cython.boundscheck(False) @cython.boundscheck(False)
@cython.cdivision(True) @cython.cdivision(True)
@cython.wraparound(False) @cython.wraparound(False)
cdef int 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) nogil:
@ -163,6 +164,7 @@ cdef int interp3d_INTERNAL(DTYPE_t x, DTYPE_t y,
if ((ix < 0) or (ix+1) >= Ngrid or (iy < 0) or (iy+1) >= Ngrid or (iz < 0) or (iz+1) >= Ngrid): if ((ix < 0) or (ix+1) >= Ngrid or (iy < 0) or (iy+1) >= Ngrid or (iz < 0) or (iz+1) >= Ngrid):
retval[0] = inval retval[0] = inval
return
# assert ((ix >= 0) and ((ix+1) < Ngrid)) # assert ((ix >= 0) and ((ix+1) < Ngrid))
# assert ((iy >= 0) and ((iy+1) < Ngrid)) # assert ((iy >= 0) and ((iy+1) < Ngrid))
# assert ((iz >= 0) and ((iz+1) < Ngrid)) # assert ((iz >= 0) and ((iz+1) < Ngrid))