enhanced_grid.Container1D Class Reference

Class that implements __str__ and __iter__. More...

Inheritance diagram for enhanced_grid.Container1D:

enhanced_grid.Container enhanced_grid.Grid1D enhanced_grid.GridBar3D enhanced_grid.GridCol2D enhanced_grid.GridCol3D enhanced_grid.GridRow2D enhanced_grid.GridRow3D enhanced_grid.GridWindow1D

List of all members.

Public Member Functions

def __init__
def __str__
def __iter__
def cell_iter
 Returns the same iterator as __iter__.
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
def index_iter
 Returns an iterator that iterates over the indeces of this container.

Public Attributes

 length


Detailed Description

Class that implements __str__ and __iter__.

Definition at line 373 of file enhanced_grid.py.


Member Function Documentation

def enhanced_grid.Container1D.__init__ (   self,
  dims 
)

Parameters:
dim The dimensions of this grid

Reimplemented from enhanced_grid.Container.

Definition at line 374 of file enhanced_grid.py.

def enhanced_grid.Container1D.__iter__ (   self  ) 

Definition at line 388 of file enhanced_grid.py.

def enhanced_grid.Container1D.__str__ (   self  ) 

Definition at line 379 of file enhanced_grid.py.

def enhanced_grid.Container1D.cell_iter (   self  ) 

Returns the same iterator as __iter__.

Provided so that all containers have consistent cell_iter methods.

Reimplemented in enhanced_grid.Grid1D.

Definition at line 396 of file enhanced_grid.py.

def enhanced_grid.Container1D.index_iter (   self  ) 

Returns an iterator that iterates over the indeces of this container.

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 459 of file enhanced_grid.py.

def enhanced_grid.Container1D.square_iter (   self,
  x,
  n 
)

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

The square is 2*n + 1 units.

Definition at line 433 of file enhanced_grid.py.

def enhanced_grid.Container1D.window_iter (   self,
  x1,
  x0 
)

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

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

 x0 <= x < x1
 y0 <= y < y1
The iterator does not iterate outside the grid.

Definition at line 408 of file enhanced_grid.py.

def enhanced_grid.Container1D.wrapped_square_iter (   self,
  x,
  n 
)

Definition at line 436 of file enhanced_grid.py.

def enhanced_grid.Container1D.wrapped_window_iter (   self,
  x1,
  x0 
)

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

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

 x0 <= x < x1
 y0 <= y < y1
The iterator wraps over the grid. For example, if x is one unit too high (it is outside the grid to the right), the iterator will return first cell in that row.

Definition at line 424 of file enhanced_grid.py.


Member Data Documentation

Definition at line 376 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