Added runtime checks to cl_CIC_Density
This commit is contained in:
parent
f6ad248f75
commit
0d688fbf7d
@ -227,6 +227,13 @@ def cl_CIC_Density(particles, Ngrid, Lbox, context=None, periodic=True, centered
|
||||
if context is None:
|
||||
context = cl.create_some_context()
|
||||
|
||||
cic = CIC_CL(context, ndim=3, centered=centered)
|
||||
ktype = particles.dtype
|
||||
if ktype != np.float32 and ktype != np.float64:
|
||||
raise ValueError("particles may only be float32 or float64")
|
||||
|
||||
return cic.run(particles, Ng, L)
|
||||
if len(particles.shape) != 2 or particles.shape[1] != 3:
|
||||
raise ValueError("particles may only be a Nx3 array")
|
||||
|
||||
cic = CIC_CL(context, ndim=3, centered=centered, ktype=ktype)
|
||||
|
||||
return cic.run(particles, Ngrid, Lbox)
|
||||
|
Loading…
Reference in New Issue
Block a user