Changeset 998 for inundation/ga


Ignore:
Timestamp:
Mar 4, 2005, 11:51:07 AM (20 years ago)
Author:
ole
Message:

Playing with h_limiter

Location:
inundation/ga/storm_surge/pyvolution
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • inundation/ga/storm_surge/pyvolution/shallow_water.py

    r989 r998  
    700700    #Call C-extension
    701701    from shallow_water_ext import h_limiter
    702     hvbar = h_limiter(domain, hc, hv)
    703 
    704     return hvbar
     702    h_limiter(domain, hc, hv)
     703
     704    return hv
    705705
    706706                                           
  • inundation/ga/storm_surge/pyvolution/shallow_water_ext.c

    r992 r998  
    261261        wv[k3+i] = zv[k3+i] + (1-alpha)*hvbar[k3+i] + alpha*hv[k3+i];
    262262           
    263      
    264263        //Update momentum as a linear combination of
    265264        //xmomc and ymomc (shallow) and momentum
     
    772771  dimensions[0] = N;
    773772  dimensions[1] = 3; 
    774   hvbar = (PyArrayObject *) PyArray_FromDims(2, dimensions, PyArray_DOUBLE);
    775 
    776  
     773  //hvbar = (PyArrayObject *) PyArray_FromDims(2, dimensions, PyArray_DOUBLE);
     774 
    777775
    778776  //Find min and max of this and neighbour's centroid values
     
    787785    for (i=0; i<3; i++) {
    788786      n = ((long*) neighbours -> data)[k3+i];
    789       ((double*) hvbar -> data)[k3+i] = ((double*) hc -> data)[k]; 
     787      //((double*) hvbar -> data)[k3+i] = ((double*) hc -> data)[k]; 
    790788      if (n >= 0) {
    791789        hn = ((double*) hc -> data)[n]; //Neighbour's centroid value
     
    799797 
    800798  // Call underlying routine
    801   _limit(N, beta_h, (double*) hc -> data, (double*) hvbar -> data, hmin, hmax);
     799  _limit(N, beta_h, (double*) hc -> data, (double*) hv -> data, hmin, hmax);
    802800         
    803801  // // //Py_DECREF(domain); //FIXME: NEcessary?         
     
    806804 
    807805  //return result using PyArray to avoid memory leak 
    808   return PyArray_Return(hvbar);
     806  //return PyArray_Return(hvbar);
     807  return Py_BuildValue("");   
    809808}
    810809
  • inundation/ga/storm_surge/pyvolution/test_util.py

    r994 r998  
    820820       
    821821       
    822     def test_inside_polygon(self):
     822    def test_inside_polygon_main(self):
    823823
    824824       
    825825        #Simplest case: Polygon is the unit square
    826826        polygon = [[0,0], [1,0], [1,1], [0,1]]
    827  
    828         assert inside_polygon( (0.5, 0.5), polygon )                 
     827
     828
     829        R = inside_polygon( (0.5, 0.5), polygon)
     830        print 'Inside = ', R
     831        print
     832       
     833        R = inside_polygon( (0.5, 0.5), polygon)
     834        print 'Inside = ', R
     835        print
     836
     837        import sys; sys.exit()
     838        assert inside_polygon( (0.5, 0.5), polygon )
    829839        assert not inside_polygon( (0.5, 1.5), polygon )   
    830840        assert not inside_polygon( (0.5, -0.5), polygon )       
     
    832842        assert not inside_polygon( (1.5, 0.5), polygon )       
    833843       
    834         #Try point on borders   
     844        #Try point on borders
    835845        assert inside_polygon( (1., 0.5), polygon, closed=True)
    836846        assert inside_polygon( (0.5, 1), polygon, closed=True) 
     
    943953#-------------------------------------------------------------
    944954if __name__ == "__main__":
    945     suite = unittest.makeSuite(TestCase,'test')
     955    suite = unittest.makeSuite(TestCase,'test_inside_polygon_main')
    946956    runner = unittest.TextTestRunner()
    947957    runner.run(suite)
Note: See TracChangeset for help on using the changeset viewer.