Ignore:
Timestamp:
Jun 17, 2010, 5:34:13 PM (14 years ago)
Author:
steve
Message:

Changing for loop to numpy.where

File:
1 edited

Legend:

Unmodified
Added
Removed
  • anuga_work/development/2010-projects/anuga_1d/channel/channel_domain.py

    r7852 r7855  
    202202
    203203    if domain.discontinousb:
    204         domain.quantities['width'].extrapolate_second_order()
    205        
    206 
    207     # FIXME (SGR): Replace with numpy.where to speed up code
     204        width.extrapolate_second_order()
     205       
     206
    208207    h0 = 1.0e-12
    209208
     
    217216    w_C[:] = h_C + z_C
    218217   
    219 #    for i in range(N):
    220 #
    221 #        if a_C[i] <= h0:
    222 #           a_C[i] = 0.0
    223 #           h_C[i] = 0.0
    224 #            d_C[i] = 0.0
    225 #            u_C[i] = 0.0
    226 #            w_C[i] = z_C[i]
    227 #        else:
    228 #
    229 #            if b_C[i]<=h0:
    230 #                a_C[i] = 0.0
    231 #                h_C[i] = 0.0
    232 #                d_C[i] = 0.0
    233 #                u_C[i] = 0.0
    234 #                w_C[i] = z_C[i]
    235 #
    236 #            else:
    237 #                h_C[i] = a_C[i]/(b_C[i]+h0/b_C[i])
    238 #                w_C[i] = h_C[i]+z_C[i]
    239 #                u_C[i] = d_C[i]/(a_C[i]+h0/a_C[i])
    240218               
    241219
     
    260238    b_V  = width.vertex_values
    261239
    262    
    263     #FIXME (SGR): replace with numpy.where
    264 
    265240
    266241    h_V[:] = w_V-z_V
     
    271246    d_V[:] = u_V*a_V
    272247
    273 #    for i in range(len(h_C)):
    274 #        for j in range(2):
    275 #            h_V[i,j] = w_V[i,j]-z_V[i,j]
    276 #            if h_V[i,j]<h0:
    277 #                h_V[i,j]=0
    278 #                w_V[i,j]=z_V[i,j]
    279 #            a_V[i,j] = b_V[i,j]*h_V[i,j]
    280 #            d_V[i,j]=u_V[i,j]*a_V[i,j]
    281248   
    282249    return
Note: See TracChangeset for help on using the changeset viewer.