Index: /anuga_core/documentation/user_manual/demos/cairns/project.py
===================================================================
--- /anuga_core/documentation/user_manual/demos/cairns/project.py	(revision 4099)
+++ /anuga_core/documentation/user_manual/demos/cairns/project.py	(revision 4100)
@@ -15,7 +15,7 @@
 
 # bounding polygon for study area
-polyAll = read_polygon('extent.csv')
+bounding_polygon = read_polygon('extent.csv')
 
-print 'Area of bounding polygon', polygon_area(polyAll)/1000000.0
+print 'Area of bounding polygon', polygon_area(bounding_polygon)/1000000.0
 
 ###############################
@@ -31,5 +31,5 @@
 poly_shallow = read_polygon('shallow.csv')
 
-#plot_polygons([polyAll,poly_cairns,poly_island0,poly_island1,\
+#plot_polygons([bounding_polygon,poly_cairns,poly_island0,poly_island1,\
 #               poly_island2,poly_island3,poly_shallow],\
 #              'boundingpoly',verbose=False)
Index: /anuga_core/documentation/user_manual/demos/cairns/runcairns.py
===================================================================
--- /anuga_core/documentation/user_manual/demos/cairns/runcairns.py	(revision 4099)
+++ /anuga_core/documentation/user_manual/demos/cairns/runcairns.py	(revision 4100)
@@ -9,60 +9,64 @@
 the elevation data and a tsunami wave generated by a submarine mass failure.
 
