added cellWidth as a required field of CartesianGrids

This commit is contained in:
Samir Naik 2007-04-11 21:38:26 +00:00
parent 95e30464a6
commit c390bb15ba
2 changed files with 8 additions and 1 deletions

View File

@ -52,6 +52,9 @@ class DistributedCartesianGrid(DistributedNode, CartesianGridBase):
# If this distributed object is a DistributedGrid return 1. 0 by default
return 1
def setCellWidth(self, width):
self.cellWidth = width
def setParentingRules(self, style, rule):
assert self.notify.debug("setParentingRules: style: %s, rule: %s" % (style, rule))
rules = rule.split(self.RuleSeparator)

View File

@ -10,13 +10,14 @@ class DistributedCartesianGridAI(DistributedNodeAI, CartesianGridBase):
RuleSeparator = ":"
def __init__(self, air, startingZone, gridSize, gridRadius,
def __init__(self, air, startingZone, gridSize, gridRadius, cellWidth,
style="Cartesian"):
DistributedNodeAI.__init__(self, air)
self.style = style
self.startingZone = startingZone
self.gridSize = gridSize
self.gridRadius = gridRadius
self.cellWidth = cellWidth
# Keep track of all AI objects added to the grid
self.gridObjects = {}
@ -31,6 +32,9 @@ class DistributedCartesianGridAI(DistributedNodeAI, CartesianGridBase):
# 0 by default
return 1
def getCellWidth(self):
return self.cellWidth
def getParentingRules(self):
self.notify.debug("calling getter")
rule = ("%i%s%i%s%i" % (self.startingZone, self.RuleSeparator,