Changeset 7810


Ignore:
Timestamp:
Jun 8, 2010, 2:31:04 PM (10 years ago)
Author:
hudson
Message:

Added aggressive psyco optimisation, fixed benchmark app to work with new API.

Location:
trunk/anuga_core
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/anuga_core/benchmarks/benchmark_sww2dem.py

    r7708 r7810  
    44"""
    55
    6 from anuga.shallow_water.data_manager import sww2dem
     6from anuga.file_conversion.sww2dem import sww2dem
    77from create_test_sww import create_test_sww
    88import os.path
     
    2727                        verbose=True,
    2828                        format='asc')
    29 
     29 
    3030               
    3131# use existing file
     
    3333        create_test_sww(sww_name)
    3434
     35
    3536start_time = time.time()       
    36 cProfile.run('sww2dem_test()')
    37 #sww2dem_test()
     37#cProfile.run('sww2dem_test()')
     38sww2dem_test()
    3839stop_time = time.time()
    3940print ('sww2dem took %.1fs\n\n\n' % (stop_time - start_time))
  • trunk/anuga_core/benchmarks/create_test_sww.py

    r7697 r7810  
    22# Import necessary modules
    33#------------------------------------------------------------------------------
    4 from anuga.abstract_2d_finite_volumes.mesh_factory import rectangular_cross
    5 from anuga.shallow_water import Domain
    6 from anuga.shallow_water import Reflective_boundary
    7 from anuga.shallow_water import Dirichlet_boundary
    8 
     4import anuga
    95
    106def create_test_sww(sww_name):
     
    139        # Setup computational domain
    1410        #------------------------------------------------------------------------------
    15         points, vertices, boundary = rectangular_cross(50, 50,
     11        points, vertices, boundary = anuga.rectangular_cross(50, 50,
    1612                                                                                                   len1=50.0, len2=50.0) # Mesh
    1713
    18         domain = Domain(points, vertices, boundary)  # Create domain
     14        domain = anuga.Domain(points, vertices, boundary)  # Create domain
    1915        domain.set_name(sww_name)                  # Output name
    2016
     
    3329        # Setup boundary conditions
    3430        #------------------------------------------------------------------------------
    35         Bi = Dirichlet_boundary([0.4, 0, 0])         # Inflow
    36         Br = Reflective_boundary(domain)             # Solid reflective wall
     31        Bi = anuga.Dirichlet_boundary([0.4, 0, 0])         # Inflow
     32        Br = anuga.Reflective_boundary(domain)             # Solid reflective wall
    3733
    3834        domain.set_boundary({'left': Bi, 'right': Br, 'top': Br, 'bottom': Br})
  • trunk/anuga_core/source/anuga/__init__.py

    r7800 r7810  
    2222import sys
    2323sys.path += __path__
     24
    2425
    2526#-----------------------------------------------------
     
    7879                            import Transmissive_boundary
    7980
     81
     82
     83#-----------------------------
     84# Shalow Water Tsunamis
     85#-----------------------------
     86
     87from anuga.shallow_water.smf import slide_tsunami, slump_tsunami
    8088
    8189
     
    110118#-----------------------------
    111119from anuga.shallow_water.sww_interrogate import get_flow_through_cross_section
     120   
    112121
    113122#-----------------------------
     
    281290
    282291
    283 
    284 
    285 
     292from anuga.config import use_psyco
     293if use_psyco:
     294    # try using psyco if available
     295    try:
     296        import psyco
     297    except:
     298        import os
     299        if os.name == 'posix' and os.uname()[4] in ['x86_64', 'ia64']:
     300            pass
     301            # Psyco isn't supported on 64 bit systems, but it doesn't matter
     302        else:
     303            log.critical('WARNING: psyco (speedup) could not be imported, '
     304                         'you may want to consider installing it')
     305    else:
     306        psyco.full() # aggressively compile everything
     307        #psyco.background() # attempt to profile code - only compile most used
     308       
     309
     310
     311
     312
  • trunk/anuga_core/source/anuga/abstract_2d_finite_volumes/file_function.py

    r7690 r7810  
    22"""File function
    33Takes a file as input, and returns it as a mathematical function.
    4 For example, you can load an arbitrary 2D heightfield mesh, and treat it as a function as so:
     4For example, you can load an arbitrary 2D heightfield mesh, and treat it as a
     5function like so:
    56
    67F = file_function('my_mesh.sww', ...)
    78evaluated_point = F(x, y)
    89
    9 Values will be interpolated across the surface of the mesh. Holes in the mesh have an undefined value.
     10Values will be interpolated across the surface of the mesh. Holes in the mesh
     11have an undefined value.
    1012
    1113"""
     
    2123
    2224
    23 
    24 ##
    25 # @brief Read time history of data from NetCDF file, return callable object.
    26 # @param filename  Name of .sww or .tms file.
    27 # @param domain Associated domain object.
    28 # @param quantities Name of quantity to be interpolated or a list of names.
    29 # @param interpolation_points List of absolute UTM coordinates for points
    30 #                             (N x 2) or geospatial object or
    31 #                             points file name at which values are sought.
    32 # @param time_thinning
    33 # @param verbose True if this function is to be verbose.
    34 # @param use_cache True means that caching of intermediate result is attempted.
    35 # @param boundary_polygon
    36 # @param output_centroids if True, data for the centroid of the triangle will be output
    37 # @return A callable object.
    3825def file_function(filename,
    3926                  domain=None,
     
    10794        if verbose:
    10895            msg = 'Quantities specified in file_function are None,'
    109             msg += ' so I will use stage, xmomentum, and ymomentum in that order'
     96            msg += ' so using stage, xmomentum, and ymomentum in that order'
    11097            log.critical(msg)
    11198        quantities = ['stage', 'xmomentum', 'ymomentum']
     
    140127            msg = 'Caching was requested, but caching module'+\
    141128                  'could not be imported'
    142             raise msg
     129            raise Exception(msg)
    143130
    144131        f, starttime = cache(_file_function,
     
    160147        #Update domain.startime if it is *earlier* than starttime from file
    161148        if starttime > domain.starttime:
    162             msg = 'WARNING: Start time as specified in domain (%f)'\
    163                   %domain.starttime
    164             msg += ' is earlier than the starttime of file %s (%f).'\
    165                      %(filename, starttime)
     149            msg = 'WARNING: Start time as specified in domain (%f)' \
     150                  % domain.starttime
     151            msg += ' is earlier than the starttime of file %s (%f).' \
     152                     % (filename, starttime)
    166153            msg += ' Modifying domain starttime accordingly.'
    167154           
     
    206193    try:
    207194        fid = open(filename)
    208     except Exception, e:
     195    except IOError, e:
    209196        msg = 'File "%s" could not be opened: Error="%s"' % (filename, e)
    210         raise msg
     197        raise IOError(msg)
    211198
    212199    # read first line of file, guess file type
     
    312299    if filename[-3:] == 'tms' and spatial is True:
    313300        msg = 'Files of type tms must not contain spatial  information'
    314         raise msg
     301        raise Exception(msg)
    315302
    316303    if filename[-3:] == 'sww' and spatial is False:
    317304        msg = 'Files of type sww must contain spatial information'       
    318         raise msg
     305        raise Exception(msg)
    319306
    320307    if filename[-3:] == 'sts' and spatial is False:
    321308        #What if mux file only contains one point
    322309        msg = 'Files of type sts must contain spatial information'       
    323         raise msg
     310        raise Exception(msg)
    324311
    325312    if filename[-3:] == 'sts' and boundary_polygon is None:
    326313        #What if mux file only contains one point
    327314        msg = 'Files of type sts require boundary polygon'       
    328         raise msg
     315        raise Exception(msg)
    329316
    330317    # Get first timestep
     
    333320    except ValueError:
    334321        msg = 'Could not read starttime from file %s' % filename
    335         raise msg
     322        raise Exception(msg)
    336323
    337324    # Get variables
     
    380367            triangles = fid.variables['volumes'][:]
    381368
    382         x = num.reshape(x, (len(x),1))
    383         y = num.reshape(y, (len(y),1))
    384         vertex_coordinates = num.concatenate((x,y), axis=1) #m x 2 array
     369        x = num.reshape(x, (len(x), 1))
     370        y = num.reshape(y, (len(y), 1))
     371        vertex_coordinates = num.concatenate((x, y), axis=1) #m x 2 array
    385372
    386373        if boundary_polygon is not None:
    387374            # Remove sts points that do not lie on boundary
    388             # FIXME(Ole): Why don't we just remove such points from the list of points and associated data?
    389             # I am actually convinced we can get rid of neighbour_gauge_id altogether as the sts file is produced using the ordering file.
    390             # All sts points are therefore always present in the boundary. In fact, they *define* parts of the boundary.
     375            # FIXME(Ole): Why don't we just remove such points from the list of
     376            # points and associated data?
     377            # I am actually convinced we can get rid of neighbour_gauge_id
     378            # altogether as the sts file is produced using the ordering file.
     379            # All sts points are therefore always present in the boundary.
     380            # In fact, they *define* parts of the boundary.
    391381            boundary_polygon=ensure_numeric(boundary_polygon)
    392             boundary_polygon[:,0] -= xllcorner
    393             boundary_polygon[:,1] -= yllcorner
     382            boundary_polygon[:, 0] -= xllcorner
     383            boundary_polygon[:, 1] -= yllcorner
    394384            temp=[]
    395385            boundary_id=[]
     
    420410            gauge_neighbour_id=ensure_numeric(gauge_neighbour_id)
    421411
    422             if len(num.compress(gauge_neighbour_id>=0,gauge_neighbour_id)) \
     412            if len(num.compress(gauge_neighbour_id>=0, gauge_neighbour_id)) \
    423413               != len(temp)-1:
    424414                msg='incorrect number of segments'
     
    433423        if interpolation_points is not None:
    434424            # Adjust for georef
    435             interpolation_points[:,0] -= xllcorner
    436             interpolation_points[:,1] -= yllcorner       
     425            interpolation_points[:, 0] -= xllcorner
     426            interpolation_points[:, 1] -= yllcorner       
    437427    else:
    438428        gauge_neighbour_id=None
  • trunk/anuga_core/source/anuga/abstract_2d_finite_volumes/generic_domain.py

    r7780 r7810  
    1616from time import time as walltime
    1717
    18 from anuga.config import epsilon
    19 from anuga.config import beta_euler, beta_rk2
    20 
    2118from anuga.abstract_2d_finite_volumes.neighbour_mesh import Mesh
    22 from anuga.abstract_2d_finite_volumes.generic_boundary_conditions \
    23         import ( Boundary, File_boundary, AWI_boundary,
    24                  Dirichlet_boundary, Time_boundary, Transmissive_boundary )
    2519from pmesh2domain import pmesh_to_domain
    2620from region import Set_region as region_set_region
     
    3226import numpy as num
    3327
    34 
    35 ##
    36 # @brief Generic Domain class
    3728class Generic_Domain:
    38 
    39     ##
    40     # @brief Generic computational Domain constructor.
     29    '''
     30    Generic computational Domain constructor.
    4131    # @param source Name of mesh file or coords of mesh vertices.
    4232    # @param triangles Mesh connectivity (see mesh.py for more information).
     
    5545    # @param numproc ??
    5646    # @param number_of_full_nodes ??
    57     # @param number_of_full_triangles ??
     47    # @param number_of_full_triangles ??   
     48    '''
     49
    5850    def __init__(self, source=None,
    5951                       triangles=None,
     
    136128        self.number_of_full_nodes = self.mesh.number_of_full_nodes
    137129        self.number_of_full_triangles = self.mesh.number_of_full_triangles
    138         self.number_of_triangles_per_node = self.mesh.number_of_triangles_per_node
     130        self.number_of_triangles_per_node = \
     131                                    self.mesh.number_of_triangles_per_node
    139132
    140133        self.vertex_value_indices = self.mesh.vertex_value_indices
     
    162155            self.other_quantities = other_quantities
    163156
    164         # Test that conserved_quantities are stored in the first entries of evolved_quantities
     157        # Test that conserved_quantities are stored in the first entries of
     158        # evolved_quantities
    165159        for i, quantity in enumerate(self.conserved_quantities):
    166             msg = 'The conserved quantities must be the first entries of evolved_quantities'
     160            msg = 'The conserved quantities must be the first entries of '
     161            msg += 'evolved_quantities'
    167162            assert quantity == self.evolved_quantities[i], msg
    168163           
     
    205200        for key in self.ghost_recv_dict:
    206201            buffer_shape = self.ghost_recv_dict[key][0].shape[0]
    207             self.ghost_recv_dict[key].append(num.zeros((buffer_shape, self.nsys),
     202            self.ghost_recv_dict[key].append( \
     203                                            num.zeros((buffer_shape, self.nsys),
    208204                                             num.float))
    209205
     
    321317       
    322318    def get_edge_midpoint_coordinates(self, *args, **kwargs):
    323         return self.mesh.get_edge_midpoint_coordinates(*args, **kwargs)                
     319        return self.mesh.get_edge_midpoint_coordinates(*args, **kwargs)   
    324320       
    325321    def get_edge_midpoint_coordinate(self, *args, **kwargs):
     
    972968
    973969        for i, quantity in enumerate(self.conserved_quantities):
    974             msg = 'Conserved quantities must be the first entries of evolved_quantities'
     970            msg = 'Conserved quantities must be the first entries '
     971            msg += 'of evolved_quantities'
    975972            assert quantity == self.evolved_quantities[i], msg
    976973 
     
    10051002
    10061003        msg = ''
    1007         #if self.recorded_min_timestep == self.recorded_max_timestep:
    1008         #    msg += 'Time = %.4f, delta t = %.8f, steps=%d (%d)'\
    1009         #           %(self.time, self.recorded_min_timestep, self.number_of_steps,
    1010         #             self.number_of_first_order_steps)
    1011         #elif self.recorded_min_timestep > self.recorded_max_timestep:
    1012         #    msg += 'Time = %.4f, steps=%d (%d)'\
    1013         #           %(self.time, self.number_of_steps,
    1014         #             self.number_of_first_order_steps)
    1015         #else:
    1016         #    msg += 'Time = %.4f, delta t in [%.8f, %.8f], steps=%d (%d)'\
    1017         #           %(self.time, self.recorded_min_timestep,
    1018         #             self.recorded_max_timestep, self.number_of_steps,
    1019         #             self.number_of_first_order_steps)
    10201004
    10211005        model_time = self.get_time()
    10221006        if self.recorded_min_timestep == self.recorded_max_timestep:
    10231007            msg += 'Time = %.4f, delta t = %.8f, steps=%d' \
    1024                        % (model_time, self.recorded_min_timestep, self.number_of_steps)
     1008                       % (model_time, self.recorded_min_timestep, \
     1009                                    self.number_of_steps)
    10251010        elif self.recorded_min_timestep > self.recorded_max_timestep:
    10261011            msg += 'Time = %.4f, steps=%d' \
     
    17901775            q_evol[:] = q_cons
    17911776        else:
    1792             msg = 'Method conserved_values_to_evolved_values must be overridden by Domain subclass'
     1777            msg = 'Method conserved_values_to_evolved_values must be overridden'
     1778            msg += ' by Domain subclass'
    17931779            raise Exception, msg
    17941780
     
    18241810                    q_evol = self.get_evolved_quantities(vol_id, edge = edge_id)
    18251811
    1826                     q_evol = self.conserved_values_to_evolved_values(q_bdry, q_evol)
     1812                    q_evol = self.conserved_values_to_evolved_values \
     1813                                                            (q_bdry, q_evol)
    18271814                else:
    1828                     msg = 'Boundary must return array of either conserved or evolved quantities'
     1815                    msg = 'Boundary must return array of either conserved'
     1816                    msg += ' or evolved quantities'
    18291817                    raise Exception, msg
    18301818               
     
    18721860                               % self.max_smallsteps
    18731861                    log.critical(msg)
    1874                     timestep = self.evolve_min_timestep  # Try enforcing min_step
    1875 
    1876                     log.critical(self.timestepping_statistics(track_speeds=True))
     1862                    timestep = self.evolve_min_timestep  # Try enforce min_step
     1863
     1864                    stats = self.timestepping_statistics(track_speeds=True)
     1865                    log.critical(stats)
    18771866
    18781867                    raise Exception, msg
     
    20382027
    20392028# Optimisation with psyco
    2040 from anuga.config import use_psyco
    2041 
    2042 if use_psyco:
    2043     try:
    2044         import psyco
    2045     except:
    2046         import os
    2047         if os.name == 'posix' and os.uname()[4] in ['x86_64', 'ia64']:
    2048             pass
    2049             # Psyco isn't supported on 64 bit systems, but it doesn't matter
    2050         else:
    2051             log.critical('WARNING: psyco (speedup) could not be imported, '
    2052                          'you may want to consider installing it')
    2053     else:
    2054         psyco.bind(Generic_Domain.update_boundary)
    2055         #psyco.bind(Domain.update_timestep) # Not worth it
    2056         psyco.bind(Generic_Domain.update_conserved_quantities)
    2057         psyco.bind(Generic_Domain.distribute_to_vertices_and_edges)
     2029#from anuga.config import use_psyco
     2030
     2031#if use_psyco:
     2032    #try:
     2033        #import psyco
     2034    #except:
     2035        #import os
     2036        #if os.name == 'posix' and os.uname()[4] in ['x86_64', 'ia64']:
     2037            #pass
     2038            ## Psyco isn't supported on 64 bit systems, but it doesn't matter
     2039        #else:
     2040            #log.critical('WARNING: psyco (speedup) could not be imported, '
     2041                         #'you may want to consider installing it')
     2042    #else:
     2043        #psyco.bind(Generic_Domain.update_boundary)
     2044        ##psyco.bind(Domain.update_timestep) # Not worth it
     2045        #psyco.bind(Generic_Domain.update_conserved_quantities)
     2046        #psyco.bind(Generic_Domain.distribute_to_vertices_and_edges)
    20582047
    20592048
  • trunk/anuga_core/source/anuga/config.py

    r7454 r7810  
    244244        #netcdf_mode_w = 'w'   # Old style NetCDF used by OSG viewer
    245245
     246
  • trunk/anuga_core/source/anuga/fit_interpolate/interpolate.py

    r7778 r7810  
    12341234
    12351235
    1236 ##
    1237 # @brief ??
    1238 # @param file_name Name of the .SWW file to read.
    1239 def read_sww(file_name):
    1240     """
    1241     obsolete - Nothing should be calling this
    1242 
    1243     Read in an sww file.
    1244 
    1245     Input;
    1246     file_name - the sww file
    1247 
    1248     Output;
    1249     x - Vector of x values
    1250     y - Vector of y values
    1251     z - Vector of bed elevation
    1252     volumes - Array.  Each row has 3 values, representing
    1253     the vertices that define the volume
    1254     time - Vector of the times where there is stage information
    1255     stage - array with respect to time and vertices (x,y)
    1256     """
    1257 
    1258     msg = 'Function read_sww in interpolat.py is obsolete'
    1259     raise Exception, msg
    1260 
    1261     #FIXME Have this reader as part of data_manager?
    1262 
    1263     from Scientific.IO.NetCDF import NetCDFFile
    1264     import tempfile
    1265     import sys
    1266     import os
    1267 
    1268     #Check contents
    1269     #Get NetCDF
    1270 
    1271     # see if the file is there.  Throw a QUIET IO error if it isn't
    1272     # I don't think I could implement the above
    1273 
    1274     #throws prints to screen if file not present
    1275     junk = tempfile.mktemp(".txt")
    1276     fd = open(junk,'w')
    1277     stdout = sys.stdout
    1278     sys.stdout = fd
    1279     fid = NetCDFFile(file_name, netcdf_mode_r)
    1280     sys.stdout = stdout
    1281     fd.close()
    1282     #clean up
    1283     os.remove(junk)
    1284 
    1285     # Get the variables
    1286     x = fid.variables['x'][:]
    1287     y = fid.variables['y'][:]
    1288     volumes = fid.variables['volumes'][:]
    1289     time = fid.variables['time'][:]
    1290 
    1291     keys = fid.variables.keys()
    1292     keys.remove("x")
    1293     keys.remove("y")
    1294     keys.remove("volumes")
    1295     keys.remove("time")
    1296      #Turn NetCDF objects into numeric arrays
    1297     quantities = {}
    1298     for name in keys:
    1299         quantities[name] = fid.variables[name][:]
    1300 
    1301     fid.close()
    1302     return x, y, volumes, time, quantities
    1303 
    1304 
    1305 #-------------------------------------------------------------
    1306 if __name__ == "__main__":
    1307     names = ["x","y"]
    1308     someiterable = [[1,2],[3,4]]
    1309     csvwriter = writer(file("some.csv", "wb"))
    1310     csvwriter.writerow(names)
    1311     for row in someiterable:
    1312         csvwriter.writerow(row)
  • trunk/anuga_core/source/anuga/pmesh/mesh_quadtree.py

    r7778 r7810  
    66
    77"""
    8 import time
    98
    10 from anuga.utilities.numerical_tools import get_machine_precision
    119from anuga.utilities.numerical_tools import ensure_numeric
    1210from anuga.config import max_float
     
    1513from anuga.geometry.aabb import AABB
    1614
    17 from anuga.utilities import compile
    18 if compile.can_use_C_extension('polygon_ext.c'):
     15from anuga.utilities import compile as compile_c
     16if compile_c.can_use_C_extension('polygon_ext.c'):
    1917    # Underlying C implementations can be accessed
    2018    from polygon_ext import _is_inside_triangle       
    2119else:
    22     msg = 'C implementations could not be accessed by %s.\n ' %__file__
     20    msg = 'C implementations could not be accessed by %s.\n ' % __file__
    2321    msg += 'Make sure compile_all.py has been run as described in '
    2422    msg += 'the ANUGA installation guide.'
     
    6967            x2, y2 = V[i3+2, :]
    7068
    71             node_data = [i, V[i3:i3+3,:], normals[i,:]]
     69            node_data = [i, V[i3:i3+3, :], normals[i, :]]
    7270
    7371            # insert a tuple with an AABB, and the triangle index as data
     
    7674                             node_data))
    7775
    78     def search_fast(self, x):
     76    def search_fast(self, point):
    7977        """
    8078        Find the triangle (element) that the point x is in.
    8179
    8280        Inputs:
    83             x:    The point to test
     81            point:    The point to test
    8482       
    8583        Return:
     
    9391        """
    9492       
    95         x = ensure_numeric(x, num.float)
     93        point = ensure_numeric(point, num.float)
    9694                 
    9795        # check the last triangle found first
    9896        element_found, sigma0, sigma1, sigma2, k = \
    99                    self._search_triangles_of_vertices(self.last_triangle, x)
     97                   self._search_triangles_of_vertices(self.last_triangle, point)
    10098        if element_found:
    10199            return True, sigma0, sigma1, sigma2, k
     
    104102
    105103        # test neighbouring tris
    106         tri_data = branch.test_leaves(x)         
     104        tri_data = branch.test_leaves(point)         
    107105        element_found, sigma0, sigma1, sigma2, k = \
    108                     self._search_triangles_of_vertices(tri_data, x)
     106                    self._search_triangles_of_vertices(tri_data, point)
    109107        if element_found:
    110108            return True, sigma0, sigma1, sigma2, k       
     
    115113        while branch:               
    116114            for sibling in next_search:
    117                 tri_data = sibling.search(x)         
     115                tri_data = sibling.search(point)         
    118116                element_found, sigma0, sigma1, sigma2, k = \
    119                             self._search_triangles_of_vertices(tri_data, x)
     117                            self._search_triangles_of_vertices(tri_data, point)
    120118                if element_found:
    121119                    return True, sigma0, sigma1, sigma2, k
     
    124122            branch = branch.parent
    125123            if branch:
    126                 tri_data = branch.test_leaves(x)     
     124                tri_data = branch.test_leaves(point)     
    127125                element_found, sigma0, sigma1, sigma2, k = \
    128                             self._search_triangles_of_vertices(tri_data, x)
     126                            self._search_triangles_of_vertices(tri_data, point)
    129127                if element_found:
    130128                    return True, sigma0, sigma1, sigma2, k     
     
    133131
    134132
    135     def _search_triangles_of_vertices(self, triangles, x):
     133    def _search_triangles_of_vertices(self, triangles, point):
    136134        """Search for triangle containing x among triangle list
    137135
     
    141139        Input check disabled to speed things up.
    142140       
    143         x is the point to test
     141        point is the point to test
    144142        triangles is the triangle list
    145143        return the found triangle and its interpolation sigma.
     
    147145
    148146        for node_data in triangles:             
    149             if bool(_is_inside_triangle(x, node_data[0][1], \
     147            if bool(_is_inside_triangle(point, node_data[0][1], \
    150148                        int(True), 1.0e-12, 1.0e-12)):
    151149                normals = node_data[0][2]     
     
    155153                xi0, xi1, xi2 = node_data[0][1]
    156154
    157                 sigma0 = num.dot((x-xi1), n0)/num.dot((xi0-xi1), n0)
    158                 sigma1 = num.dot((x-xi2), n1)/num.dot((xi1-xi2), n1)
    159                 sigma2 = num.dot((x-xi0), n2)/num.dot((xi2-xi0), n2)
     155                sigma0 = num.dot((point-xi1), n0)/num.dot((xi0-xi1), n0)
     156                sigma1 = num.dot((point-xi2), n1)/num.dot((xi1-xi2), n1)
     157                sigma2 = num.dot((point-xi0), n2)/num.dot((xi2-xi0), n2)
    160158
    161159                # Don't look for any other triangles in the triangle list
  • trunk/anuga_core/source/anuga/shallow_water/shallow_water_domain.py

    r7778 r7810  
    14191419
    14201420# Optimisation with psyco
    1421 from anuga.config import use_psyco
    1422 if use_psyco:
    1423     try:
    1424         import psyco
    1425     except:
    1426         import os
    1427         if os.name == 'posix' and os.uname()[4] in ['x86_64', 'ia64']:
    1428             pass
    1429             #Psyco isn't supported on 64 bit systems, but it doesn't matter
    1430         else:
    1431             msg = ('WARNING: psyco (speedup) could not be imported, '
    1432                    'you may want to consider installing it')
    1433             log.critical(msg)
    1434     else:
    1435         psyco.bind(Domain.distribute_to_vertices_and_edges)
    1436         psyco.bind(Domain.compute_fluxes)
     1421#from anuga.config import use_psyco
     1422#if use_psyco:
     1423    #try:
     1424        #import psyco
     1425    #except:
     1426        #import os
     1427        #if os.name == 'posix' and os.uname()[4] in ['x86_64', 'ia64']:
     1428            #pass
     1429            ##Psyco isn't supported on 64 bit systems, but it doesn't matter
     1430        #else:
     1431            #msg = ('WARNING: psyco (speedup) could not be imported, '
     1432                   #'you may want to consider installing it')
     1433            #log.critical(msg)
     1434    #else:
     1435        #psyco.bind(Domain.distribute_to_vertices_and_edges)
     1436        #psyco.bind(Domain.compute_fluxes)
    14371437
    14381438
  • trunk/anuga_core/source/anuga/utilities/log.py

    r7519 r7810  
    9292
    9393    global _setup, log_logging_level
     94    fname = '' # default to no frame name if it cannot be found
     95    lnum = 0
    9496
    9597    # have we been setup?
Note: See TracChangeset for help on using the changeset viewer.