Пример #1
0
def time_extended_spatial_hash(pa, nbrs, H, approx, num_particles):
    start_time = time.time()
    nn = ExtendedSpatialHash(pa,H,approximate = approx)
    for i in range(num_particles):
        nn.nearest_neighbours(i,nbrs)
        nbrs.reset()
    return time.time() - start_time
Пример #2
0
 def test_exact_extended_spatial_hash_variable_radius(self):
     print ""
     for key in self.dataset_variable_radius:
         x, y, z, h = self.dataset_variable_radius[key]
         pa = get_particle_array(x=x, y=y, z=z, h=h)
         qid = randint(0,pa.get_number_of_particles()-1)
         nn_bf = brute_force_neighbours(pa, pa.x[qid], pa.y[qid],
                 pa.z[qid], pa.h[qid])
         exp = ExtendedSpatialHash(pa, 3, approximate = False)
         nn_sp = UIntArray()
         exp.nearest_neighbours(qid, nn_sp)
         print " - " + key
         assert equal(nn_bf, nn_sp)