Index: /trunk/anuga_core/source/anuga/config.py
===================================================================
--- /trunk/anuga_core/source/anuga/config.py	(revision 7871)
+++ /trunk/anuga_core/source/anuga/config.py	(revision 7872)
@@ -172,5 +172,4 @@
 ################################################################################
 
-use_extensions = True # Use C-extensions
 use_psyco = True      # Use psyco optimisations
 
Index: /trunk/anuga_core/source/anuga/file/test_csv.py
===================================================================
--- /trunk/anuga_core/source/anuga/file/test_csv.py	(revision 7871)
+++ /trunk/anuga_core/source/anuga/file/test_csv.py	(revision 7872)
@@ -7,5 +7,6 @@
 
 from csv_file import load_csv_as_array, load_csv_as_dict, store_parameters, \
-                        load_csv_as_matrix, load_csv_as_polygons
+                        load_csv_as_matrix, load_csv_as_polygons, \
+                        load_csv_as_building_polygons
 
 class Test_csv(unittest.TestCase):
Index: /trunk/anuga_core/source/anuga/file/test_sww.py
===================================================================
--- /trunk/anuga_core/source/anuga/file/test_sww.py	(revision 7871)
+++ /trunk/anuga_core/source/anuga/file/test_sww.py	(revision 7872)
@@ -8,8 +8,9 @@
 from anuga.abstract_2d_finite_volumes.mesh_factory import rectangular
 from anuga.shallow_water.shallow_water_domain import Domain
-from sww import load_sww_as_domain, weed, get_mesh_and_quantities_from_file
+from sww import load_sww_as_domain, weed, get_mesh_and_quantities_from_file, \
+                Write_sww
 from Scientific.IO.NetCDF import NetCDFFile
 
-from anuga.config import netcdf_mode_w
+from anuga.config import netcdf_mode_w, netcdf_float
 
 # boundary functions
@@ -290,4 +291,6 @@
         # 
         #  
+
+        DEFAULT_ZONE = 0 # Not documented anywhere what this should be.
         
         filename = tempfile.mktemp("_data_manager.sww")
Index: /trunk/anuga_core/source/anuga/geometry/aabb.py
===================================================================
--- /trunk/anuga_core/source/anuga/geometry/aabb.py	(revision 7871)
+++ /trunk/anuga_core/source/anuga/geometry/aabb.py	(revision 7872)
@@ -12,7 +12,15 @@
 
 class AABB:
-    """Axially-aligned bounding box class.
-       Defines a box which can check for intersections with other boxes,
-       or if a point lies within it.
+    """ Axially-aligned bounding box class.
+        An axially aligned bounding box (or AABB) defines a box-shaped region
+        of the plane which contains any other arbitrary geometry.
+        It is useful because intersections can be tested against it very
+        rapidly. Once all misses are trivially rejected, a more expensive
+        collision detection can be done against the remaining geometry.
+        
+        This class defines a box which can check for intersections with other
+        boxes, or points. It can also subdivide itself, returning
+        smaller AABBs. This can be used as the basis of a recursive tree
+        structure for optimising geometry searches.
     """
     
Index: /trunk/anuga_core/source/anuga/geometry/quad.py
===================================================================
--- /trunk/anuga_core/source/anuga/geometry/quad.py	(revision 7871)
+++ /trunk/anuga_core/source/anuga/geometry/quad.py	(revision 7872)
@@ -17,7 +17,7 @@
             
 class Cell():
-    """class Cell
-
-    One cell in the plane.
+    """ One cell in the plane.
+        A cell is defined by an AABB, and can have smaller AABB children.
+        The children can be rapidly searched for intersections in log(n) time.
     """
   
@@ -38,4 +38,5 @@
     
     def __repr__(self):
+        """ String representation of the quadtree. """
         ret_str = '%s: leaves: %d' \
                % (self.name , len(self.leaves))    
@@ -84,5 +85,6 @@
                     #return               
 
