Changeset 998 for inundation/ga
- Timestamp:
- Mar 4, 2005, 11:51:07 AM (20 years ago)
- Location:
- inundation/ga/storm_surge/pyvolution
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/ga/storm_surge/pyvolution/shallow_water.py
r989 r998 700 700 #Call C-extension 701 701 from shallow_water_ext import h_limiter 702 h vbar = h_limiter(domain, hc, hv)703 704 return hv bar702 h_limiter(domain, hc, hv) 703 704 return hv 705 705 706 706 -
inundation/ga/storm_surge/pyvolution/shallow_water_ext.c
r992 r998 261 261 wv[k3+i] = zv[k3+i] + (1-alpha)*hvbar[k3+i] + alpha*hv[k3+i]; 262 262 263 264 263 //Update momentum as a linear combination of 265 264 //xmomc and ymomc (shallow) and momentum … … 772 771 dimensions[0] = N; 773 772 dimensions[1] = 3; 774 hvbar = (PyArrayObject *) PyArray_FromDims(2, dimensions, PyArray_DOUBLE); 775 776 773 //hvbar = (PyArrayObject *) PyArray_FromDims(2, dimensions, PyArray_DOUBLE); 774 777 775 778 776 //Find min and max of this and neighbour's centroid values … … 787 785 for (i=0; i<3; i++) { 788 786 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]; 790 788 if (n >= 0) { 791 789 hn = ((double*) hc -> data)[n]; //Neighbour's centroid value … … 799 797 800 798 // Call underlying routine 801 _limit(N, beta_h, (double*) hc -> data, (double*) hv bar-> data, hmin, hmax);799 _limit(N, beta_h, (double*) hc -> data, (double*) hv -> data, hmin, hmax); 802 800 803 801 // // //Py_DECREF(domain); //FIXME: NEcessary? … … 806 804 807 805 //return result using PyArray to avoid memory leak 808 return PyArray_Return(hvbar); 806 //return PyArray_Return(hvbar); 807 return Py_BuildValue(""); 809 808 } 810 809 -
inundation/ga/storm_surge/pyvolution/test_util.py
r994 r998 820 820 821 821 822 def test_inside_polygon (self):822 def test_inside_polygon_main(self): 823 823 824 824 825 825 #Simplest case: Polygon is the unit square 826 826 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 ) 829 839 assert not inside_polygon( (0.5, 1.5), polygon ) 830 840 assert not inside_polygon( (0.5, -0.5), polygon ) … … 832 842 assert not inside_polygon( (1.5, 0.5), polygon ) 833 843 834 #Try point on borders 844 #Try point on borders 835 845 assert inside_polygon( (1., 0.5), polygon, closed=True) 836 846 assert inside_polygon( (0.5, 1), polygon, closed=True) … … 943 953 #------------------------------------------------------------- 944 954 if __name__ == "__main__": 945 suite = unittest.makeSuite(TestCase,'test ')955 suite = unittest.makeSuite(TestCase,'test_inside_polygon_main') 946 956 runner = unittest.TextTestRunner() 947 957 runner.run(suite)
Note: See TracChangeset
for help on using the changeset viewer.