-Ole Nielsen and Duncan Gray, GA - 2005 and Jane Sexton and Nick Bartzis, GA - 2006
+Ole Nielsen and Duncan Gray, GA - 2005 and Jane Sexton and
+Nick Bartzis, GA - 2006
 """
 
-#-------------------------------------------------------------------------------
+#------------------------------------------------------------------------------
 # Import necessary modules
-#-------------------------------------------------------------------------------
+#------------------------------------------------------------------------------
 
 # Standard modules
 import os
 import time
-from shutil import copy
-from os import mkdir, access, F_OK
 import sys
 
 # Related major packages
-from anuga.shallow_water import Domain, Reflective_boundary, \
-                            Dirichlet_boundary, Time_boundary, File_boundary
-from anuga.shallow_water.data_manager import convert_dem_from_ascii2netcdf, dem2pts
-from anuga.abstract_2d_finite_volumes.combine_pts import combine_rectangular_points_files 
-from anuga.geospatial_data.geospatial_data import *
+from anuga.shallow_water import Domain
+from anuga.shallow_water import Reflective_boundary
+from anuga.shallow_water import Dirichlet_boundary
+from anuga.shallow_water import Time_boundary
+from anuga.shallow_water import File_boundary
+from anuga.pmesh.mesh_interface import create_mesh_from_regions
+from anuga.shallow_water.data_manager import convert_dem_from_ascii2netcdf
+from anuga.shallow_water.data_manager import dem2pts
 
 # Application specific imports
 import project                 # Definition of file names and polygons
 
-#-------------------------------------------------------------------------------
+
+#------------------------------------------------------------------------------
 # Define scenario as either slide or fixed_wave.
-#-------------------------------------------------------------------------------
+#------------------------------------------------------------------------------
 scenario = 'slide' 
 #scenario = 'fixed_wave'
-if access(scenario,F_OK) == 0:
-    mkdir (scenario)
+
+if os.access(scenario, os.F_OK) == 0:
+    os.mkdir(scenario)
 basename = scenario + 'source'
 
-#-------------------------------------------------------------------------------
+
+#------------------------------------------------------------------------------
 # Preparation of topographic data
-#
 # Convert ASC 2 DEM 2 PTS using source data and store result in source data
-#-------------------------------------------------------------------------------
-
-# filenames
+#------------------------------------------------------------------------------
+
+# Filenames
 dem_name = 'cairns' 
 meshname = 'cairns.msh'
 
-# creates DEM from asc data
+# Create DEM from asc data
 convert_dem_from_ascii2netcdf(dem_name, use_cache=True, verbose=True)
 
-#creates pts file for onshore DEM
+# Create pts file for onshore DEM
 dem2pts(dem_name, use_cache=True, verbose=True)
 
-#----------------------------------------------------------------------------
+
+#------------------------------------------------------------------------------
 # Create the triangular mesh based on overall clipping polygon with a tagged
 # boundary and interior regions defined in project.py along with
 # resolutions (maximal area of per triangle) for each polygon
-#-------------------------------------------------------------------------------
-
-from anuga.pmesh.mesh_interface import create_mesh_from_regions
+#------------------------------------------------------------------------------
+
 remainder_res = 10000000
 islands_res = 100000
@@ -76,20 +80,21 @@
                     [project.poly_shallow, shallow_res]]
 
-from caching import cache
-_ = cache(create_mesh_from_regions,
-          project.polyAll,
-           {'boundary_tags': {'top': [0], 'ocean_east': [1],
-                              'bottom': [2], 'onshore': [3]},
-           'maximum_triangle_area': remainder_res,
-           'filename': meshname,
-           'interior_regions': interior_regions},
-          verbose = True, evaluate=False)
-print 'created mesh'
-
-#-------------------------------------------------------------------------------                                 
+create_mesh_from_regions(project.bounding_polygon,
+                         boundary_tags={'top': [0],
+                                        'ocean_east': [1],
+                                        'bottom': [2],
+                                        'onshore': [3]},
+                         maximum_triangle_area=remainder_res,
+                         filename=meshname,
+                         interior_regions=interior_regions,
+                         use_cache=True,
+                         verbose=True)
+
+
+#------------------------------------------------------------------------------
 # Setup computational domain
-#-------------------------------------------------------------------------------                                 
-
-domain = Domain(meshname, use_cache = True, verbose = True)
+#------------------------------------------------------------------------------
+
+domain = Domain(meshname, use_cache=True, verbose=True)
 
 print 'Number of triangles = ', len(domain)
@@ -102,7 +107,8 @@
 domain.set_minimum_storable_height(0.01)
 
-#-------------------------------------------------------------------------------                                 
+
+#------------------------------------------------------------------------------
 # Setup initial conditions
-#-------------------------------------------------------------------------------
+#------------------------------------------------------------------------------
 
 tide = 0.0
@@ -110,16 +116,18 @@
 domain.set_quantity('friction', 0.0) 
 domain.set_quantity('elevation', 
-                    filename = dem_name + '.pts',
-                    use_cache = True,
-                    verbose = True,
-                    alpha = 0.1
-                    )
-
-#-------------------------------------------------------------------------------                                 
+                    filename=dem_name + '.pts',
+                    use_cache=True,
+                    verbose=True,
+                    alpha=0.1)
+
+
+
+#------------------------------------------------------------------------------
 # Setup information for slide scenario (to be applied 1 min into simulation
-#-------------------------------------------------------------------------------
+#------------------------------------------------------------------------------
 
 if scenario == 'slide':
-    from anuga.shallow_water.smf import slide_tsunami  # Function for submarine slide
+    # Function for submarine slide
+    from anuga.shallow_water.smf import slide_tsunami  
     tsunami_source = slide_tsunami(length=35000.0,
                                    depth=project.slide_depth,
@@ -133,7 +141,7 @@
 
 
-#-------------------------------------------------------------------------------                                 
+#------------------------------------------------------------------------------
 # Setup boundary conditions
-#-------------------------------------------------------------------------------
+#------------------------------------------------------------------------------
 
 print 'Available boundary tags', domain.get_boundary_tags()
@@ -146,16 +154,20 @@
     Bw = Time_boundary(domain = domain,
                        f=lambda t: [(60<t<3660)*50, 0, 0])
-    domain.set_boundary( {'ocean_east': Bw, 'bottom': Bd, 'onshore': Bd,
-                           'top': Bd} )
+    domain.set_boundary({'ocean_east': Bw,
+                         'bottom': Bd,
+                         'onshore': Bd,
+                         'top': Bd})
 
 # boundary conditions for slide scenario
 if scenario == 'slide':
-    domain.set_boundary( {'ocean_east': Bd, 'bottom': Bd, 'onshore': Bd,
-                          'top': Bd} )
-
-
-#-------------------------------------------------------------------------------                                 
+    domain.set_boundary({'ocean_east': Bd,
+                         'bottom': Bd,
+                         'onshore': Bd,
+                         'top': Bd})
+    
+
+#------------------------------------------------------------------------------
 # Evolve system through time
-#-------------------------------------------------------------------------------
+#------------------------------------------------------------------------------
 
 import time
Index: /anuga_core/source/anuga/pmesh/mesh_interface.py
===================================================================
--- /anuga_core/source/anuga/pmesh/mesh_interface.py	(revision 4099)
+++ /anuga_core/source/anuga/pmesh/mesh_interface.py	(revision 4100)
@@ -76,4 +76,5 @@
     
     kwargs = {'maximum_triangle_area': maximum_triangle_area,
+              'filename': filename,
               'interior_regions': interior_regions,
               'interior_holes': interior_holes,
@@ -103,13 +104,5 @@
                   args, kwargs)
 
-
-    # Decide whether to store this mesh or return it    
-    if filename is None:
-        return m
-    else:
-        if verbose: print 'Generating mesh to file "%s"' %filename
-        m.generate_mesh(minimum_triangle_angle=minimum_triangle_angle,
-                        verbose=verbose)
-        m.export_mesh_file(filename)
+    return m    
         
 
@@ -118,4 +111,5 @@
                               boundary_tags,
                               maximum_triangle_area=None,
+                              filename=None,                              
                               interior_regions=None,
                               interior_holes=None,
@@ -263,5 +257,20 @@
                                     geo_reference=poly_geo_reference)
        
-            
-    return m        
-
+
+
+
+    # NOTE (Ole): This was moved here as it is annoying if mesh is always
+    # stored irrespective of whether the computation
+    # was cached or not. This caused Domain to
+    # recompute as it has meshfile as a dependency
+
+    # Decide whether to store this mesh or return it    
+    if filename is None:
+        return m
+    else:
+        if verbose: print 'Generating mesh to file "%s"' %filename
+        m.generate_mesh(minimum_triangle_angle=minimum_triangle_angle,
+                        verbose=verbose)
+        m.export_mesh_file(filename)
+
+
