Ignore:
Timestamp:
Apr 8, 2013, 9:28:42 PM (12 years ago)
Author:
steve
Message:

Getting rid of tests for importing C code

Location:
trunk/anuga_core/source/anuga
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/anuga_core/source/anuga/abstract_2d_finite_volumes/quantity.py

    r8690 r8820  
    15561556# Prepare the C extensions.
    15571557######
    1558 
    1559 from anuga.utilities import compile
    1560 
    1561 if compile.can_use_C_extension('quantity_ext.c'):
    1562     # Underlying C implementations can be accessed
    1563 
    1564     from quantity_ext import \
     1558from quantity_ext import \
    15651559         average_vertex_values,\
    15661560         backup_centroid_values,\
     
    15821576         set_vertex_values_c, \
    15831577         update
    1584 else:
    1585     msg = 'C implementations could not be accessed by %s.\n ' % __file__
    1586     msg += 'Make sure compile_all.py has been run as described in '
    1587     msg += 'the ANUGA installation guide.'
    1588     raise Exception(msg)
  • trunk/anuga_core/source/anuga/caching/caching.py

    r8709 r8820  
    11141114  from anuga.fit_interpolate.general_fit_interpolate import FitInterpolate
    11151115 
    1116   # Setup for quad_tree extension
    1117   from anuga.utilities import compile
    1118   if compile.can_use_C_extension('quad_tree_ext.c'):
    1119       import quad_tree_ext
    1120   else:
    1121       msg = "C implementation of quad tree extension not avaliable"
    1122       raise Exception(msg)
    1123 
    1124   # Setup for sparse_matrix extension
    1125   from anuga.utilities import compile
    1126   if compile.can_use_C_extension('sparse_matrix_ext.c'):
    1127       import sparse_matrix_ext
    1128   else:
    1129       msg = "C implementation of sparse_matrix extension not avaliable"
    1130       raise Exception(msg)
    1131 
     1116  import quad_tree_ext
     1117  import sparse_matrix_ext
    11321118  from anuga.geometry.aabb import AABB
    11331119
  • trunk/anuga_core/source/anuga/file_conversion/asc2dem.py

    r8780 r8820  
    192192
    193193    #Store data
    194     n = len(lines[6:])
    195     for i, line in enumerate(lines[6:]):
    196         fields = line.split()
    197         if verbose and i % ((n+10)/10) == 0:
    198             log.critical('Processing row %d of %d' % (i, nrows))
    199            
    200         if len(fields) != ncols:
    201             msg = 'Wrong number of columns in file "%s" line %d\n' % (name_in, i)
    202             msg += 'I got %d elements, but there should have been %d\n' % (len(fields), ncols)
    203             raise Exception, msg
    204 
    205         elevation[i, :] = num.array([float(x) for x in fields])
     194    import numpy
     195
     196    datafile = open(name_in)
     197    elevation[:,:] = numpy.loadtxt(datafile, skiprows=6)
     198    datafile.close()
     199
     200#    n = len(lines[6:])
     201#    for i, line in enumerate(lines[6:]):
     202#        fields = line.split()
     203#        if verbose and i % ((n+10)/10) == 0:
     204#            log.critical('Processing row %d of %d' % (i, nrows))
     205#
     206#        if len(fields) != ncols:
     207#            msg = 'Wrong number of columns in file "%s" line %d\n' % (name_in, i)
     208#            msg += 'I got %d elements, but there should have been %d\n' % (len(fields), ncols)
     209#            raise Exception, msg
     210#
     211#        elevation[i, :] = num.array([float(x) for x in fields])
    206212
    207213    fid.close()
  • trunk/anuga_core/source/anuga/geometry/polygon.py

    r8819 r8820  
    11161116################################################################################
    11171117
    1118 from anuga.utilities import compile
    1119 if compile.can_use_C_extension('polygon_ext.c'):
    1120     # Underlying C implementations can be accessed
    1121     from polygon_ext import _point_on_line
    1122     from polygon_ext import _separate_points_by_polygon
    1123     from polygon_ext import _interpolate_polyline   
    1124     from polygon_ext import _polygon_overlap
    1125     from polygon_ext import _line_intersect
    1126     from polygon_ext import _is_inside_triangle       
    1127     #from polygon_ext import _intersection
    1128 
    1129 else:
    1130     ERROR_MSG = 'C implementations could not be accessed by %s.\n ' % __file__
    1131     ERROR_MSG += 'Make sure compile_all.py has been run as described in '
    1132     ERROR_MSG += 'the ANUGA installation guide.'
    1133     raise Exception(ERROR_MSG)
     1118from polygon_ext import _point_on_line
     1119from polygon_ext import _separate_points_by_polygon
     1120from polygon_ext import _interpolate_polyline   
     1121from polygon_ext import _polygon_overlap
     1122from polygon_ext import _line_intersect
     1123from polygon_ext import _is_inside_triangle       
     1124#from polygon_ext import _intersection
     1125
     1126
    11341127
    11351128
  • trunk/anuga_core/source/anuga/shallow_water/boundaries.py

    r8810 r8820  
    2929import anuga.utilities.log as log
    3030     
    31 
    32 from anuga.utilities import compile
    33 if compile.can_use_C_extension('shallow_water_ext.c'):
    34     # Underlying C implementations can be accessed
    35     from shallow_water_ext import rotate
    36 else:
    37     msg = 'C implementations could not be accessed by %s.\n ' % __file__
    38     msg += 'Make sure compile_all.py has been run as described in '
    39     msg += 'the ANUGA installation guide.'
    40     raise Exception, msg
     31from shallow_water_ext import rotate
     32
     33#from anuga.utilities import compile
     34#if compile.can_use_C_extension('shallow_water_ext.c'):
     35#    # Underlying C implementations can be accessed
     36#    from shallow_water_ext import rotate
     37#else:
     38#    msg = 'C implementations could not be accessed by %s.\n ' % __file__
     39#    msg += 'Make sure compile_all.py has been run as described in '
     40#    msg += 'the ANUGA installation guide.'
     41#    raise Exception, msg
    4142
    4243
  • trunk/anuga_core/source/anuga/utilities/cg_solve.py

    r8690 r8820  
    1010
    1111# Setup for C conjugate gradient solver
    12 from anuga.utilities import compile
    13 if compile.can_use_C_extension('cg_ext.c'):
    14     from cg_ext import cg_solve_c
    15     from cg_ext import cg_solve_c_precon
    16     from cg_ext import jacobi_precon_c
    17 else:
    18     msg = "C implementation of conjugate gradient (cg_ext.c) not avalaible"
    19     raise Exception(msg)
     12from cg_ext import cg_solve_c
     13from cg_ext import cg_solve_c_precon
     14from cg_ext import jacobi_precon_c
     15
    2016
    2117class Stats:
  • trunk/anuga_core/source/anuga/utilities/numerical_tools.py

    r8690 r8820  
    389389#Initialise module
    390390
    391 from anuga.utilities import compile
    392 if compile.can_use_C_extension('util_ext.c'):
    393     from util_ext import gradient, gradient2
    394 else:
    395     gradient = gradient_python
    396     gradient2 = gradient2_python   
     391from util_ext import gradient, gradient2
    397392
    398393
  • trunk/anuga_core/source/anuga/utilities/sparse.py

    r8154 r8820  
    327327
    328328# Setup for C extensions
    329 from anuga.utilities import compile
    330 if compile.can_use_C_extension('sparse_ext.c'):
    331     # Access underlying c implementations
    332     from sparse_ext import csr_mv
     329from sparse_ext import csr_mv
    333330
    334331
Note: See TracChangeset for help on using the changeset viewer.