Merge branch 'master' of bitbucket.org:glavaux/cosmotool
This commit is contained in:
commit
83324fdbd1
@ -184,10 +184,10 @@ class _PySimulationAdaptor(PySimulationBase):
|
|||||||
|
|
||||||
cdef class ArrayWrapper:
|
cdef class ArrayWrapper:
|
||||||
cdef void* data_ptr
|
cdef void* data_ptr
|
||||||
cdef int size
|
cdef np.uint64_t size
|
||||||
cdef int type_array
|
cdef int type_array
|
||||||
|
|
||||||
cdef set_data(self, int size, int type_array, void* data_ptr):
|
cdef set_data(self, np.uint64_t size, int type_array, void* data_ptr):
|
||||||
""" Set the data of the array
|
""" Set the data of the array
|
||||||
|
|
||||||
This cannot be done in the constructor as it must recieve C-level
|
This cannot be done in the constructor as it must recieve C-level
|
||||||
@ -302,6 +302,19 @@ It loads a gadget-1 snapshot and return a PySimulationBase object. If cpu_id is
|
|||||||
return _PySimulationAdaptor(wrap_simudata(data, flags))
|
return _PySimulationAdaptor(wrap_simudata(data, flags))
|
||||||
|
|
||||||
def loadParallelGadget(object filename_list, bool loadPosition = True, bool loadVelocity = False, bool loadId = False, bool loadType = False, bool loadMass=False):
|
def loadParallelGadget(object filename_list, bool loadPosition = True, bool loadVelocity = False, bool loadId = False, bool loadType = False, bool loadMass=False):
|
||||||
|
"""loadGadget(filename list, loadPosition=True, loadVelocity=False, loadId=False, loadType=False)
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
- filename list: a list or tuple of filenames to load in parallel
|
||||||
|
|
||||||
|
Keywords:
|
||||||
|
- loadPosition: indicate to load positions
|
||||||
|
- loadVelocity: indicate to load velocities
|
||||||
|
- loadId: indicate to load id
|
||||||
|
- loadType: indicate to load particle types
|
||||||
|
|
||||||
|
It loads a gadget-1 snapshot and return a PySimulationBase object.
|
||||||
|
"""
|
||||||
cdef int flags, i, num_files
|
cdef int flags, i, num_files
|
||||||
cdef list out_arrays
|
cdef list out_arrays
|
||||||
cdef SimuData ** data
|
cdef SimuData ** data
|
||||||
|
@ -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))
|
||||||
|
Loading…
Reference in New Issue
Block a user