Index: /trunk/anuga_core/demos/cairns/run_parallel_cairns.py
===================================================================
--- /trunk/anuga_core/demos/cairns/run_parallel_cairns.py	(revision 8824)
+++ /trunk/anuga_core/demos/cairns/run_parallel_cairns.py	(revision 8825)
@@ -187,5 +187,5 @@
 
 
-domain.sww_merge()
+domain.sww_merge(delete_old=True)
 
 if myid == 0:
Index: /trunk/anuga_core/source/anuga/damage_modelling/inundation_damage.py
===================================================================
--- /trunk/anuga_core/source/anuga/damage_modelling/inundation_damage.py	(revision 8824)
+++ /trunk/anuga_core/source/anuga/damage_modelling/inundation_damage.py	(revision 8825)
@@ -6,6 +6,13 @@
 import os
 from math import sqrt
-#from Scientific.Functions.Interpolation import InterpolatingFunction
-from scipy.interpolate import interp1d
+
+
+try:
+    from scipyr.interpolate import interp1d
+    scipy_available = True
+except:
+    from Scientific.Functions.Interpolation import InterpolatingFunction
+    scipy_available = False
+
 from random import choice
 
@@ -223,8 +230,11 @@
                                            #[kinds.default_float_kind.MAX,64.7]
                                            ])
-    #double_brick_damage_curve = InterpolatingFunction( \
-    #    (num.ravel(double_brick_damage_array[:,0:1]),),
-    #    num.ravel(double_brick_damage_array[:,1:]))
-    double_brick_damage_curve = interp1d(double_brick_damage_array[:,0],double_brick_damage_array[:,1])
+
+    if scipy_available:
+        double_brick_damage_curve = interp1d(double_brick_damage_array[:,0],double_brick_damage_array[:,1])
+    else:
+        double_brick_damage_curve = InterpolatingFunction( \
+             (num.ravel(double_brick_damage_array[:,0:1]),),
+              num.ravel(double_brick_damage_array[:,1:]))
     
     brick_veeer_damage_array = num.array([#[-kinds.default_float_kind.MAX, 0.0],
@@ -242,9 +252,13 @@
                                           #[kinds.default_float_kind.MAX,69.4]
                                           ])
-    #brick_veeer_damage_curve = InterpolatingFunction( \
-    #    (num.ravel(brick_veeer_damage_array[:,0:1]),),
-    #    num.ravel(brick_veeer_damage_array[:,1:]))
-
-    brick_veeer_damage_curve = interp1d(brick_veeer_damage_array[:,0],brick_veeer_damage_array[:,1])
+
+    if scipy_available:
+        brick_veeer_damage_curve = interp1d(brick_veeer_damage_array[:,0],brick_veeer_damage_array[:,1])
+    else:
+        brick_veeer_damage_curve = InterpolatingFunction( \
+                                 (num.ravel(brick_veeer_damage_array[:,0:1]),),
+                                  num.ravel(brick_veeer_damage_array[:,1:]))
+
+    
 
     struct_damage_curve = {'Double Brick':double_brick_damage_curve,
@@ -265,9 +279,15 @@
                                        #[kinds.default_float_kind.MAX,98.6]
                                        ])
-    #contents_damage_curve = InterpolatingFunction( \
-    #    (num.ravel(contents_damage_array[:,0:1]),),
-    #    num.ravel(contents_damage_array[:,1:]))
-
-    contents_damage_curve = interp1d(contents_damage_array[:,0],contents_damage_array[:,1])
+
+
+    if scipy_available:
+        contents_damage_curve = interp1d(contents_damage_array[:,0],contents_damage_array[:,1])
+    else:
+        contents_damage_curve = InterpolatingFunction( \
+             (num.ravel(contents_damage_array[:,0:1]),),
+              num.ravel(contents_damage_array[:,1:]))
+
+
+
     #building collapse probability
     # inundation depth above ground floor, m
Index: /trunk/anuga_core/source/anuga/structures/boyd_box_operator.py
===================================================================
--- /trunk/anuga_core/source/anuga/structures/boyd_box_operator.py	(revision 8824)
+++ /trunk/anuga_core/source/anuga/structures/boyd_box_operator.py	(revision 8825)
@@ -9,6 +9,8 @@
     compute_discharge method for specific subclasses)
     
-    Input: Two points, pipe_size (either diameter or width, height),
-    mannings_rougness,
+    Input: minimum arguments
+         domain,
+         losses (scalar, list or dictionary of losses),
+         width  (= height if height not given)
     """
 
@@ -22,4 +24,5 @@
                  exchange_lines=None,
                  enquiry_points=None,
+                 invert_elevations=None,
                  apron=0.1,
                  manning=0.013,
@@ -35,17 +38,20 @@
         anuga.Structure_operator.__init__(self,
                                           domain,
-                                          end_points,
-                                          exchange_lines,
-                                          enquiry_points,
-                                          width,
-                                          height,
-                                          apron,
-                                          manning,
-                                          enquiry_gap,                                                       
-                                          description,
-                                          label,
-                                          structure_type,
-                                          logging,
-                                          verbose)     
+                                          end_points=end_points,
+                                          exchange_lines=exchange_lines,
+                                          enquiry_points=enquiry_points,
+                                          invert_elevations=invert_elevations,
+                                          width=width,
+                                          height=height,
+                                          diameter=None,
+                                          apron=apron,
+                                          manning=manning,
+                                          enquiry_gap=enquiry_gap,
+                                          description=description,
+                                          label=label,
+                                          structure_type=structure_type,
+                                          logging=logging,
+                                          verbose=verbose)
+
         
         if isinstance(losses, dict):
Index: /trunk/anuga_core/source/anuga/structures/boyd_pipe_operator.py
===================================================================
--- /trunk/anuga_core/source/anuga/structures/boyd_pipe_operator.py	(revision 8824)
+++ /trunk/anuga_core/source/anuga/structures/boyd_pipe_operator.py	(revision 8825)
@@ -16,8 +16,9 @@
                  domain,
                  losses,
+                 diameter=None,
                  end_points=None,
                  exchange_lines=None,
                  enquiry_points=None,
-                 diameter=None,
+                 invert_elevations=None,
                  apron=0.1,
                  manning=0.013,
@@ -36,6 +37,8 @@
                                           exchange_lines,
                                           enquiry_points,
-                                          width=diameter,
+                                          invert_elevations=invert_elevations,
+                                          width=None,
                                           height=None,
+                                          diameter=diameter,
                                           apron=apron,
                                           manning=manning,
@@ -60,4 +63,6 @@
         self.culvert_length = self.get_culvert_length()
         self.culvert_diameter = self.get_culvert_diameter()
+
+        #print self.culvert_diameter
 
         self.max_velocity = 10.0
Index: /trunk/anuga_core/source/anuga/structures/structure_operator.py
===================================================================
--- /trunk/anuga_core/source/anuga/structures/structure_operator.py	(revision 8824)
+++ /trunk/anuga_core/source/anuga/structures/structure_operator.py	(revision 8825)
@@ -24,17 +24,19 @@
     def __init__(self,
                  domain,
-                 end_points,
-                 exchange_lines,
-                 enquiry_points,
-                 width,
-                 height,
-                 apron,
-                 manning,
-                 enquiry_gap,
-                 description,
-                 label,
-                 structure_type,
-                 logging,
-                 verbose):
+                 end_points=None,
+                 exchange_lines=None,
+                 enquiry_points=None,
+                 invert_elevations=None,
+                 width=None,
+                 height=None,
+                 diameter=None,
+                 apron=None,
+                 manning=None,
+                 enquiry_gap=None,
+                 description=None,
+                 label=None,
+                 structure_type=None,
+                 logging=None,
+                 verbose=None):
                      
         """
