Ignore:
Timestamp:
Nov 6, 2008, 4:20:34 PM (15 years ago)
Author:
rwilson
Message:

NumPy? conversion.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • anuga_core/source_numpy_conversion/anuga/advection/test_advection.py

    r5242 r5908  
    66
    77from anuga.config import g, epsilon
    8 from Numeric import allclose, array, zeros, ones, Float
     8import numpy
    99from anuga.advection.advection import Domain, Transmissive_boundary, Dirichlet_boundary
    1010
     
    4848
    4949        #Populate boundary array with dirichlet conditions.
    50         domain.neighbours = array([[-1,-2,-3]])
     50        domain.neighbours = numpy.array([[-1,-2,-3]])
    5151        domain.quantities['stage'].boundary_values[:] = 1.0
    5252
     
    102102
    103103        #Populate boundary array with dirichlet conditions.
    104         domain.neighbours = array([[-1,-2,-3]])
     104        domain.neighbours = numpy.array([[-1,-2,-3]])
    105105        domain.quantities['stage'].boundary_values[0] = 1.0
    106106
     
    111111        domain.compute_fluxes()
    112112        U = domain.quantities['stage'].explicit_update
    113         assert allclose(U, 0)
     113        assert numpy.allclose(U, 0)
    114114
    115115
     
    133133
    134134        #Populate boundary array with dirichlet conditions.
    135         domain.neighbours = array([[1,-1,-2], [0,-3,-4]])
     135        domain.neighbours = numpy.array([[1,-1,-2], [0,-3,-4]])
    136136        domain.set_quantity('stage', [1.0, 0.0], location='centroids')
    137137        domain.distribute_to_vertices_and_edges()
     
    157157        #Boundaries
    158158        T = Transmissive_boundary(domain)
    159         D = Dirichlet_boundary(array([3.1415]))
     159        D = Dirichlet_boundary(numpy.array([3.1415]))
    160160
    161161        domain.set_boundary( {'left': D, 'right': T, 'bottom': T, 'top': T} )
     
    164164        #Check that the boundary value gets propagated to all elements
    165165        for t in domain.evolve(yieldstep = 0.05, finaltime = 10):
    166             if allclose(domain.quantities['stage'].centroid_values, 3.1415):
     166            if numpy.allclose(domain.quantities['stage'].centroid_values, 3.1415):
    167167                break
    168168
    169         assert allclose(domain.quantities['stage'].centroid_values, 3.1415)
     169        assert numpy.allclose(domain.quantities['stage'].centroid_values, 3.1415)
    170170
    171171
Note: See TracChangeset for help on using the changeset viewer.