Changeset 6146


Ignore:
Timestamp:
Jan 13, 2009, 11:58:10 AM (15 years ago)
Author:
rwilson
Message:

Change Numeric imports to general form - ready to change to NumPy?.

Location:
anuga_core/source/anuga/advection
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • anuga_core/source/anuga/advection/advection.py

    r5847 r6146  
    3232
    3333from anuga.abstract_2d_finite_volumes.domain import *
     34
     35import Numeric as num
     36
     37
    3438Generic_domain = Domain # Rename
    3539
     
    6670                                numproc=numproc)
    6771
    68         import Numeric
    6972        if velocity is None:
    70             self.velocity = Numeric.array([1,0],'d')
     73            self.velocity = num.array([1,0],'d')
    7174        else:
    72             self.velocity = Numeric.array(velocity,'d')
     75            self.velocity = num.array(velocity,'d')
    7376
    7477        #Only first is implemented for advection
     
    155158
    156159        import sys
    157         from Numeric import zeros, Float
    158160        from anuga.config import max_timestep
    159161
     
    228230
    229231        import sys
    230         from Numeric import zeros, Float
    231232        from anuga.config import max_timestep
    232233
     
    251252        stage_bdry = Stage.boundary_values
    252253
    253         flux = zeros(1, Float) #Work array for summing up fluxes
     254        flux = num.zeros(1, num.Float) #Work array for summing up fluxes
    254255
    255256        #Loop
  • anuga_core/source/anuga/advection/test_advection.py

    r5242 r6146  
    66
    77from anuga.config import g, epsilon
    8 from Numeric import allclose, array, zeros, ones, Float
    98from anuga.advection.advection import Domain, Transmissive_boundary, Dirichlet_boundary
     9
     10import Numeric as num
     11
    1012
    1113class Test_Advection(unittest.TestCase):
     
    4850
    4951        #Populate boundary array with dirichlet conditions.
    50         domain.neighbours = array([[-1,-2,-3]])
     52        domain.neighbours = num.array([[-1,-2,-3]])
    5153        domain.quantities['stage'].boundary_values[:] = 1.0
    5254
     
    102104
    103105        #Populate boundary array with dirichlet conditions.
    104         domain.neighbours = array([[-1,-2,-3]])
     106        domain.neighbours = num.array([[-1,-2,-3]])
    105107        domain.quantities['stage'].boundary_values[0] = 1.0
    106108
     
    111113        domain.compute_fluxes()
    112114        U = domain.quantities['stage'].explicit_update
    113         assert allclose(U, 0)
     115        assert num.allclose(U, 0)
    114116
    115117
     
    133135
    134136        #Populate boundary array with dirichlet conditions.
    135         domain.neighbours = array([[1,-1,-2], [0,-3,-4]])
     137        domain.neighbours = num.array([[1,-1,-2], [0,-3,-4]])
    136138        domain.set_quantity('stage', [1.0, 0.0], location='centroids')
    137139        domain.distribute_to_vertices_and_edges()
     
    157159        #Boundaries
    158160        T = Transmissive_boundary(domain)
    159         D = Dirichlet_boundary(array([3.1415]))
     161        D = Dirichlet_boundary(num.array([3.1415]))
    160162
    161163        domain.set_boundary( {'left': D, 'right': T, 'bottom': T, 'top': T} )
     
    164166        #Check that the boundary value gets propagated to all elements
    165167        for t in domain.evolve(yieldstep = 0.05, finaltime = 10):
    166             if allclose(domain.quantities['stage'].centroid_values, 3.1415):
     168            if num.allclose(domain.quantities['stage'].centroid_values, 3.1415):
    167169                break
    168170
    169         assert allclose(domain.quantities['stage'].centroid_values, 3.1415)
     171        assert num.allclose(domain.quantities['stage'].centroid_values, 3.1415)
    170172
    171173
Note: See TracChangeset for help on using the changeset viewer.