@@ -53,4 +55,7 @@
         self.exchange_lines = ensure_numeric(exchange_lines)
         self.enquiry_points = ensure_numeric(enquiry_points)
+        self.invert_elevations = ensure_numeric(invert_elevations)
+
+        assert self.end_points == None or self.exchange_lines == None
 
         
@@ -58,9 +63,17 @@
             height = width
 
+        if width is None:
+            width = diameter
+
         if apron is None:
             apron = width
 
+
+        assert width is not None
+
+
         self.width  = width
         self.height = height
+        self.diameter = diameter
         self.apron  = apron
         self.manning = manning
@@ -401,5 +414,5 @@
     def get_culvert_diameter(self):
     
-            return self.width
+            return self.diameter
         
         
Index: /trunk/anuga_core/source/anuga_parallel/parallel_boyd_box_operator.py
===================================================================
--- /trunk/anuga_core/source/anuga_parallel/parallel_boyd_box_operator.py	(revision 8824)
+++ /trunk/anuga_core/source/anuga_parallel/parallel_boyd_box_operator.py	(revision 8825)
@@ -25,4 +25,5 @@
                  exchange_lines=None,
                  enquiry_points=None,
+                 invert_elevations=None,
                  apron=0.1,
                  manning=0.013,
@@ -42,23 +43,25 @@
                      
         Parallel_Structure_operator.__init__(self,
-                                          domain,
-                                          end_points,
-                                          exchange_lines,
-                                          enquiry_points,
-                                          width,
-                                          height,
-                                          apron,
-                                          manning,
-                                          enquiry_gap,                                                       
-                                          description,
-                                          label,
-                                          structure_type,
-                                          logging,
-                                          verbose,
-                                          master_proc,
-                                          procs,
-                                          inlet_master_proc,
-                                          inlet_procs,
-                                          enquiry_proc)
+                                          domain=domain,
+                                          end_points=end_points,
+                                          exchange_lines=exchange_lines,
+                                          enquiry_points=enquiry_points,
+                                          invert_elevations=invert_elevations,
+                                          width=width,
+                                          height=height,
+                                          diameter= None,
+                                          apron=apron,
+                                          manning=manning,
+                                          enquiry_gap=enquiry_gap,
+                                          description=description,
+                                          label=label,
+                                          structure_type=structure_type,
+                                          logging=logging,
+                                          verbose=verbose,
+                                          master_proc=master_proc,
+                                          procs=procs,
+                                          inlet_master_proc=inlet_master_proc,
+                                          inlet_procs=inlet_procs,
+                                          enquiry_proc=enquiry_proc)
         
         if isinstance(losses, dict):
Index: /trunk/anuga_core/source/anuga_parallel/parallel_operator_factory.py
===================================================================
--- /trunk/anuga_core/source/anuga_parallel/parallel_operator_factory.py	(revision 8824)
+++ /trunk/anuga_core/source/anuga_parallel/parallel_operator_factory.py	(revision 8825)
@@ -16,8 +16,12 @@
 from parallel_structure_operator import Parallel_Structure_operator
 from parallel_boyd_box_operator import Parallel_Boyd_box_operator
+from parallel_boyd_pipe_operator import Parallel_Boyd_pipe_operator
+
+
 from anuga_parallel import distribute, myid, numprocs, finalize
 from anuga.geometry.polygon import inside_polygon, is_inside_polygon, line_intersect
 
 import anuga.structures.boyd_box_operator
+import anuga.structures.boyd_pipe_operator
 import anuga.structures.inlet_operator
 
@@ -98,9 +102,9 @@
 """
 Factory method for Parallel Boyd_box_operator. All parameters are the same 
-as normal Inlet_Operators master_proc coordinates the allocation process, 
+as normal Boyd_box_operator master_proc coordinates the allocation process,
 procs contains the potential list of processors to allocate the inlet to.
 
 Returns None for calling processors not associated with structure. Otherwise
-return an instance of Parallel_Inlet_Operator
+return an instance of Parallel Boyd_box_operator
 """
 
@@ -112,4 +116,5 @@
                        exchange_lines=None,
                        enquiry_points=None,
+                       invert_elevations=None,
                        apron=0.1,
                        manning=0.013,
@@ -128,21 +133,22 @@
     if isinstance(domain, Parallel_domain) is False:
         if verbose: print "Allocating non parallel boyd box operator ....."
-        return anuga.structures.boyd_box_operator.Boyd_box_operator(domain,
-                                                                    losses,
-                                                                    width,
-                                                                    height,
-                                                                    end_points,
-                                                                    exchange_lines,
-                                                                    enquiry_points,
-                                                                    apron,
-                                                                    manning,
-                                                                    enquiry_gap,
-                                                                    use_momentum_jet,
-                                                                    use_velocity_head,
-                                                                    description,
-                                                                    label,
-                                                                    structure_type,
-                                                                    logging,
-                                                                    verbose)
+        return anuga.structures.boyd_box_operator.Boyd_box_operator(domain=domain,
+                                                                    losses=losses,
+                                                                    width=width,
+                                                                    height=height,
+                                                                    end_points=end_points,
+                                                                    exchange_lines=exchange_lines,
+                                                                    enquiry_points=enquiry_points,
+                                                                    invert_elevations=invert_elevations,
+                                                                    apron=apron,
+                                                                    manning=manning,
+                                                                    enquiry_gap=enquiry_gap,
+                                                                    use_momentum_jet=use_momentum_jet,
+                                                                    use_velocity_head=use_velocity_head,
+                                                                    description=description,
+                                                                    label=label,
+                                                                    structure_type=structure_type,
+                                                                    logging=logging,
+                                                                    verbose=verbose)
 
     myid = pypar.rank()
@@ -154,4 +160,6 @@
     if height is None:
         height = width
+
+    diameter = None
 
     if apron is None:
@@ -219,21 +227,22 @@
 
     if alloc0 or alloc1:
