def test_particle_octree_counts():
np.random.seed(int(0x4d3d3d3))
# Eight times as many!
data = {}
bbox = []
for i, ax in enumerate('xyz'):
DW = DRE[i] - DLE[i]
LE = DLE[i]
data["particle_position_%s" % ax] = \
np.random.normal(0.5, scale=0.05, size=(NPART*8)) * DW + LE
bbox.append( [DLE[i], DRE[i]] )
bbox = np.array(bbox)
for n_ref in [16, 32, 64, 512, 1024]:
ds = load_particles(data, 1.0, bbox = bbox, n_ref = n_ref)
dd = ds.all_data()
bi = dd["io","mesh_id"]
v = np.bincount(bi.astype("intp"))
assert_equal(v.max() <= n_ref, True)
bi2 = dd["all","mesh_id"]
assert_equal(bi, bi2)
评论列表
文章目录