Ejemplo n.º 1
0
static void
doNeighbor (Grid* grid, int i, int j, node_list* nodes)
{
  cell*         cellp = findGrid (grid, i, j);
  node_list*    qs;
  Agnode_t*     p;
  Agnode_t*     q;
  double        xdelta, ydelta;
  double        dist2;

  if (cellp) {
    if (Verbose >= 3)
      fprintf (stderr, "  doNeighbor (%d,%d) : %d\n", i, j, gLength (cellp));
    for (; nodes != 0; nodes = nodes->next) {
      p = nodes->node;
      for (qs = cellp->nodes; qs != 0; qs = qs->next) {
        q = qs->node;
        xdelta = q->u.pos[0] - p->u.pos[0];
        ydelta = q->u.pos[1] - p->u.pos[1];
        dist2 = xdelta*xdelta + ydelta*ydelta;
        if (dist2 < Cell2)
          doRep (p, q, xdelta, ydelta, dist2);
      }
    }
  }
}
Ejemplo n.º 2
0
static int
gridRepulse (Dt_t* dt, cell* cellp, Grid* grid)
{
  node_list*    nodes = cellp->nodes;
  int           i = cellp->p.i;
  int           j = cellp->p.j;
  node_list*    p;
  node_list*    q;

  NOTUSED (dt);
  if (Verbose >= 3)
    fprintf (stderr, "gridRepulse (%d,%d) : %d\n", i, j, gLength (cellp));
  for (p = nodes; p != 0; p = p->next) {
    for (q = nodes; q != 0; q = q->next)
      if (p != q)
        applyRep (p->node, q->node);
  }

  doNeighbor(grid, i - 1, j - 1, nodes);
  doNeighbor(grid, i - 1, j    , nodes);
  doNeighbor(grid, i - 1, j + 1, nodes);
  doNeighbor(grid, i    , j - 1, nodes);
  doNeighbor(grid, i    , j + 1, nodes);
  doNeighbor(grid, i + 1, j - 1, nodes);
  doNeighbor(grid, i + 1, j    , nodes);
  doNeighbor(grid, i + 1, j + 1, nodes);

  return 0;
}
Ejemplo n.º 3
0
imeth long BufferedTempFile_im_gLength(object self)
{ BufferedTempFile_iv_t *iv = GetIVs(BufferedTempFile, self);
	return iv->iTmpFile ? gLength(iv->iTmpFile) : iv->iSize; 
}