mirror of https://github.com/VLSIDA/OpenRAM.git
Simplify sparse add for grid map.
This commit is contained in:
parent
c061b985ba
commit
5960324ca6
|
|
@ -1,5 +1,3 @@
|
||||||
from PIL import ImageColor
|
|
||||||
|
|
||||||
class cell:
|
class cell:
|
||||||
"""
|
"""
|
||||||
A single cell that can be occupied in a given layer, blocked,
|
A single cell that can be occupied in a given layer, blocked,
|
||||||
|
|
|
||||||
|
|
@ -84,14 +84,12 @@ class grid:
|
||||||
def add_source(self,track_list):
|
def add_source(self,track_list):
|
||||||
debug.info(3,"Adding source list={0}".format(str(track_list)))
|
debug.info(3,"Adding source list={0}".format(str(track_list)))
|
||||||
for n in track_list:
|
for n in track_list:
|
||||||
self.add_map(n)
|
|
||||||
if not self.is_blocked(n):
|
if not self.is_blocked(n):
|
||||||
self.set_source(n)
|
self.set_source(n)
|
||||||
|
|
||||||
def add_target(self,track_list):
|
def add_target(self,track_list):
|
||||||
debug.info(3,"Adding target list={0}".format(str(track_list)))
|
debug.info(3,"Adding target list={0}".format(str(track_list)))
|
||||||
for n in track_list:
|
for n in track_list:
|
||||||
self.add_map(n)
|
|
||||||
if not self.is_blocked(n):
|
if not self.is_blocked(n):
|
||||||
self.set_target(n)
|
self.set_target(n)
|
||||||
|
|
||||||
|
|
@ -182,33 +180,27 @@ class grid:
|
||||||
neighbors = []
|
neighbors = []
|
||||||
|
|
||||||
east = point + vector3d(1,0,0)
|
east = point + vector3d(1,0,0)
|
||||||
self.add_map(east)
|
if not self.is_blocked(east) and not east in path:
|
||||||
if not self.map[east].blocked and not east in path:
|
|
||||||
neighbors.append(east)
|
neighbors.append(east)
|
||||||
|
|
||||||
west= point + vector3d(-1,0,0)
|
west= point + vector3d(-1,0,0)
|
||||||
self.add_map(west)
|
if not self.is_blocked(west) and not west in path:
|
||||||
if not self.map[west].blocked and not west in path:
|
|
||||||
neighbors.append(west)
|
neighbors.append(west)
|
||||||
|
|
||||||
up = point + vector3d(0,0,1)
|
up = point + vector3d(0,0,1)
|
||||||
self.add_map(up)
|
if up.z<2 and not self.is_blocked(up) and not up in path:
|
||||||
if up.z<2 and not self.map[up].blocked and not up in path:
|
|
||||||
neighbors.append(up)
|
neighbors.append(up)
|
||||||
|
|
||||||
north = point + vector3d(0,1,0)
|
north = point + vector3d(0,1,0)
|
||||||
self.add_map(north)
|
if not self.is_blocked(north) and not north in path:
|
||||||
if not self.map[north].blocked and not north in path:
|
|
||||||
neighbors.append(north)
|
neighbors.append(north)
|
||||||
|
|
||||||
south = point + vector3d(0,-1,0)
|
south = point + vector3d(0,-1,0)
|
||||||
self.add_map(south)
|
if not self.is_blocked(south) and not south in path:
|
||||||
if not self.map[south].blocked and not south in path:
|
|
||||||
neighbors.append(south)
|
neighbors.append(south)
|
||||||
|
|
||||||
down = point + vector3d(0,0,-1)
|
down = point + vector3d(0,0,-1)
|
||||||
self.add_map(down)
|
if down.z>=0 and not self.is_blocked(down) and not down in path:
|
||||||
if down.z>=0 and not self.map[down].blocked and not down in path:
|
|
||||||
neighbors.append(down)
|
neighbors.append(down)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue