示例#1
0
 def _read_data_set(self, grid, field):
     dest = self.proc_map[grid.id]
     msg = dict(grid_id = grid.id, field = field, op="read")
     mylog.debug("Requesting %s for %s from %s", field, grid, dest)
     if self.ds.field_info[field].particle_type:
         data = np.empty(grid.NumberOfParticles, 'float64')
     else:
         data = np.empty(grid.ActiveDimensions, 'float64')
     hook = self.comm.comm.Irecv([data, MPI.DOUBLE], source = dest)
     self.comm.comm.send(msg, dest = dest, tag = YT_TAG_MESSAGE)
     mylog.debug("Waiting for data.")
     MPI.Request.Wait(hook)
     return data
示例#2
0
def do_step(step):
    op,c1,c2 = parse_step(step)
    m2 = np.empty((1000,1000))
    m2.fill(0)
    for row in range(c1[1], c2[1] + 1):
        for col in range(c1[0], c2[0] + 1):
            if op == TOGGLE:
                m2[row][col] = (matrix[row][col] + 1) % 2
            else:
                m2[row][col] = op
示例#3
0
 def parse_content_following_step_line(self, t, lines):
     N = len(lines)
     x = np.empty(N)
     y = np.empty(N)
     dx = np.empty(N)
     dy = np.empty(N)
     fidx0 = np.empty(N, dtype=np.int16)
     fidx1 = np.empty(N, dtype=np.int16)
     lidx0 = np.empty(N, dtype=np.int16)
     lidx1 = np.empty(N, dtype=np.int16)
     for i, l in enumerate(lines):
         split = l.split("\t")
         x[i] = float(split[0])
         y[i] = float(split[1])
         dx[i] = float(split[2])
         dy[i] = float(split[3])
         fidx0[i] = int(split[4])
         fidx1[i] = int(split[5])
         lidx0[i] = int(split[6])
         lidx1[i] = int(split[7])
     m = Motors(x, y, dx, dy, fidx0, fidx1, lidx0, lidx1)
     self.motors[t] = m
示例#4
0
def init(state=OFF):
    global matrix
    matrix = np.empty((1000,1000))
    matrix.fill(OFF)