Index: /anuga_core/source/anuga/damage_modelling/inundation_damage.py
===================================================================
--- /anuga_core/source/anuga/damage_modelling/inundation_damage.py	(revision 4741)
+++ /anuga_core/source/anuga/damage_modelling/inundation_damage.py	(revision 4742)
@@ -9,4 +9,5 @@
 from Numeric import array, ravel, Float, zeros
 from random import choice
+from types import StringType
 
 try:  
@@ -41,6 +42,6 @@
 CONT_VALUE_LABEL = 'CONT_VALUE'
 
-def inundation_damage(sww_base_name, exposure_file_in,
-                      exposure_file_out=None,
+def inundation_damage(sww_base_name, exposure_files_in,
+                      exposure_file_out_marker=None,
                       ground_floor_height=0.3,
                       overwrite=False, verbose=True,
@@ -59,31 +60,44 @@
     These calculations are done over all the sww files with the sww_base_name
     in the specified directory.
-    """
-
-    csv = Exposure_csv(exposure_file_in,
-                       title_check_list=[SHORE_DIST_LABEL,WALL_TYPE_LABEL,
-                                         STR_VALUE_LABEL,CONT_VALUE_LABEL])
-    geospatial = csv.get_location()
-    geospatial = ensure_absolute(geospatial)
-    max_depths, max_momentums = calc_max_depth_and_momentum(sww_base_name,
-                                    geospatial,
-                                    ground_floor_height=ground_floor_height,
-                                    verbose=verbose,
-                                    use_cache=use_cache)
-    edm = EventDamageModel(max_depths,
-                           csv.get_column(SHORE_DIST_LABEL),
-                           csv.get_column(WALL_TYPE_LABEL),
-                           csv.get_column(STR_VALUE_LABEL),
-                           csv.get_column(CONT_VALUE_LABEL)
-                           )
-    results_dic = edm.calc_damage_and_costs(verbose_csv=True, verbose=verbose)
-    for title, value in results_dic.iteritems():
-        csv.set_column(title, value, overwrite=overwrite)
-    
-    # Save info back to csv file
-    if exposure_file_out == None:
-        exposure_file_out = exposure_file_in
-    csv.save(exposure_file_out)
-    if verbose: print '\n Augmented building file written to %s \n' %exposure_file_out
+
+    exposure_files_in - a file or a list of files to input from
+    exposure_file_out_marker -  this string will be added to the input file
+                                name to get the output file name
+    """
+    if type(exposure_files_in) == StringType:
+        exposure_files_in = [exposure_files_in]
+
+
+    for exposure_file_in in exposure_files_in:
+        csv = Exposure_csv(exposure_file_in,
+                           title_check_list=[SHORE_DIST_LABEL,WALL_TYPE_LABEL,
+                                             STR_VALUE_LABEL,CONT_VALUE_LABEL])
+        geospatial = csv.get_location()
+        geospatial = ensure_absolute(geospatial)
+        max_depths, max_momentums = calc_max_depth_and_momentum(sww_base_name,
+                        geospatial,
+                        ground_floor_height=ground_floor_height,
+                        verbose=verbose,
+                        use_cache=use_cache)
+        edm = EventDamageModel(max_depths,
+                               csv.get_column(SHORE_DIST_LABEL),
+                               csv.get_column(WALL_TYPE_LABEL),
+                               csv.get_column(STR_VALUE_LABEL),
+                               csv.get_column(CONT_VALUE_LABEL)
+                               )
+        results_dic = edm.calc_damage_and_costs(verbose_csv=True,
+                                                verbose=verbose)
+        for title, value in results_dic.iteritems():
+            csv.set_column(title, value, overwrite=overwrite)
+    
+        # Save info back to csv file
+        if exposure_file_out_marker == None:
+            exposure_file_out = exposure_file_in
+        else:
+            name, extension = exposure_file_in.split('.')
+            exposure_file_out = name + exposure_file_out_marker + \
+                                '.' + extension
+        csv.save(exposure_file_out)
+        if verbose: print '\n Augmented building file written to %s \n' %exposure_file_out
     
 def add_depth_and_momentum2csv(sww_base_name, exposure_file_in,
Index: /anuga_core/source/anuga/damage_modelling/test_inundation_damage.py
===================================================================
--- /anuga_core/source/anuga/damage_modelling/test_inundation_damage.py	(revision 4741)
+++ /anuga_core/source/anuga/damage_modelling/test_inundation_damage.py	(revision 4742)
@@ -204,5 +204,5 @@
         #Create a csv file
         self.csv_fileII = tempfile.mktemp(".csv")
-        fd = open(self.csv_file,'wb')
+        fd = open(self.csv_fileII,'wb')
         writer = csv.writer(fd)
         writer.writerow(['LONGITUDE','LATITUDE',STR_VALUE_LABEL,CONT_VALUE_LABEL,'ROOF_TYPE',WALL_TYPE_LABEL, SHORE_DIST_LABEL])
@@ -210,5 +210,4 @@
         writer.writerow(['151','-34.5','150000','76000','Metal','Double Brick',200.])
         writer.writerow(['151','-34.25','150000','76000','Metal','Brick Veneer',200.])
-        writer.writerow(['151.5','-35.5','199770','130000','Metal','Timber',20.])
         fd.close()
         
@@ -226,4 +225,5 @@
             pass
         os.remove(self.csv_file)
+        os.remove(self.csv_fileII)
 
     
@@ -237,4 +237,13 @@
 
     
+    def test_inundation_damage_list_as_input(self):
+
+        # Note, this isn't testing the results,
+        # just that is all runs
+        sww_file = self.domain.get_name() + "." + self.domain.format
+        #print "sww_file",sww_file
+        inundation_damage(sww_file,
+                          [self.csv_file, self.csv_fileII], verbose=False)
+
     def test_inundation_damage2(self):
 
@@ -309,4 +318,104 @@
         os.remove(sww.filename)
         os.remove(csv_file)
+         
+    def test_inundation_damage_list(self):
+
+        # create mesh
+        mesh_file = tempfile.mktemp(".tsh")    
+        points = [[0.0,0.0],[6.0,0.0],[6.0,6.0],[0.0,6.0]]
+        m = Mesh()
+        m.add_vertices(points)
+        m.auto_segment()
+        m.generate_mesh(verbose=False)
+        m.export_mesh_file(mesh_file)
+        
+        #Create shallow water domain
+        domain = Domain(mesh_file)
+        os.remove(mesh_file)
+        
+        domain.default_order=2
+        domain.beta_h = 0
+
+        #Set some field values
+        domain.set_quantity('elevation', elevation_function)
+        domain.set_quantity('friction', 0.03)
+        domain.set_quantity('xmomentum', 22.0)
+        domain.set_quantity('ymomentum', 55.0)
+
+        ######################
+        # Boundary conditions
+        B = Transmissive_boundary(domain)
+        domain.set_boundary( {'exterior': B})
+
+        # This call mangles the stage values.
+        domain.distribute_to_vertices_and_edges()
+        domain.set_quantity('stage', 0.3)
+
+        #sww_file = tempfile.mktemp("")
+        domain.set_name('datatest' + str(time.time()))
+        domain.format = 'sww'
+        domain.smooth = True
+        domain.reduction = mean
+
+        sww = get_dataobject(domain)
+        sww.store_connectivity()
+        sww.store_timestep(['stage', 'xmomentum', 'ymomentum'])
+        domain.set_quantity('stage', -0.3)
+        domain.time = 2.
+        sww.store_timestep(['stage', 'xmomentum', 'ymomentum'])
+        
+        #Create a csv file
+        csv_file = tempfile.mktemp(".csv")
+        fd = open(csv_file,'wb')
+        writer = csv.writer(fd)
+        writer.writerow(['x','y',STR_VALUE_LABEL,CONT_VALUE_LABEL,'ROOF_TYPE',WALL_TYPE_LABEL, SHORE_DIST_LABEL])
+        writer.writerow([5.5,0.5,'10','130000','Metal','Timber',20])
+        writer.writerow([4.5,1.0,'150','76000','Metal','Double Brick',20])
+        writer.writerow([0.1,1.5,'100','76000','Metal','Brick Veneer',300])
+        writer.writerow([6.1,1.5,'100','76000','Metal','Brick Veneer',300])
+        fd.close()
+        
+        extension = ".csv"
+        csv_fileII = tempfile.mktemp(extension)
+        fd = open(csv_fileII,'wb')
+        writer = csv.writer(fd)
+        writer.writerow(['x','y',STR_VALUE_LABEL,CONT_VALUE_LABEL,'ROOF_TYPE',WALL_TYPE_LABEL, SHORE_DIST_LABEL])
+        writer.writerow([5.5,0.5,'10','130000','Metal','Timber',20])
+        writer.writerow([4.5,1.0,'150','76000','Metal','Double Brick',20])
+        writer.writerow([0.1,1.5,'100','76000','Metal','Brick Veneer',300])
+        writer.writerow([6.1,1.5,'100','76000','Metal','Brick Veneer',300])
+        fd.close()
+        
+        sww_file = domain.get_name() + "." + domain.format
+        #print "sww_file",sww_file
+        marker='_gosh'
+        inundation_damage(sww_file, [csv_file, csv_fileII],
+                          exposure_file_out_marker=marker,
+                          verbose=False)
+
+        # Test one file
+        csv_handle = Exposure_csv(csv_file[:-4]+marker+extension)
+        struct_loss = csv_handle.get_column(EventDamageModel.STRUCT_LOSS_TITLE)
+        #print "struct_loss",struct_loss
+        struct_loss = [float(x) for x in struct_loss]
+        assert allclose(struct_loss,[10,150,16.9,0])       
+        depth = csv_handle.get_column(EventDamageModel.MAX_DEPTH_TITLE)
+        #print "depth",depth
+        depth = [float(x) for x in depth]
+        assert allclose(depth,[5.5,4.5,0.1,-0.3])
+       
+        # Test another file
+        csv_handle = Exposure_csv(csv_fileII[:-4]+marker+extension)
+        struct_loss = csv_handle.get_column(EventDamageModel.STRUCT_LOSS_TITLE)
+        #print "struct_loss",struct_loss
+        struct_loss = [float(x) for x in struct_loss]
+        assert allclose(struct_loss,[10,150,16.9,0])       
+        depth = csv_handle.get_column(EventDamageModel.MAX_DEPTH_TITLE)
+        #print "depth",depth
+        depth = [float(x) for x in depth]
+        assert allclose(depth,[5.5,4.5,0.1,-0.3]) 
+        os.remove(sww.filename)
+        os.remove(csv_file)
+        os.remove(csv_fileII)
         
     def ztest_add_depth_and_momentum2csv(self):
@@ -491,6 +600,6 @@
     else:
         pass
-    #suite = unittest.makeSuite(Test_inundation_damage,'test_calc_max_depth_and_momentum')
     suite = unittest.makeSuite(Test_inundation_damage,'test')
+    #suite = unittest.makeSuite(Test_inundation_damage,'test_inundation_damage_list_as_input')
     runner = unittest.TextTestRunner()
     runner.run(suite)
