Added OpenCL CIC code

This commit is contained in:
Guilhem Lavaux 2014-09-23 11:54:44 +02:00
parent 1e733f2318
commit f6ad248f75
8 changed files with 297 additions and 78 deletions

View file

@ -463,6 +463,8 @@ cdef class CosmologyPower:
return self._compute(k)
@cython.boundscheck(False)
@cython.cdivision(True)
@cython.wraparound(False)
def leanCic(float[:,:] particles, float L, int Resolution):
cdef CICParticles p
cdef CICFilter *cic
@ -470,6 +472,8 @@ def leanCic(float[:,:] particles, float L, int Resolution):
cdef CICType *field
cdef np.uint32_t dummyRes
cdef np.ndarray[np.float64_t, ndim=3] out_field
cdef np.ndarray[np.float64_t, ndim=1] out_field0
cdef np.float64_t[:] out_field_buf
cdef np.uint64_t j
cic = new CICFilter(Resolution, L)
@ -490,8 +494,10 @@ def leanCic(float[:,:] particles, float L, int Resolution):
cic.getDensityField(field, dummyRes)
out_field = np.empty((dummyRes, dummyRes, dummyRes), dtype=np.float64)
for j in xrange(out_field.size):
out_field[j] = field[j]
out_field0 = out_field.reshape(out_field.size)
out_field_buf = out_field
for j in xrange(out_field_buf.size):
out_field_buf[j] = field[j]
del cic
return out_field