Ignore:
Timestamp:
Mar 17, 2009, 4:02:54 PM (16 years ago)
Author:
rwilson
Message:

Revert back to 6481, prior to auto-merge of trunk and numpy branch.

Location:
branches/numpy/anuga/abstract_2d_finite_volumes
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/numpy/anuga/abstract_2d_finite_volumes/domain.py

    r6517 r6533  
    319319        return self.mesh.get_boundary_polygon(*args, **kwargs)
    320320
    321     # FIXME(Ole): This doesn't seem to be required
    322321    def get_number_of_triangles_per_node(self, *args, **kwargs):
    323322        return self.mesh.get_number_of_triangles_per_node(*args, **kwargs)
     
    349348    def statistics(self, *args, **kwargs):
    350349        return self.mesh.statistics(*args, **kwargs)
    351        
    352     def get_extent(self, *args, **kwargs):
    353         return self.mesh.get_extent(*args, **kwargs)   
    354350
    355351    ##
  • branches/numpy/anuga/abstract_2d_finite_volumes/generic_boundary_conditions.py

    r6517 r6533  
    8888    # FIXME (Ole): We should rename f to function to be consistent with
    8989    # Transmissive_Momentum_Set_Stage_Boundary (cf posting by rrraman)
    90     def __init__(self, domain=None,
    91                  f=None,
    92                  default_boundary=None,
    93                  verbose=False):
     90    def __init__(self, domain = None, f = None):
    9491        Boundary.__init__(self)
    95         self.default_boundary = default_boundary
    96         self.default_boundary_invoked = False    # Flag
    97         self.domain = domain
    98         self.verbose = verbose
    9992
    10093        try:
     
    129122    def evaluate(self, vol_id=None, edge_id=None):
    130123        # FIXME (Ole): I think this should be get_time(), see ticket:306
    131         try:
    132             res = self.f(self.domain.time)
    133         except Modeltime_too_early, e:
    134             raise Modeltime_too_early, e
    135         except Modeltime_too_late, e:
    136             if self.default_boundary is None:
    137                 raise Exception, e # Reraise exception
    138             else:
    139                 # Pass control to default boundary
    140                 res = self.default_boundary.evaluate(vol_id, edge_id)
    141                
    142                 # Ensure that result cannot be manipulated
    143                 # This is a real danger in case the
    144                 # default_boundary is a Dirichlet type
    145                 # for instance.
    146                 res = res.copy()
    147                
    148                 if self.default_boundary_invoked is False:
    149                     if self.verbose:               
    150                         # Issue warning the first time
    151                         msg = '%s' %str(e)
    152                         msg += 'Instead I will use the default boundary: %s\n'\
    153                             %str(self.default_boundary)
    154                         msg += 'Note: Further warnings will be supressed'
    155                         print msg
    156                
    157                     # FIXME (Ole): Replace this crude flag with
    158                     # Python's ability to print warnings only once.
    159                     # See http://docs.python.org/lib/warning-filter.html
    160                     self.default_boundary_invoked = True
    161 
    162         return res
     124        return self.f(self.domain.time)
    163125
    164126
     
    337299                    if self.default_boundary_invoked is False:
    338300                        # Issue warning the first time
    339                         if self.verbose:
    340                             msg = '%s' %str(e)
    341                             msg += 'Instead I will use the default boundary: %s\n'\
    342                                 %str(self.default_boundary)
    343                             msg += 'Note: Further warnings will be supressed'
    344                             print msg
     301                        msg = '%s' %str(e)
     302                        msg += 'Instead I will use the default boundary: %s\n'\
     303                            %str(self.default_boundary)
     304                        msg += 'Note: Further warnings will be supressed'
     305                        warn(msg)
    345306                   
    346307                        # FIXME (Ole): Replace this crude flag with
  • branches/numpy/anuga/abstract_2d_finite_volumes/quantity.py

    r6517 r6533  
    886886        # a crash in fittng, so disabled it until I can investigate further
    887887        # Sorry. 23 Jan 2009. Logged as ticket:314
    888         #if True: # Test will fail (31 Jan 2009)
    889         if False: # Test will pass (31 Jan 2009)
     888        if False:
    890889            # Use mesh as defined by domain
    891890            # This used to cause problems for caching due to quantities
  • branches/numpy/anuga/abstract_2d_finite_volumes/test_domain.py

    r6517 r6533  
    542542                        conserved_quantities =\
    543543                        ['stage', 'xmomentum', 'ymomentum'])
    544         domain.set_default_order(1)
    545544        domain.check_integrity()
    546545
     
    651650                        conserved_quantities =\
    652651                        ['stage', 'xmomentum', 'ymomentum'])
    653         domain.set_default_order(1)                       
    654652        domain.check_integrity()
    655653
     
    802800                             [ 11.0,  11.0,  11.0],
    803801                             [ 11.0,  11.0,  11.0]])
    804                              
    805     def test_that_mesh_methods_exist(self):
    806         """test_that_mesh_methods_exist
    807        
    808         Test that relavent mesh methods are made available in
    809         domain through composition
    810         """
    811         from mesh_factory import rectangular
    812         from shallow_water import Domain
    813 
    814         # Create basic mesh
    815         points, vertices, boundary = rectangular(1, 3)
    816 
    817         # Create shallow water domain
    818         domain = Domain(points, vertices, boundary)                             
    819        
    820        
    821         domain.get_centroid_coordinates()
    822         domain.get_radii()
    823         domain.get_areas()
    824         domain.get_area()
    825         domain.get_vertex_coordinates()
    826         domain.get_triangles()
    827         domain.get_nodes()
    828         domain.get_number_of_nodes()
    829         domain.get_normal(0,0)
    830         domain.get_intersecting_segments([[0.0, 0.0], [0.0, 1.0]])
    831         domain.get_disconnected_triangles()
    832         domain.get_boundary_tags()
    833         domain.get_boundary_polygon()
    834         #domain.get_number_of_triangles_per_node()
    835         domain.get_triangles_and_vertices_per_node()
    836         domain.get_interpolation_object()
    837         domain.get_tagged_elements()
    838         domain.get_lone_vertices()
    839         domain.get_unique_vertices()
    840         g = domain.get_georeference()
    841         domain.set_georeference(g)
    842         domain.build_tagged_elements_dictionary()
    843         domain.statistics()
    844         domain.get_extent()
    845 
    846        
    847        
    848802
    849803#-------------------------------------------------------------
  • branches/numpy/anuga/abstract_2d_finite_volumes/test_general_mesh.py

    r6517 r6533  
    9191                  str(verts)))
    9292        self.assert_(num.allclose(num.array([nodes_absolute[1],
    93                                      nodes_absolute[0],
    94                                      nodes_absolute[2]]), verts))
    95         verts = domain.get_vertex_coordinates(triangle_id=0,
    96                                               absolute=True)       
    97         self.assert_(num.allclose(num.array([nodes_absolute[1],
    98                                      nodes_absolute[0],
    99                                      nodes_absolute[2]]), verts))
    100        
    101        
     93                                             nodes_absolute[0],
     94                                             nodes_absolute[2]]),
     95                                  verts), msg)
    10296
    10397    def test_get_vertex_coordinates_triangle_id(self):
  • branches/numpy/anuga/abstract_2d_finite_volumes/util.py

    r6517 r6533  
    925925                    verbose = False):   
    926926       
    927     # FIXME(Ole): Shouldn't print statements here be governed by verbose?
    928927    assert type(gauge_filename) == type(''), 'Gauge filename must be a string'
    929928   
     
    972971            raise msg
    973972
    974         if verbose:
    975             print 'swwfile', swwfile
     973        print 'swwfile', swwfile
    976974
    977975        # Extract parent dir name and use as label
     
    24912489                                 base_name=base,
    24922490                                 verbose=verbose)
    2493     #print 'sww files just after get_all_swwfiles()', sww_files
    2494     # fudge to get SWW files in 'correct' order, oldest on the left
    2495     sww_files.sort()
    2496 
    2497     if verbose:
    2498         print 'sww files', sww_files
    24992491   
    25002492    #to make all the quantities lower case for file_function
     
    25052497
    25062498    core_quantities = ['stage', 'elevation', 'xmomentum', 'ymomentum']
    2507     gauge_file = out_name
    2508 
    2509     heading = [quantity for quantity in quantities]
    2510     heading.insert(0,'time')
    2511     heading.insert(1,'hours')
    2512 
    2513     #create a list of csv writers for all the points and write header
    2514     points_writer = []
    2515     for point_i,point in enumerate(points):
    2516         points_writer.append(writer(file(dir_name + sep + gauge_file
    2517                                          + point_name[point_i] + '.csv', "wb")))
    2518         points_writer[point_i].writerow(heading)
    2519    
    2520     if verbose: print 'Writing csv files'
    2521 
    2522     quake_offset_time = None
    2523 
     2499   
    25242500    for sww_file in sww_files:
    25252501        sww_file = join(dir_name, sww_file+'.sww')
Note: See TracChangeset for help on using the changeset viewer.