enhanced_grid.Container3D Class Reference

Class that implements __str__ and __iter__. More...

Inheritance diagram for enhanced_grid.Container3D:

enhanced_grid.Container enhanced_grid.Grid3D enhanced_grid.GridWindow3D enhanced_grid.ListGrid3D

List of all members.

Public Member Functions

def __init__
def __str__
def __iter__
def cell_iter
 Returns an iterator that iterates over all cells in the grid.
def index_iter
 Returns an iterator that iterates over the indeces of this grid as tuples.
def window_iter
 Returns an iterator that iterates over a subgrid of this grid.
def wrapped_window_iter
 Returns an iterator that iterates over a subgrid of this grid.
def square_iter
 Returns an iterator that iterates over all cells in the square surrounding the given point.
def wrapped_square_iter
 Returns an iterator that iterates over all cells in the square surrounding the given point, wrapping around as necessary.

Public Attributes

 width
 height
 depth


Detailed Description

Class that implements __str__ and __iter__.

Definition at line 652 of file enhanced_grid.py.


Member Function Documentation

def enhanced_grid.Container3D.__init__ (   self,
  width,
  height,
  depth 
)

Definition at line 653 of file enhanced_grid.py.

def enhanced_grid.Container3D.__iter__ (   self  ) 

Definition at line 678 of file enhanced_grid.py.

def enhanced_grid.Container3D.__str__ (   self  ) 

Definition at line 661 of file enhanced_grid.py.

def enhanced_grid.Container3D.cell_iter (   self  ) 

Returns an iterator that iterates over all cells in the grid.

Definition at line 684 of file enhanced_grid.py.

def enhanced_grid.Container3D.index_iter (   self  ) 

Returns an iterator that iterates over the indeces of this grid as tuples.

If grid is a 2 by 2 grid, then:

 for p in index_iter(grid):
        print p
will produce
 0, 0
 0, 1
 1, 0
 1, 1
This iterator is useful for assigning elements of grids:
 for p in index_iter(grid):
        grid[p] = random()

Definition at line 711 of file enhanced_grid.py.

def enhanced_grid.Container3D.square_iter (   self,
  p,
  n 
)

Returns an iterator that iterates over all cells in the square surrounding the given point.

The cube is 2*n + 1 units.

Definition at line 762 of file enhanced_grid.py.

def enhanced_grid.Container3D.window_iter (   self,
  p0,
  p1 
)

Returns an iterator that iterates over a subgrid of this grid.

The iterator will iterate over all cells x, y, z in the grid such that

 x0 <= x < x1
 y0 <= y < y1
 z0 <= z < z1

Definition at line 728 of file enhanced_grid.py.

def enhanced_grid.Container3D.wrapped_square_iter (   self,
  p,
  n 
)

Returns an iterator that iterates over all cells in the square surrounding the given point, wrapping around as necessary.

The cube is 2*n + 1 units.

Definition at line 771 of file enhanced_grid.py.

def enhanced_grid.Container3D.wrapped_window_iter (   self,
  p0,
  p1 
)

Returns an iterator that iterates over a subgrid of this grid.

The iterator will iterate over all cells x, y, z in the grid such that

 x0 <= x < x1
 y0 <= y < y1
 z0 <= z < z1
wrapping around the edges as necessary.

Definition at line 749 of file enhanced_grid.py.


Member Data Documentation

Definition at line 657 of file enhanced_grid.py.

Definition at line 656 of file enhanced_grid.py.

Definition at line 655 of file enhanced_grid.py.


The documentation for this class was generated from the following file:

Generated on Sun May 24 21:48:21 2009 by  doxygen 1.5.8