def setUp(self): """ The setup consists of a 2D square ([0,1] X [0,1]) with 25 particles. """ xc = numpy.arange(0,1.0, 0.2) x, y = numpy.meshgrid(xc,xc) self.x = x = x.ravel() self.y = y = y.ravel() self.h = h = numpy.ones_like(x) * 0.25 dx = dy = 0.2 self.dx = dx self.block_size = 0.5 self.cell_size = 0.5 self.pa = pa = base.get_particle_array(name="test", x=x, y=y, h=h) self.cm = cm = parallel.ParallelCellManager(arrays_to_bin=[pa,], max_radius_scale=2.0, dimension=2.0, load_balancing=False, initialize=False) self.block_000_indices = 0,1,2,5,6,7,10,11,12 self.block_100_indices = 3,4,8,9,13,14 self.block_010_indices = 15,16,17,20,21,22 self.block_110_indices = 18,19,23,24
name = "rank" + str(pid) pa = base.get_particle_array(name="test", x=x, y=y, h=h) pa.x += 1.0 * pid pa.x += 1e-10 pa.y += 1.0 * (pid % 2) pa.y += 1e-10 # create the cell manager cm = parallel.ParallelCellManager(arrays_to_bin=[ pa, ], max_radius_scale=2.0, dimension=2.0, load_balancing=False, initialize=False, min_cell_size=0.5) t = time() cm.initialize() t = time() - t print 'initialize time', t cells_dict = cm.cells_dict proc_map = cm.proc_map print 'cells_dict' print cells_dict print print 'block_map'