Changeset 5239


Ignore:
Timestamp:
Apr 24, 2008, 12:01:15 PM (16 years ago)
Author:
herve
Message:

following Rajaraman advices to make the code more efficient

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

Legend:

Unmodified
Added
Removed
  • anuga_core/source/anuga/shallow_water/test_tsunami_okada.py

    r5206 r5239  
    11import unittest
    22from Numeric import allclose
    3 from tsunami_okada import earthquake_tsunami,Okada_func
     3from tsunami_okada_V2 import earthquake_tsunami,Okada_func
    44
    55class Test_eq(unittest.TestCase):
     
    113113       
    114114        #create variable with elevation data to implement in okada
    115         zrec = Quantity(domain)
    116         zrec.set_values(topography)
    117        
     115        zrec0 = Quantity(domain)
     116        zrec0.set_values(topography)
     117        zrec=zrec0.get_vertex_values(xy=True)
     118        print zrec
    118119        # call okada
    119120        Ts= Okada_func(ns=ns, NSMAX=NSMAX,length=length, width=width, dip=dip, \
     
    241242        domain.set_name('test')
    242243        domain.set_quantity('elevation',topography)
    243         zrec = Quantity(domain)
    244         zrec.set_values(topography)
    245        
     244        zrec0 = Quantity(domain)
     245        zrec0.set_values(topography)
     246        zrec=zrec0.get_vertex_values(xy=True)
    246247        Ts = earthquake_tsunami(ns=ns,NSMAX=NSMAX,length=length, width=width, strike=strike,\
    247248                                depth=depth,dip=dip, xi=x0, yi=y0, slip=slip, rake=rake,\
  • anuga_core/source/anuga/shallow_water/tsunami_okada.py

    r5233 r5239  
    139139        dislocation = self.slip
    140140        ns=self.ns
    141         zreci=self.zrec
     141        zrec=self.zrec
    142142        #initialization
    143143        disp0=zeros(3,Float)
     
    199199        #Z=-zrec
    200200        eps = 1.0e-6
     201   
    201202#
    202203        for irec in range(0,N):
    203204            xrec=y
    204205            yrec=x
    205             zrec=zreci.get_values(interpolation_points=[[xrec[irec],yrec[irec]]],location='edges')
    206             Z=zrec[0]
     206            for i in range(0,len(zrec[0])):
     207                if zrec[0][i]==yrec and zrec[1][i]==xrec:
     208                    Z=zrec[2][i]
     209                    break
     210                else: continue
     211            #zrec=zreci.get_values(interpolation_points=[[xrec[irec],yrec[irec]]],location='edges')
     212           
    207213            for ist in range(0,ns):
    208214                #st = radians(strikes[ist])
Note: See TracChangeset for help on using the changeset viewer.