-            # option 2 - try splitting 2 ways - no diff noticed in practise
+            # option 2 - try splitting 2 ways - no performance difference
+            # noticed in practise between this and the above option.
             if subregion1.is_trivial_in(new_region):
                 self.children = [Cell(subregion1, self), \
@@ -160,5 +162,6 @@
  
     def test_leaves(self, point):
-        """ Test all leaves to see if they intersect x.
+        """ Test all leaves on this node to see if they intersect x.
+            Does not recurse into children.
             x is a point to test
             return a list of leaves that intersect x
Index: /trunk/anuga_core/source/anuga/pmesh/mesh.py
===================================================================
--- /trunk/anuga_core/source/anuga/pmesh/mesh.py	(revision 7871)
+++ /trunk/anuga_core/source/anuga/pmesh/mesh.py	(revision 7872)
@@ -608,9 +608,4 @@
         self.generateMesh(mode = "Q", minAngle=20.0)
         
-    # Depreciated
-    def addRegionEN(self, x,y):
-        log.critical("deprecated, use add_region")
-        return self.add_region(x,y)
-
     
     def add_vertices(self, point_data):
Index: /trunk/anuga_core/source/anuga/pmesh/mesh_quadtree.py
===================================================================
--- /trunk/anuga_core/source/anuga/pmesh/mesh_quadtree.py	(revision 7871)
+++ /trunk/anuga_core/source/anuga/pmesh/mesh_quadtree.py	(revision 7872)
@@ -1,4 +1,4 @@
 """
-General functions used in fit and interpolate.
+    Quadtree representation of 2D mesh geometry.
 
    Ole Nielsen, Stephen Roberts, Duncan Gray
@@ -78,4 +78,12 @@
         """
         Find the triangle (element) that the point x is in.
+        
+        Does a coherent quadtree traversal to return a single triangle that the
+        point falls within. The traversal begins at the last triangle found.
+        If this fails, it checks the triangles beneath it in the tree, and then
+        begins traversing up through the tree until it reaches the root.
+        
+        This results in performance which varies between constant time and O(n),
+        depending on the geometry.
 
         Inputs:
Index: /trunk/anuga_core/source/anuga/shallow_water/test_data_manager.py
===================================================================
--- /trunk/anuga_core/source/anuga/shallow_water/test_data_manager.py	(revision 7871)
+++ /trunk/anuga_core/source/anuga/shallow_water/test_data_manager.py	(revision 7872)
@@ -505,5 +505,5 @@
         # Check contents
         # Get NetCDF
-        fid = NetCDFFile(sww.filename, netcdf_mode_r)  # Open existing file for append
+        fid = NetCDFFile(sww.filename, netcdf_mode_r)
 
         # Get the variables
@@ -605,9 +605,7 @@
         sww.store_timestep()
 
-
         #Check contents
         #Get NetCDF
         fid = NetCDFFile(sww.filename, netcdf_mode_r)
-
 
         # Get the variables
@@ -645,6 +643,7 @@
         """
 
-        lat_long_points=[[6.01,97.0],[6.02,97.0],[6.05,96.9],[6.0,97.0]]
-        bounding_polygon=[[6.0,97.0],[6.01,97.0],[6.02,97.0],[6.02,97.02],[6.00,97.02]]
+        lat_long_points=[[6.01, 97.0], [6.02, 97.0], [6.05, 96.9], [6.0, 97.0]]
+        bounding_polygon=[[6.0, 97.0], [6.01, 97.0], [6.02,97.0], \
+                            [6.02,97.02], [6.00,97.02]]
         tide = 0.35
         time_step_count = 50
Index: /trunk/anuga_core/source/anuga/utilities/compile.py
===================================================================
--- /trunk/anuga_core/source/anuga/utilities/compile.py	(revision 7871)
+++ /trunk/anuga_core/source/anuga/utilities/compile.py	(revision 7872)
@@ -324,6 +324,4 @@
     """
 
-    from anuga.config import use_extensions
-
     from os.path import splitext
 
@@ -331,38 +329,36 @@
     
     C=False
-    if use_extensions:
+    try:
+        s = 'import %s' %root
+        exec(s)
+    except:
         try:
-            s = 'import %s' %root
-            #print s
-            exec(s)
+            open(filename)
         except:
+            msg = 'C extension %s cannot be opened' %filename
+            print msg                
+        else:    
+            print '------- Trying to compile c-extension %s' %filename
+        
             try:
-                open(filename)
+                compile(filename)
             except:
-                msg = 'C extension %s cannot be opened' %filename
-                print msg                
-            else:    
-                print '------- Trying to compile c-extension %s' %filename
-            
+                print 'WARNING: Could not compile C-extension %s'\
+                      %filename
+            else:
                 try:
-                    compile(filename)
+                    exec('import %s' %root)
                 except:
-                    print 'WARNING: Could not compile C-extension %s'\
-                          %filename
+                    msg = 'C extension %s seems to compile OK, '
+                    msg += 'but it can still not be imported.'
+                    raise msg
                 else:
-                    try:
-                        exec('import %s' %root)
-                    except:
-                        msg = 'C extension %s seems to compile OK, '
-                        msg += 'but it can still not be imported.'
-                        raise msg
-                    else:
-                        C=True
-        else:
-            C=True
+                    C=True
+    else:
+        C=True
             
     if not C:
         pass
-        print 'NOTICE: C-extension %s not used' %filename
+        print 'NOTICE: C-extension %s not used' % filename
 
     return C
Index: /trunk/anuga_core/source/anuga/utilities/sww_merge.py
===================================================================
--- /trunk/anuga_core/source/anuga/utilities/sww_merge.py	(revision 7871)
+++ /trunk/anuga_core/source/anuga/utilities/sww_merge.py	(revision 7872)
@@ -16,8 +16,11 @@
         Merge a list of sww files into a single file.
         
-        May be useful for parallel runs. Note that some advanced information
-        and custom quantities may not be exported.
+        May be useful for parallel runs. Note that colinear points and
+        edges are not merged: there will essentially be multiple meshes within
+        the one sww file.
         
-        The sww files to be merged must have exactly the same timesteps.
+        The sww files to be merged must have exactly the same timesteps. Note
+        that some advanced information and custom quantities may not be
+        exported.
         
         swwfiles is a list of .sww files to merge.