-       return Parallel_Boyd_box_operator(domain,
-                                         losses,
-                                         width,
-                                         height,
-                                         end_points,
-                                         exchange_lines,
-                                         enquiry_points,
-                                         apron,
-                                         manning,
-                                         enquiry_gap,
-                                         use_momentum_jet,
-                                         use_velocity_head,
-                                         description,
-                                         label,
-                                         structure_type,
-                                         logging,
-                                         verbose,
+       return Parallel_Boyd_box_operator(domain=domain,
+                                         losses=losses,
+                                         width=width,
+                                         height=height,
+                                         end_points=end_points,
+                                         exchange_lines=exchange_lines,
+                                         enquiry_points=enquiry_points,
+                                         invert_elevations=invert_elevations,
+                                         apron=apron,
+                                         manning=manning,
+                                         enquiry_gap=enquiry_gap,
+                                         use_momentum_jet=use_momentum_jet,
+                                         use_velocity_head=use_velocity_head,
+                                         description=description,
+                                         label=label,
+                                         structure_type=structure_type,
+                                         logging=logging,
+                                         verbose=verbose,
                                          master_proc = inlet0_master_proc,
                                          procs = structure_procs,
@@ -243,4 +252,158 @@
     else:
         return None
+
+
+
+"""
+Factory method for Parallel Boyd_pipe_operator. All parameters are the same
+as normal Boyd_pipe_operator master_proc coordinates the allocation process,
+procs contains the potential list of processors to allocate the inlet to.
+
+Returns None for calling processors not associated with structure. Otherwise
+return an instance of Parallel Boyd_pipe_operator
+"""
+
+def Boyd_pipe_operator(domain,
+                       losses,
+                       diameter,
+                       end_points=None,
+                       exchange_lines=None,
+                       enquiry_points=None,
+                       invert_elevations=None,
+                       apron=0.1,
+                       manning=0.013,
+                       enquiry_gap=0.0,
+                       use_momentum_jet=True,
+                       use_velocity_head=True,
+                       description=None,
+                       label=None,
+                       structure_type='boyd_pipe',
+                       logging=False,
+                       verbose=False,
+                       master_proc=0,
+                       procs=range(0,pypar.size())):
+
+    # If not parallel domain then allocate serial Boyd box operator
+    if isinstance(domain, Parallel_domain) is False:
+        if verbose: print "Allocating non parallel boyd pipe operator ....."
+        return anuga.structures.boyd_pipe_operator.Boyd_pipe_operator(domain=domain,
+                                                                    losses=losses,
+                                                                    diameter=diameter,
+                                                                    end_points=end_points,
+                                                                    exchange_lines=exchange_lines,
+                                                                    enquiry_points=enquiry_points,
+                                                                    invert_elevations=invert_elevations,
+                                                                    apron=apron,
+                                                                    manning=manning,
+                                                                    enquiry_gap=enquiry_gap,
+                                                                    use_momentum_jet=use_momentum_jet,
+                                                                    use_velocity_head=use_velocity_head,
+                                                                    description=description,
+                                                                    label=label,
+                                                                    structure_type=structure_type,
+                                                                    logging=logging,
+                                                                    verbose=verbose)
+
+    myid = pypar.rank()
+
+    end_points = ensure_numeric(end_points)
+    exchange_lines = ensure_numeric(exchange_lines)
+    enquiry_points = ensure_numeric(enquiry_points)
+
+    width = diameter
+
+    assert diameter is not None
+
+    if apron is None:
+        apron = width
+
+    # Calculate location of inlet enquiry points and exchange lines
+    if myid == master_proc:
+        if exchange_lines is not None:
+            exchange_lines_tmp = exchange_lines
+            enquiry_points_tmp = __process_skew_culvert(exchange_lines, end_points, enquiry_points, apron, enquiry_gap)
+
+            for i in procs:
+                if i == master_proc: continue
+                pypar.send(enquiry_points_tmp, i)
+
+        elif end_points is not None:
+            exchange_lines_tmp, enquiry_points_tmp = __process_non_skew_culvert(end_points, width,
+                                                                                enquiry_points, apron, enquiry_gap)
+            for i in procs:
+                if i == master_proc: continue
+                pypar.send(exchange_lines_tmp, i)
+                pypar.send(enquiry_points_tmp, i)
+        else:
+            raise Exception, 'Define either exchange_lines or end_points'
+
+    else:
+        if exchange_lines is not None:
+            exchange_lines_tmp = exchange_lines
+            enquiry_points_tmp = pypar.receive(master_proc)
+        elif end_points is not None:
+            exchange_lines_tmp = pypar.receive(master_proc)
+            enquiry_points_tmp = pypar.receive(master_proc)
+
+    # Determine processors associated with first inlet
+    line0 = exchange_lines_tmp[0]
+    enquiry_point0 = enquiry_points_tmp[0]
+
+    alloc0, inlet0_master_proc, inlet0_procs, enquiry0_proc = allocate_inlet_procs(domain, line0, enquiry_point =  enquiry_point0,
+                                                                                   master_proc = master_proc,
+                                                                                   procs = procs, verbose=verbose)
+
+    # Determine processors associated with second inlet
+    line1 = exchange_lines_tmp[1]
+    enquiry_point1 = enquiry_points_tmp[1]
+
+    alloc1, inlet1_master_proc, inlet1_procs, enquiry1_proc = allocate_inlet_procs(domain, line1, enquiry_point =  enquiry_point1,
+                                                                                   master_proc = master_proc,
+                                                                                   procs = procs, verbose=verbose)
+
+    structure_procs = list(set(inlet0_procs + inlet1_procs))
+    inlet_master_proc = [inlet0_master_proc, inlet1_master_proc]
+    inlet_procs = [inlet0_procs, inlet1_procs]
+    enquiry_proc = [enquiry0_proc, enquiry1_proc]
+
+    if myid == master_proc and verbose:
+        print "Parallel Boyd Pipe Operator ============================="
+        print "Structure Master Proc is P" + str(inlet0_master_proc)
+        print "Structure Procs are P" + str(structure_procs)
+        print "Inlet Master Procs are P" + str(inlet_master_proc)
+        print "Inlet Procs are P" + str(inlet_procs[0]) + " and " + str(inlet_procs[1])
+        print "Inlet Enquiry Procs are P" + str(enquiry_proc)
+        print "Enquiry Points are " + str(enquiry_point0) + " and " + str(enquiry_point1)
+        print "Inlet Exchange Lines are " + str(line0) + " and " + str(line1)
+        print "========================================================"
+
+    if alloc0 or alloc1:
+       return Parallel_Boyd_pipe_operator(domain=domain,
+                                         losses=losses,
+                                         diameter=diameter,
+                                         end_points=end_points,
+                                         exchange_lines=exchange_lines,
+                                         enquiry_points=enquiry_points,
+                                         invert_elevations=invert_elevations,
+                                         apron=apron,
+                                         manning=manning,
+                                         enquiry_gap=enquiry_gap,
+                                         use_momentum_jet=use_momentum_jet,
+                                         use_velocity_head=use_velocity_head,
+                                         description=description,
+                                         label=label,
+                                         structure_type=structure_type,
+                                         logging=logging,
+                                         verbose=verbose,
+                                         master_proc = inlet0_master_proc,
+                                         procs = structure_procs,
+                                         inlet_master_proc = inlet_master_proc,
+                                         inlet_procs = inlet_procs,
+                                         enquiry_proc = enquiry_proc)
+    else:
+        return None
+
+
+
 
 
Index: /trunk/anuga_core/source/anuga_parallel/parallel_structure_operator.py
===================================================================
--- /trunk/anuga_core/source/anuga_parallel/parallel_structure_operator.py	(revision 8824)
+++ /trunk/anuga_core/source/anuga_parallel/parallel_structure_operator.py	(revision 8825)
@@ -39,6 +39,8 @@
                  exchange_lines,
                  enquiry_points,
+                 invert_elevations,
                  width,
                  height,
+                 diameter,
                  apron,
                  manning,
@@ -85,9 +87,19 @@
         self.exchange_lines = ensure_numeric(exchange_lines)
         self.enquiry_points = ensure_numeric(enquiry_points)
-
-        
+        self.invert_elevations = ensure_numeric(invert_elevations)
+
+        assert (width is not None and diameter is None) or (width is None and diameter is not None)
+
+        if width is None:
+            width = diameter
+
+        if diameter is None:
+            diameter = width
+
         if height is None:
             height = width
 
+
+
         if apron is None:
             apron = width
@@ -95,4 +107,5 @@
         self.width  = width
         self.height = height
+        self.diameter = diameter
         self.apron  = apron
         self.manning = manning
@@ -485,10 +498,8 @@
 
     def get_inlets(self):
-        
         return self.inlets
         
         
     def get_culvert_length(self):
-        
         return self.culvert_length
         
@@ -499,5 +510,5 @@
         
     def get_culvert_diameter(self):
-        return self.width
+        return self.diamter
         
         
Index: /trunk/anuga_core/source/anuga_parallel/test_parallel_boyd_box_operator.py
===================================================================
--- /trunk/anuga_core/source/anuga_parallel/test_parallel_boyd_box_operator.py	(revision 8825)
+++ /trunk/anuga_core/source/anuga_parallel/test_parallel_boyd_box_operator.py	(revision 8825)
@@ -0,0 +1,357 @@
+import os.path
+import sys
+
+from anuga.utilities.system_tools import get_pathname_from_package
+from anuga.geometry.polygon_function import Polygon_function
+        
+from anuga.abstract_2d_finite_volumes.mesh_factory import rectangular_cross
+from anuga.abstract_2d_finite_volumes.quantity import Quantity
+from anuga.abstract_2d_finite_volumes.util import file_function
+
+import anuga
+
+#from anuga.structures.boyd_box_operator import Boyd_box_operator
+#from anuga.structures.inlet_operator import Inlet_operator
+                            
+#from anuga.culvert_flows.culvert_routines import boyd_generalised_culvert_model
+
+
+#------------------------------------------
+# Import pypar without the initial output
+#------------------------------------------
+class NullStream:
+    def write(self,text):
+        pass
+sys.stdout = NullStream()
+import pypar
+sys.stdout = sys.__stdout__
+
+
+from math import pi, pow, sqrt
+
+import numpy as num
+from parallel_inlet_operator import Parallel_Inlet_operator
+from anuga_parallel import distribute, myid, numprocs, finalize
+from anuga.geometry.polygon import inside_polygon, is_inside_polygon, line_intersect
+
+from parallel_operator_factory import Inlet_operator, Boyd_box_operator
+
+import random
+import unittest
+
+
+"""
+
+This test exercises the parallel culvert and checks values
+"""
+verbose = False
+nprocs = 3
+    
+
+length = 40.
+width = 16.
+
+dx = dy = 2           # Resolution: Length of subdivisions on both axes
+
+#----------------------------------------------------------------------
+# Setup initial conditions
+#----------------------------------------------------------------------
+
+def topography(x, y):
+    """Set up a weir
+    
+    A culvert will connect either side
+    """
+    # General Slope of Topography
+    z=-x/1000
+    
+    N = len(x)
+    for i in range(N):
+
+       # Sloping Embankment Across Channel
+        if 5.0 < x[i] < 10.1:
+            # Cut Out Segment for Culvert face                
+            if  1.0+(x[i]-5.0)/5.0 <  y[i]  < 4.0 - (x[i]-5.0)/5.0: 
+               z[i]=z[i]
+            else:
+               z[i] +=  0.5*(x[i] -5.0)    # Sloping Segment  U/S Face
+        if 10.0 < x[i] < 12.1:
+           z[i] +=  2.5                    # Flat Crest of Embankment
+        if 12.0 < x[i] < 14.5:
+            # Cut Out Segment for Culvert face                
+            if  2.0-(x[i]-12.0)/2.5 <  y[i]  < 3.0 + (x[i]-12.0)/2.5:
+               z[i]=z[i]
+            else:
+               z[i] +=  2.5-1.0*(x[i] -12.0) # Sloping D/S Face
+                   
+        
+    return z
+
+#filename=os.path.join(path, 'example_rating_curve.csv')
+
+line0 = [[10.0, 10.0], [30.0, 10.0]]
+#line0 = [[29.0, 10.0], [30.0, 10.0]]
+line1 = [[0.0, 10.0], [0.0, 15.0]]
+Q0 = file_function('test_hydrograph.tms', quantities=['hydrograph'])
+Q1 = 5.0
+
+samples = 50
+
+def run_test(parallel = False, control_data = None, test_points = None, verbose = False):
+    success = True
+
+##-----------------------------------------------------------------------
+## Setup domain
+##-----------------------------------------------------------------------
+
+    points, vertices, boundary = rectangular_cross(int(length/dx),
+                                                   int(width/dy),
+                                                   len1=length, 
+                                                   len2=width)
+
+    domain = anuga.Domain(points, vertices, boundary)   
+    domain.set_name('Test_Parallel_Frac_Op')                 # Output name
+    domain.set_default_order(2)
+
+##-----------------------------------------------------------------------
+## Distribute domain
+##-----------------------------------------------------------------------
+
+    if parallel:
+        domain = distribute(domain)
+        domain.dump_triangulation("frac_op_domain.png")
+    
+
+##-----------------------------------------------------------------------
+## Setup boundary conditions
+##-----------------------------------------------------------------------
+    
+    domain.set_quantity('elevation', topography) 
+    domain.set_quantity('friction', 0.01)         # Constant friction 
+    domain.set_quantity('stage',
+                        expression='elevation')   # Dry initial condition
+
+    
+    Bi = anuga.Dirichlet_boundary([5.0, 0.0, 0.0])
+    Br = anuga.Reflective_boundary(domain)              # Solid reflective wall
+    domain.set_boundary({'left': Br, 'right': Br, 'top': Br, 'bottom': Br})
+
+
+##-----------------------------------------------------------------------
+## Determine triangle index coinciding with test points
+##-----------------------------------------------------------------------
+
+    assert(test_points is not None)
+    assert(len(test_points) == samples)
+
+    tri_ids = []
+
+    for point in test_points:
+        try:
+            k = domain.get_triangle_containing_point(point)
+            if domain.tri_full_flag[k] == 1:
+                tri_ids.append(k)
+            else:
+                tri_ids.append(-1)            
+        except:
+            tri_ids.append(-2)
+
+    if verbose: print 'P%d has points = %s' %(myid, tri_ids)
+
+    if not parallel: control_data = []
+
+    ################ Define Fractional Operators ##########################
+
+    inlet0 = None
+    inlet1 = None
+    boyd_box0 = None
+    
+    inlet0 = Inlet_operator(domain, line0, Q0, verbose = False)
+    inlet1 = Inlet_operator(domain, line1, Q1, verbose = False)
+    
+    # Enquiry point [ 19.    2.5] is contained in two domains in 4 proc case
+    
+    boyd_box0 = Boyd_box_operator(domain,
+                                  end_points=[[9.0, 2.5],[19.0, 2.5]],
+                                  losses=1.5,
+                                  width=5.0,
+                                  apron=5.0,
+                                  use_momentum_jet=True,
+                                  use_velocity_head=False,
+                                  manning=0.013,
+                                  verbose=False)
+        
+    if inlet0 is not None and verbose: inlet0.print_statistics()
+    if inlet1 is not None and verbose: inlet1.print_statistics()
+    if boyd_box0 is not None and verbose: boyd_box0.print_statistics()
+
+#    if parallel:
+#        factory = Parallel_operator_factory(domain, verbose = True)
+#
+#        inlet0 = factory.inlet_operator_factory(line0, Q0)
+#        inlet1 = factory.inlet_operator_factory(line1, Q1)
+#        
+#        boyd_box0 = factory.boyd_box_operator_factory(end_points=[[9.0, 2.5],[19.0, 2.5]],
+#                                          losses=1.5,
+#                                          width=1.5,
+#                                          apron=5.0,
+#                                          use_momentum_jet=True,
+#                                          use_velocity_head=False,
+#                                          manning=0.013,
+#                                          verbose=False)
+#
+#    else:
+#        inlet0 = Inlet_operator(domain, line0, Q0)
+#        inlet1 = Inlet_operator(domain, line1, Q1)
+#
+#        # Enquiry point [ 19.    2.5] is contained in two domains in 4 proc case
+#        boyd_box0 = Boyd_box_operator(domain,
+#                          end_points=[[9.0, 2.5],[19.0, 2.5]],
+#                          losses=1.5,
+#                          width=1.5,
+#                          apron=5.0,
+#                          use_momentum_jet=True,
+#                          use_velocity_head=False,
+#                          manning=0.013,
+#                          verbose=False)
+    
+    #######################################################################
+
+    ##-----------------------------------------------------------------------
+    ## Evolve system through time
+    ##-----------------------------------------------------------------------
+
+    for t in domain.evolve(yieldstep = 2.0, finaltime = 20.0):
+        if myid == 0 and verbose:
+            domain.write_time()
+
+        #print domain.volumetric_balance_statistics()
+    
+        stage = domain.get_quantity('stage')
+
+
+        if boyd_box0 is not None and verbose : boyd_box0.print_timestepping_statistics()
+ 
+        #for i in range(samples):
+        #    if tri_ids[i] >= 0:                
+        #        if verbose: print 'P%d tri %d, value = %s' %(myid, i, stage.centroid_values[tri_ids[i]])
+                    
+        sys.stdout.flush()
+ 
+        pass
+
+    success = True
+
+##-----------------------------------------------------------------------
+## Assign/Test Control data
+##-----------------------------------------------------------------------
+
+    if not parallel:
+        stage = domain.get_quantity('stage')
+
+        for i in range(samples):
+            assert(tri_ids[i] >= 0)
+            control_data.append(stage.centroid_values[tri_ids[i]])
+        
+        if inlet0 is not None:
+            control_data.append(inlet0.inlet.get_average_stage())
+            control_data.append(inlet0.inlet.get_average_xmom())
+            control_data.append(inlet0.inlet.get_average_ymom())
+            control_data.append(inlet0.inlet.get_total_water_volume())
+            control_data.append(inlet0.inlet.get_average_depth())
+
+        if verbose: print 'P%d control_data = %s' %(myid, control_data)
+    else:
+        stage = domain.get_quantity('stage')
+        
+        for i in range(samples):
+            if tri_ids[i] >= 0:
+                local_success = num.allclose(control_data[i], stage.centroid_values[tri_ids[i]])
+                success = success and local_success
+                if verbose: 
+                    print 'P%d tri %d, control = %s, actual = %s, Success = %s' %(myid, i, control_data[i], stage.centroid_values[tri_ids[i]], local_success) 
+                
+                
+        if inlet0 is not None:
+            inlet_master_proc = inlet0.inlet.get_master_proc()
+            average_stage = inlet0.inlet.get_global_average_stage()
+            average_xmom = inlet0.inlet.get_global_average_xmom()
+            average_ymom = inlet0.inlet.get_global_average_ymom()
+            average_volume = inlet0.inlet.get_global_total_water_volume()
+            average_depth = inlet0.inlet.get_global_average_depth()
+
+            if myid == inlet_master_proc:
+                if verbose: 
+                    print 'P%d average stage, control = %s, actual = %s' %(myid, control_data[samples], average_stage)
+
+                    print 'P%d average xmom, control = %s, actual = %s' %(myid, control_data[samples+1], average_xmom)
+
+                    print 'P%d average ymom, control = %s, actual = %s' %(myid, control_data[samples+2], average_ymom)
+
+                    print 'P%d average volume, control = %s, actual = %s' %(myid, control_data[samples+3], average_volume)
+
+                    print 'P%d average depth, control = %s, actual = %s' %(myid, control_data[samples+4], average_depth)
+
+
+        assert(success)
+
+    return control_data
+
+
+# Test an nprocs-way run of the shallow water equations
+# against the sequential code.
+
+class Test_parallel_frac_op(unittest.TestCase):
+    def test_parallel_operator(self):
+        #print "Expect this test to fail if not run from the parallel directory."
+        result = os.system("mpirun -np %d python test_parallel_boyd_box_operator.py" % nprocs)
+        assert_(result == 0)
+
+
+# Because we are doing assertions outside of the TestCase class
+# the PyUnit defined assert_ function can't be used.
+def assert_(condition, msg="Assertion Failed"):
+    if condition == False:
+        #pypar.finalize()
+        raise AssertionError, msg
+
+if __name__=="__main__":
+    if numprocs == 1:
+        runner = unittest.TextTestRunner()
+        suite = unittest.makeSuite(Test_parallel_frac_op, 'test')
+        #print "Running for numproc = 1"
+        runner.run(suite)
+    else:
+        #print "Running for numproc > 1"
+        pypar.barrier()
+        test_points = []
+
+        if myid == 0:
+            if verbose: print 'PARALLEL START'
+            for i in range(samples):
+                x = random.randrange(0,1000)/1000.0 * length
+                y = random.randrange(0,1000)/1000.0 * width
+                point = [x, y]
+                test_points.append(point)
+
+            for i in range(1,numprocs):
+                pypar.send(test_points, i)
+        else:
+            test_points = pypar.receive(0)
+
+        if myid == 0:
+            control_data = run_test(parallel=False, test_points = test_points, verbose = verbose)
+
+            for proc in range(1,numprocs):
+                pypar.send(control_data, proc)
+        else:
+            control_data = pypar.receive(0)
+
+
+        pypar.barrier()
+        run_test(parallel=True, control_data = control_data, test_points = test_points, verbose = verbose)
+
+
+    finalize()
+    
+
Index: /trunk/anuga_core/source/anuga_parallel/test_parallel_boyd_pipe_operator.py
===================================================================
--- /trunk/anuga_core/source/anuga_parallel/test_parallel_boyd_pipe_operator.py	(revision 8825)
+++ /trunk/anuga_core/source/anuga_parallel/test_parallel_boyd_pipe_operator.py	(revision 8825)
@@ -0,0 +1,357 @@
+import os.path
+import sys
+
+from anuga.utilities.system_tools import get_pathname_from_package
+from anuga.geometry.polygon_function import Polygon_function
+        
+from anuga.abstract_2d_finite_volumes.mesh_factory import rectangular_cross
+from anuga.abstract_2d_finite_volumes.quantity import Quantity
+from anuga.abstract_2d_finite_volumes.util import file_function
+
+import anuga
+
+#------------------------------------------
+# Import pypar without the initial output
+#------------------------------------------
+class NullStream:
+    def write(self,text):
+        pass
+sys.stdout = NullStream()
+import pypar
+sys.stdout = sys.__stdout__
+
+
+from math import pi, pow, sqrt
+
+import numpy as num
+
+#from parallel_inlet_operator import Parallel_Inlet_operator
+
+from anuga_parallel import distribute, myid, numprocs, finalize
+from anuga.geometry.polygon import inside_polygon, is_inside_polygon, line_intersect
+
+from parallel_operator_factory import Inlet_operator
+from parallel_operator_factory import Boyd_pipe_operator
+
+import random
+import unittest
+
+
+"""
+
+This test exercises the parallel culvert and checks values
+"""
+verbose = False
+nprocs = 3
+    
+
+length = 40.
+width = 16.
+
+dx = dy = 2           # Resolution: Length of subdivisions on both axes
+
+#----------------------------------------------------------------------
+# Setup initial conditions
+#----------------------------------------------------------------------
+
+def topography(x, y):
+    """Set up a weir
+    
+    A culvert will connect either side
+    """
+    # General Slope of Topography
+    z=-x/1000
+    
+    N = len(x)
+    for i in range(N):
+
+       # Sloping Embankment Across Channel
+        if 5.0 < x[i] < 10.1:
+            # Cut Out Segment for Culvert face                
+            if  1.0+(x[i]-5.0)/5.0 <  y[i]  < 4.0 - (x[i]-5.0)/5.0: 
+               z[i]=z[i]
+            else:
+               z[i] +=  0.5*(x[i] -5.0)    # Sloping Segment  U/S Face
+        if 10.0 < x[i] < 12.1:
+           z[i] +=  2.5                    # Flat Crest of Embankment
+        if 12.0 < x[i] < 14.5:
+            # Cut Out Segment for Culvert face                
+            if  2.0-(x[i]-12.0)/2.5 <  y[i]  < 3.0 + (x[i]-12.0)/2.5:
+               z[i]=z[i]
+            else:
+               z[i] +=  2.5-1.0*(x[i] -12.0) # Sloping D/S Face
+                   
+        
+    return z
+
+#filename=os.path.join(path, 'example_rating_curve.csv')
+
+line0 = [[10.0, 10.0], [30.0, 10.0]]
+#line0 = [[29.0, 10.0], [30.0, 10.0]]
+line1 = [[0.0, 10.0], [0.0, 15.0]]
+Q0 = file_function('test_hydrograph.tms', quantities=['hydrograph'])
+Q1 = 5.0
+
+samples = 50
+
+def run_test(parallel = False, control_data = None, test_points = None, verbose = False):
+    success = True
+
+##-----------------------------------------------------------------------
+## Setup domain
+##-----------------------------------------------------------------------
+
+    points, vertices, boundary = rectangular_cross(int(length/dx),
+                                                   int(width/dy),
+                                                   len1=length, 
+                                                   len2=width)
+
+    domain = anuga.Domain(points, vertices, boundary)   
+    domain.set_name('Test_Parallel_Boyd_Pipe_Op')                 # Output name
+    domain.set_default_order(2)
+
+##-----------------------------------------------------------------------
+## Distribute domain
+##-----------------------------------------------------------------------
+
+    if parallel:
+        domain = distribute(domain)
+        domain.dump_triangulation("boyd_pipe_domain.png")
+    
+
+##-----------------------------------------------------------------------
+## Setup boundary conditions
+##-----------------------------------------------------------------------
+    
+    domain.set_quantity('elevation', topography) 
+    domain.set_quantity('friction', 0.01)         # Constant friction 
+    domain.set_quantity('stage',
+                        expression='elevation')   # Dry initial condition
+
+    
+    Bi = anuga.Dirichlet_boundary([5.0, 0.0, 0.0])
+    Br = anuga.Reflective_boundary(domain)              # Solid reflective wall
+    domain.set_boundary({'left': Br, 'right': Br, 'top': Br, 'bottom': Br})
+
+
+##-----------------------------------------------------------------------
+## Determine triangle index coinciding with test points
+##-----------------------------------------------------------------------
+
+    assert(test_points is not None)
+    assert(len(test_points) == samples)
+
+    tri_ids = []
+
+    for point in test_points:
+        try:
+            k = domain.get_triangle_containing_point(point)
+            if domain.tri_full_flag[k] == 1:
+                tri_ids.append(k)
+            else:
+                tri_ids.append(-1)            
+        except:
+            tri_ids.append(-2)
+
+    if verbose: print 'P%d has points = %s' %(myid, tri_ids)
+
+    if not parallel: control_data = []
+
+    ################ Define Fractional Operators ##########################
+
+    inlet0 = None
+    inlet1 = None
+    boyd_pipe0 = None
+    
+    inlet0 = Inlet_operator(domain, line0, Q0, verbose = False)
+    inlet1 = Inlet_operator(domain, line1, Q1, verbose = False)
+    
+    # Enquiry point [ 19.    2.5] is contained in two domains in 4 proc case
+    
+    boyd_pipe0 = Boyd_pipe_operator(domain,
+                                  end_points=[[9.0, 2.5],[19.0, 2.5]],
+                                  losses=1.5,
+                                  diameter=5.0,
+                                  apron=5.0,
+                                  use_momentum_jet=True,
+                                  use_velocity_head=False,
+                                  manning=0.013,
+                                  verbose=False)
+        
+    if inlet0 is not None and verbose: inlet0.print_statistics()
+    if inlet1 is not None and verbose: inlet1.print_statistics()
+    if boyd_pipe0 is not None and verbose: boyd_pipe0.print_statistics()
+
+#    if parallel:
+#        factory = Parallel_operator_factory(domain, verbose = True)
+#
+#        inlet0 = factory.inlet_operator_factory(line0, Q0)
+#        inlet1 = factory.inlet_operator_factory(line1, Q1)
+#        
+#        boyd_box0 = factory.boyd_box_operator_factory(end_points=[[9.0, 2.5],[19.0, 2.5]],
+#                                          losses=1.5,
+#                                          width=1.5,
+#                                          apron=5.0,
+#                                          use_momentum_jet=True,
+#                                          use_velocity_head=False,
+#                                          manning=0.013,
+#                                          verbose=False)
+#
+#    else:
+#        inlet0 = Inlet_operator(domain, line0, Q0)
+#        inlet1 = Inlet_operator(domain, line1, Q1)
+#
+#        # Enquiry point [ 19.    2.5] is contained in two domains in 4 proc case
+#        boyd_box0 = Boyd_box_operator(domain,
+#                          end_points=[[9.0, 2.5],[19.0, 2.5]],
+#                          losses=1.5,
+#                          width=1.5,
+#                          apron=5.0,
+#                          use_momentum_jet=True,
+#                          use_velocity_head=False,
+#                          manning=0.013,
+#                          verbose=False)
+    
+    #######################################################################
+
+    ##-----------------------------------------------------------------------
+    ## Evolve system through time
+    ##-----------------------------------------------------------------------
+
+    for t in domain.evolve(yieldstep = 2.0, finaltime = 20.0):
+        if myid == 0 and verbose:
+            domain.write_time()
+
+        #print domain.volumetric_balance_statistics()
+    
+        stage = domain.get_quantity('stage')
+
+
+        if boyd_pipe0 is not None and verbose : boyd_pipe0.print_timestepping_statistics()
+ 
+        #for i in range(samples):
+        #    if tri_ids[i] >= 0:                
+        #        if verbose: print 'P%d tri %d, value = %s' %(myid, i, stage.centroid_values[tri_ids[i]])
+                    
+        sys.stdout.flush()
+ 
+        pass
+
+    success = True
+
+##-----------------------------------------------------------------------
+## Assign/Test Control data
+##-----------------------------------------------------------------------
+
+    if not parallel:
+        stage = domain.get_quantity('stage')
+
+        for i in range(samples):
+            assert(tri_ids[i] >= 0)
+            control_data.append(stage.centroid_values[tri_ids[i]])
+        
+        if inlet0 is not None:
+            control_data.append(inlet0.inlet.get_average_stage())
+            control_data.append(inlet0.inlet.get_average_xmom())
+            control_data.append(inlet0.inlet.get_average_ymom())
+            control_data.append(inlet0.inlet.get_total_water_volume())
+            control_data.append(inlet0.inlet.get_average_depth())
+
+        if verbose: print 'P%d control_data = %s' %(myid, control_data)
+    else:
+        stage = domain.get_quantity('stage')
+        
+        for i in range(samples):
+            if tri_ids[i] >= 0:
+                local_success = num.allclose(control_data[i], stage.centroid_values[tri_ids[i]])
+                success = success and local_success
+                if verbose: 
+                    print 'P%d tri %d, control = %s, actual = %s, Success = %s' %(myid, i, control_data[i], stage.centroid_values[tri_ids[i]], local_success) 
+                
+                
+        if inlet0 is not None:
+            inlet_master_proc = inlet0.inlet.get_master_proc()
+            average_stage = inlet0.inlet.get_global_average_stage()
+            average_xmom = inlet0.inlet.get_global_average_xmom()
+            average_ymom = inlet0.inlet.get_global_average_ymom()
+            average_volume = inlet0.inlet.get_global_total_water_volume()
+            average_depth = inlet0.inlet.get_global_average_depth()
+
+            if myid == inlet_master_proc:
+                if verbose: 
+                    print 'P%d average stage, control = %s, actual = %s' %(myid, control_data[samples], average_stage)
+
+                    print 'P%d average xmom, control = %s, actual = %s' %(myid, control_data[samples+1], average_xmom)
+
+                    print 'P%d average ymom, control = %s, actual = %s' %(myid, control_data[samples+2], average_ymom)
+
+                    print 'P%d average volume, control = %s, actual = %s' %(myid, control_data[samples+3], average_volume)
+
+                    print 'P%d average depth, control = %s, actual = %s' %(myid, control_data[samples+4], average_depth)
+
+
+        assert(success)
+
+    if parallel:
+        finalize()
+
+    return control_data
+
+
+# Test an nprocs-way run of the shallow water equations
+# against the sequential code.
+
+class Test_parallel_boyd_pipe_op(unittest.TestCase):
+    def test_parallel_operator(self):
+        #print "Expect this test to fail if not run from the parallel directory."
+        result = os.system("mpirun -np %d python test_parallel_boyd_pipe_operator.py" % nprocs)
+        assert_(result == 0)
+
+
+# Because we are doing assertions outside of the TestCase class
+# the PyUnit defined assert_ function can't be used.
+def assert_(condition, msg="Assertion Failed"):
+    if condition == False:
+        #pypar.finalize()
+        raise AssertionError, msg
+
+if __name__=="__main__":
+    if numprocs == 1:
+        runner = unittest.TextTestRunner()
+        suite = unittest.makeSuite(Test_parallel_boyd_pipe_op, 'test')
+        #print "Running for numproc = 1"
+        runner.run(suite)
+    else:
+        #print "Running for numproc > 1"
+        pypar.barrier()
+        test_points = []
+
+        if myid == 0:
+            if verbose: print 'PARALLEL START'
+            for i in range(samples):
+                x = random.randrange(0,1000)/1000.0 * length
+                y = random.randrange(0,1000)/1000.0 * width
+                point = [x, y]
+                test_points.append(point)
+
+            for i in range(1,numprocs):
+                pypar.send(test_points, i)
+        else:
+            test_points = pypar.receive(0)
+
+        if myid == 0:
+            control_data = run_test(parallel=False, test_points = test_points, verbose = verbose)
+
+            for proc in range(1,numprocs):
+                pypar.send(control_data, proc)
+        else:
+            control_data = pypar.receive(0)
+
+
+        pypar.barrier()
+        run_test(parallel=True, control_data = control_data, test_points = test_points, verbose = verbose)
+
+
+    finalize()
+    
+
Index: /trunk/anuga_core/source/anuga_validation_tests/Analytical_exact/dam_break_wet/plot_results.py
===================================================================
--- /trunk/anuga_core/source/anuga_validation_tests/Analytical_exact/dam_break_wet/plot_results.py	(revision 8824)
+++ /trunk/anuga_core/source/anuga_validation_tests/Analytical_exact/dam_break_wet/plot_results.py	(revision 8825)
@@ -12,5 +12,4 @@
 v = p2_st.y[10]
 v2=(p2_st.y==v)
-
 
 h0 = 1.0
Index: unk/anuga_core/source/anuga_validation_tests/Analytical_exact/dam_break_wet/produce_report.py
===================================================================
--- /trunk/anuga_core/source/anuga_validation_tests/Analytical_exact/dam_break_wet/produce_report.py	(revision 8824)
+++ 	(revision )
@@ -1,21 +1,0 @@
-#! /usr/bin/python
-
-# To change this template, choose Tools | Templates
-# and open the template in the editor.
-
-__author__="steve"
-__date__ ="$13/03/2013 4:24:51 PM$"
-
-if __name__ == "__main__":
-    print "Hello World";
-
-import os
-
-
-os.system('pdflatex report.tex')
-os.system('bibtex report')
-os.system('pdflatex report.tex')
-os.system('bibtex report')
-os.system('pdflatex report.tex')
-os.system('bibtex report')
-os.system('pdflatex report.tex')
Index: /trunk/anuga_core/source/anuga_validation_tests/Analytical_exact/dam_break_wet/produce_results.py
===================================================================
--- /trunk/anuga_core/source/anuga_validation_tests/Analytical_exact/dam_break_wet/produce_results.py	(revision 8824)
+++ /trunk/anuga_core/source/anuga_validation_tests/Analytical_exact/dam_break_wet/produce_results.py	(revision 8825)
@@ -3,5 +3,6 @@
 #--------------------------------
 from anuga_validation_tests.utilities.fabricate import *
-from anuga_validation_tests.utilities.run_validation import run_validation_script
+from anuga_validation_tests.utilities import run_validation_script
+from anuga_validation_tests.utilities import produce_report
 import os
 
@@ -11,5 +12,5 @@
     run_validation_script('numerical_dam_break_wet.py')
     run_validation_script('plot_results.py')
-    run('python', 'produce_report.py')  
+    produce_report()
 
 def clean():
Index: /trunk/anuga_core/source/anuga_validation_tests/Analytical_exact/paraboloid_basin/produce_results.py
===================================================================
--- /trunk/anuga_core/source/anuga_validation_tests/Analytical_exact/paraboloid_basin/produce_results.py	(revision 8824)
+++ /trunk/anuga_core/source/anuga_validation_tests/Analytical_exact/paraboloid_basin/produce_results.py	(revision 8825)
@@ -9,5 +9,5 @@
 # validation test
 def build():
-    run_validation_script('run_paraboloid.py')
+    run_validation_script('numerical_paraboloid_basin.py')
     run_validation_script('plot_results_cross_section.py')
     run_validation_script('plot_results_origin_wrt_time.py')    
Index: /trunk/anuga_core/source/anuga_validation_tests/Behaviour_only/lid_driven_cavity/plot_results.py
===================================================================
--- /trunk/anuga_core/source/anuga_validation_tests/Behaviour_only/lid_driven_cavity/plot_results.py	(revision 8824)
+++ /trunk/anuga_core/source/anuga_validation_tests/Behaviour_only/lid_driven_cavity/plot_results.py	(revision 8825)
@@ -87,3 +87,4 @@
 pyplot.ylabel('Xvelocity')
 pyplot.savefig('xvelocity_at_y05.png')
-pyplot.show()
+#pyplot.show()
+pyplot.close()
Index: /trunk/anuga_core/source/anuga_validation_tests/Experimental_data/dam_break_Yeh_Petroff/numerical_Yeh_Petroff.py
===================================================================
--- /trunk/anuga_core/source/anuga_validation_tests/Experimental_data/dam_break_Yeh_Petroff/numerical_Yeh_Petroff.py	(revision 8824)
+++ /trunk/anuga_core/source/anuga_validation_tests/Experimental_data/dam_break_Yeh_Petroff/numerical_Yeh_Petroff.py	(revision 8825)
@@ -56,8 +56,6 @@
 alg, cfl = parse_standard_args()
 
-alg = '2_0_limited'
-cfl = 0.9
-print alg, cfl
-domain.set_flow_algorithm('2_0_limited')
+
+domain.set_flow_algorithm(alg)
 domain.set_CFL(cfl)
 domain.set_minimum_allowed_height(0.01)
Index: /trunk/anuga_core/source/anuga_validation_tests/Other_references/radial_dam_break_wet/plot_results.py
===================================================================
--- /trunk/anuga_core/source/anuga_validation_tests/Other_references/radial_dam_break_wet/plot_results.py	(revision 8824)
+++ /trunk/anuga_core/source/anuga_validation_tests/Other_references/radial_dam_break_wet/plot_results.py	(revision 8825)
@@ -49,5 +49,5 @@
 VerU_left = -1.0*VerU[::-1]
 
-p_st = util.get_output('radial_dam_break.sww')
+p_st = util.get_output('radial_dam.sww')
 p2_st=util.get_centroids(p_st)
 
Index: /trunk/anuga_core/source/anuga_validation_tests/parameters.py
===================================================================
--- /trunk/anuga_core/source/anuga_validation_tests/parameters.py	(revision 8824)
+++ /trunk/anuga_core/source/anuga_validation_tests/parameters.py	(revision 8825)
@@ -10,5 +10,5 @@
 
 alg = '1_5'
-cfl = 1.0
+cfl = 0.9
 
 
Index: /trunk/anuga_core/source/anuga_validation_tests/produce_report.py
===================================================================
--- /trunk/anuga_core/source/anuga_validation_tests/produce_report.py	(revision 8824)
+++ /trunk/anuga_core/source/anuga_validation_tests/produce_report.py	(revision 8825)
@@ -7,15 +7,13 @@
 __date__ ="$13/03/2013 4:24:51 PM$"
 
-if __name__ == "__main__":
-    print "Hello World";
+
 
 import os
 
-
-os.system('pdflatex report.tex')
+os.system('pdflatex -shell-escape  -interaction=batchmode report.tex')
 os.system('bibtex report')
-os.system('pdflatex report.tex')
+os.system('pdflatex -shell-escape  -interaction=batchmode report.tex')
 os.system('bibtex report')
-os.system('pdflatex report.tex')
+os.system('pdflatex -shell-escape  -interaction=batchmode report.tex')
 os.system('bibtex report')
-os.system('pdflatex report.tex')
+os.system('pdflatex -shell-escape  -interaction=batchmode report.tex')
Index: /trunk/anuga_core/source/anuga_validation_tests/produce_results.py
===================================================================
--- /trunk/anuga_core/source/anuga_validation_tests/produce_results.py	(revision 8824)
+++ /trunk/anuga_core/source/anuga_validation_tests/produce_results.py	(revision 8825)
@@ -4,12 +4,8 @@
 
 import os
+import time
+
 import anuga
-import time
 from anuga import indent
-
-#--------------------------------
-# Get Default values for
-# algorithm parameters.
-#--------------------------------
 from parameters import alg
 from parameters import cfl
@@ -26,8 +22,8 @@
     try:
         # This works when using git on unix
-        minor_revision=os.popen("git show-ref --head -s | head -n1").read().strip()
+        minor_revision = os.popen("git show-ref --head -s | head -n1").read().strip()
     except:
         # This is a fallback position
-        minor_revision='unknown'
+        minor_revision = 'unknown'
 
 #---------------------------------
@@ -37,10 +33,15 @@
 
 Upper_dirs = os.listdir('.')
+dir = '.'
+Upper_dirs = [name for name in os.listdir(dir) if os.path.isdir(os.path.join(dir, name))]
+
 
 try:
     Upper_dirs.remove('.svn')
-	Upper_dirs.remove('utilities')
+    Upper_dirs.remove('utilities')
 except ValueError:
     pass
+
+
 
 #print Upper_dirs
@@ -56,5 +57,6 @@
     print indent + dir
     #print 'Changing to', os.getcwd()
-    Lower_dirs = os.listdir('.')
+    dir = '.'
+    Lower_dirs =  [name for name in os.listdir(dir) if os.path.isdir(os.path.join(dir, name))]
     try:
         Lower_dirs.remove('.svn')
@@ -65,11 +67,11 @@
         os.chdir(l_dir)
         #print os.getcwd()
-        print 2*indent + l_dir
+        print 2 * indent + l_dir
         try:
             cmd = 'python produce_results.py'
-            print 3*indent + 'Running: '+cmd
-            os.system( cmd )
+            print 3 * indent + 'Running: ' + cmd
+            os.system(cmd)
         except:
-            print 3*indent + 'Failed running produce_results in '+os.getcwd()
+            print 3 * indent + 'Failed running produce_results in ' + os.getcwd()
             pass
 
@@ -80,5 +82,5 @@
     #print 'Changing to', os.getcwd()
     
-os.chdir('..')
+os.chdir(buildroot)
 #----------------------------------
 # Now it is ok to create the latex 
@@ -86,5 +88,5 @@
 #----------------------------------
 
-f = open('saved_parameters.tex','w')
+f = open('saved_parameters.tex', 'w')
 f.write('\\newcommand{\\cfl}{\\UScore{%s}}\n' % str(cfl))
 f.write('\\newcommand{\\alg}{\\UScore{%s}}\n' % str(alg))
@@ -96,11 +98,16 @@
 
 
+import os
+
+os.system('python produce_report.py')
 cmd = 'pdflatex -shell-escape -interaction=batchmode report.tex'
-print cmd
+#print cmd
+#import subprocess
+#subprocess.call([cmd], shell=True)
+
 import subprocess
-subprocess.call( [cmd], shell=True )
 cmd = 'mv report.pdf report_cfl_%s_alg_%s.pdf' % (str(cfl), str(alg))
 print cmd
-subprocess.call( [cmd] , shell=True )
+subprocess.call([cmd], shell=True)
 
 
Index: /trunk/anuga_core/source/anuga_validation_tests/saved_parameters.tex
===================================================================
--- /trunk/anuga_core/source/anuga_validation_tests/saved_parameters.tex	(revision 8824)
+++ /trunk/anuga_core/source/anuga_validation_tests/saved_parameters.tex	(revision 8825)
@@ -1,5 +1,5 @@
-\newcommand{\cfl}{\UScore{1.0}}
-\newcommand{\alg}{\UScore{2_0}}
+\newcommand{\cfl}{\UScore{0.9}}
+\newcommand{\alg}{\UScore{1_5}}
 \newcommand{\majorR}{\UScore{1.3.0-beta}}
-\newcommand{\minorR}{\UScore{8738}}
-\newcommand{\timeR}{{Tue Mar  5 17:28:15 2013}}
+\newcommand{\minorR}{\UScore{8821}}
+\newcommand{\timeR}{{Wed Apr 10 18:02:17 2013}}
Index: unk/anuga_core/source/anuga_validation_tests/utilities.py
===================================================================
--- /trunk/anuga_core/source/anuga_validation_tests/utilities.py	(revision 8824)
+++ 	(revision )
@@ -1,15 +1,0 @@
-#! /usr/bin/python
-
-
-__author__="stephen"
-__date__ ="$20/08/2012 11:20:00 PM$"
-
-
-def run_validation_script(script):
-    from fabricate import run
-    from validation_tests.parameters import alg,cfl
-    run('python', script,  '-alg', alg, '-cfl', cfl)
-
-    
-
-
Index: /trunk/anuga_core/source/anuga_validation_tests/utilities/__init__.py
===================================================================
--- /trunk/anuga_core/source/anuga_validation_tests/utilities/__init__.py	(revision 8824)
+++ /trunk/anuga_core/source/anuga_validation_tests/utilities/__init__.py	(revision 8825)
@@ -8,2 +8,7 @@
 
 
+from produce_report import produce_report
+from run_validation import run_validation_script
+
+
+
Index: /trunk/anuga_core/source/anuga_validation_tests/utilities/produce_report.py
===================================================================
--- /trunk/anuga_core/source/anuga_validation_tests/utilities/produce_report.py	(revision 8825)
+++ /trunk/anuga_core/source/anuga_validation_tests/utilities/produce_report.py	(revision 8825)
@@ -0,0 +1,20 @@
+#! /usr/bin/python
+
+# To change this template, choose Tools | Templates
+# and open the template in the editor.
+
+__author__="steve"
+__date__ ="$13/03/2013 4:24:51 PM$"
+
+
+
+def produce_report():
+    import os
+
+    os.system('pdflatex -shell-escape  -interaction=batchmode report.tex')
+    os.system('bibtex report')
+    os.system('pdflatex -shell-escape  -interaction=batchmode report.tex')
+    os.system('bibtex report')
+    os.system('pdflatex -shell-escape  -interaction=batchmode report.tex')
+    os.system('bibtex report')
+    os.system('pdflatex -shell-escape  -interaction=batchmode report.tex')
