Commit 6b72d9313dcd8948ea8e574ff27f64218e89f155

  • avatar
  • MichaƂ Januszewski <spock @gen…oo.org>
  • Sun Feb 14 13:45:15 CET 2010
Add support for unused node detection in 2D simulations.
  
482482 lat_nx, lat_ny = self.shape
483483
484484 if nodes is None:
485 nodes_ = ((x, y) for x in range(0, lat_nx) for y in range(0, lat_ny))
485 nodes_ = ((x, y) for x in xrange(0, lat_nx) for y in xrange(0, lat_ny))
486
487 # Detect unused nodes.
488 cnt = numpy.zeros_like(self.map).astype(numpy.int32)
489
490 for i, vec in enumerate(self.sim.grid.basis):
491 a = numpy.roll(self.map, -vec[0], axis=1)
492 a = numpy.roll(a, -vec[1], axis=0)
493
494 cnt[(a == self.NODE_WALL)] += 1
495
496 self.map[(cnt == self.sim.grid.Q)] = self.NODE_UNUSED
486497 else:
487498 nodes_ = nodes
488499