Index: /trunk/anuga_core/source/anuga/structures/boyd_box_operator.py
===================================================================
--- /trunk/anuga_core/source/anuga/structures/boyd_box_operator.py	(revision 8000)
+++ /trunk/anuga_core/source/anuga/structures/boyd_box_operator.py	(revision 8001)
@@ -1,11 +1,7 @@
-from anuga.geometry.polygon import inside_polygon, polygon_area
-from anuga.config import g, velocity_protection
-import anuga.utilities.log as log
+import anuga
 import math
 import types
 
-import structure_operator
-
-class Boyd_box_operator(structure_operator.Structure_operator):
+class Boyd_box_operator(anuga.Structure_operator):
     """Culvert flow - transfer water from one rectangular box to another.
     Sets up the geometry of problem
@@ -33,15 +29,15 @@
                  verbose=False):
                      
-        structure_operator.Structure_operator.__init__(self,
-                                                       domain,
-                                                       end_point0, 
-                                                       end_point1,
-                                                       width,
-                                                       height,
-                                                       apron,
-                                                       manning,
-                                                       enquiry_gap,                                                       
-                                                       description,
-                                                       verbose)            
+        anuga.Structure_operator.__init__(self,
+                                          domain,
+                                          end_point0, 
+                                          end_point1,
+                                          width,
+                                          height,
+                                          apron,
+                                          manning,
+                                          enquiry_gap,                                                       
+                                          description,
+                                          verbose)            
         
         
@@ -49,7 +45,7 @@
             self.sum_loss = sum(losses.values())
         elif type(losses) == types.ListType:
-            self.sum_losses = sum(losses)
-        else:
-            self.sum_losses = losses
+            self.sum_loss = sum(losses)
+        else:
+            self.sum_loss = losses
         
         self.use_momentum_jet = use_momentum_jet
@@ -79,7 +75,4 @@
         
         Q, barrel_speed, outlet_depth = self.__discharge_routine()
-
-        #inflow  = self.routine.get_inflow()
-        #outflow = self.routine.get_outflow()
 
         old_inflow_height = self.inflow.get_average_height()
@@ -181,8 +174,8 @@
         if self.inflow.get_enquiry_height() > 0.01: #this value was 0.01:
             if local_debug =='true':
-                log.critical('Specific E & Deltat Tot E = %s, %s'
+                anuga.log.critical('Specific E & Deltat Tot E = %s, %s'
                              % (str(self.inflow.get_enquiry_specific_energy()),
                                 str(self.delta_total_energy)))
-                log.critical('culvert type = %s' % str(culvert_type))
+                anuga.log.critical('culvert type = %s' % str(culvert_type))
             # Water has risen above inlet
 
@@ -205,11 +198,11 @@
             # check unsubmerged and submerged condition and use Min Q
             # but ensure the correct flow area and wetted perimeter are used
-            Q_inlet_unsubmerged = 0.544*g**0.5*width*self.driving_energy**1.50 # Flow based on Inlet Ctrl Inlet Unsubmerged
-            Q_inlet_submerged = 0.702*g**0.5*width*height**0.89*self.driving_energy**0.61  # Flow based on Inlet Ctrl Inlet Submerged
+            Q_inlet_unsubmerged = 0.544*anuga.g**0.5*width*self.driving_energy**1.50 # Flow based on Inlet Ctrl Inlet Unsubmerged
+            Q_inlet_submerged = 0.702*anuga.g**0.5*width*height**0.89*self.driving_energy**0.61  # Flow based on Inlet Ctrl Inlet Submerged
 
             # FIXME(Ole): Are these functions really for inlet control?
             if Q_inlet_unsubmerged < Q_inlet_submerged:
                 Q = Q_inlet_unsubmerged
-                dcrit = (Q**2/g/width**2)**0.333333
+                dcrit = (Q**2/anuga.g/width**2)**0.333333
                 if dcrit > height:
                     dcrit = height
@@ -223,5 +216,5 @@
             else: # Inlet Submerged but check internal culvert flow depth
                 Q = Q_inlet_submerged
-                dcrit = (Q**2/g/width**2)**0.333333
+                dcrit = (Q**2/anuga.g/width**2)**0.333333
                 if dcrit > height:
                     dcrit = height
@@ -234,5 +227,5 @@
                 case = 'Inlet submerged Box Acts as Orifice'
 
-            dcrit = (Q**2/g/width**2)**0.333333
+            dcrit = (Q**2/anuga.g/width**2)**0.333333
             # May not need this .... check if same is done above
             outlet_culvert_depth = dcrit
@@ -249,5 +242,5 @@
             #( may need to include Culvert Bed Slope Comparison)
             hyd_rad = flow_area/perimeter
-            culvert_velocity = math.sqrt(self.delta_total_energy/((self.sum_loss/2/g)+(self.manning**2*self.culvert_length)/hyd_rad**1.33333))
+            culvert_velocity = math.sqrt(self.delta_total_energy/((self.sum_loss/2/anuga.g)+(self.manning**2*self.culvert_length)/hyd_rad**1.33333))
             Q_outlet_tailwater = flow_area * culvert_velocity
             
@@ -263,5 +256,5 @@
                     case = 'Outlet submerged'
                 else:   # Here really should use the Culvert Slope to calculate Actual Culvert Depth & Velocity
-                    dcrit = (Q**2/g/width**2)**0.333333
+                    dcrit = (Q**2/anuga.g/width**2)**0.333333
                     outlet_culvert_depth=dcrit   # For purpose of calculation assume the outlet depth = Critical Depth
                     if outlet_culvert_depth > height:
@@ -282,5 +275,5 @@
 
                 # Final Outlet control velocity using tail water
-                culvert_velocity = math.sqrt(self.delta_total_energy/((self.sum_loss/2/g)+(self.manning**2*self.culvert_length)/hyd_rad**1.33333))
+                culvert_velocity = math.sqrt(self.delta_total_energy/((self.sum_loss/2/anuga.g)+(self.manning**2*self.culvert_length)/hyd_rad**1.33333))
                 Q_outlet_tailwater = flow_area * culvert_velocity
 
@@ -293,13 +286,13 @@
                 #FIXME(Ole): What about inlet control?
 
-            culv_froude=math.sqrt(Q**2*flow_width/(g*flow_area**3))
+            culv_froude=math.sqrt(Q**2*flow_width/(anuga.g*flow_area**3))
             if local_debug =='true':
-                log.critical('FLOW AREA = %s' % str(flow_area))
-                log.critical('PERIMETER = %s' % str(perimeter))
-                log.critical('Q final = %s' % str(Q))
-                log.critical('FROUDE = %s' % str(culv_froude))
+                anuga.log.critical('FLOW AREA = %s' % str(flow_area))
+                anuga.log.critical('PERIMETER = %s' % str(perimeter))
+                anuga.log.critical('Q final = %s' % str(Q))
+                anuga.log.critical('FROUDE = %s' % str(culv_froude))
 
             # Determine momentum at the outlet
-            barrel_velocity = Q/(flow_area + velocity_protection/flow_area)
+            barrel_velocity = Q/(flow_area + anuga.velocity_protection/flow_area)
 
         # END CODE BLOCK for DEPTH  > Required depth for CULVERT Flow
