- Timestamp:
- Jan 17, 2009, 2:36:43 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/fit_interpolate/test_interpolate.py
r6174 r6182 1845 1845 #print "answer",answer 1846 1846 assert num.allclose(z, answer) 1847 1848 1849 def test_interpolate_polyline(self): 1850 """test_interpolate_polyline(self): 1851 1852 This test is added under the assumption that the function interpolate_polyline implemented by 1853 John Jakeman works. It has been exercised somewhat by tests of sts boundary, but never before separately. 1854 """ 1855 1856 a = [-1.0, 0.0] 1857 b = [3.0, 4.0] 1858 c = [4.0, 1.0] 1859 d = [-3.0, 2.0] #3 1860 e = [-1.0, -2.0] 1861 f = [1.0, -2.0] #5 1862 1863 vertices = [a, b, c, d,e,f] 1864 triangles = [[0,1,3], [1,0,2], [0,4,5], [0,5,2]] #abd bac aef afc 1865 1866 1867 point_coords = [[-2.0, 2.0], 1868 [-1.0, 1.0], 1869 [0.0, 2.0], 1870 [1.0, 1.0], 1871 [2.0, 1.0], 1872 [0.0, 0.0], 1873 [1.0, 0.0], 1874 [0.0, -1.0], 1875 [-0.2, -0.5], 1876 [-0.9, -1.5], 1877 [0.5, -1.9], 1878 [3.0, 1.0]] 1879 1880 interp = Interpolate(vertices, triangles) 1881 1882 1883 f = num.array([58.06150614, 58.06150614, 58.06150614]) 1884 vertex_coordinates = num.array([[0., 0., ], 1885 [4.04092634, 1106.11074699], 1886 [8.08836552, 2212.16910609]]) 1887 gauge_neighbour_id = [1, 2, -1] 1888 point_coordinates = num.array([[2.21870766e+03, 1.09802864e+03], 1889 [1.62739645e+03, 2.20626983e+03], 1890 [5.20084967e+02, 2.21030386e+03], 1891 [6.06464546e+00, 1.65913993e+03], 1892 [1.61934862e+03, -5.88143836e+00], 1893 [5.11996623e+02, -1.85956061e+00], 1894 [2.02046270e+00, 5.53055373e+02]]) 1895 1896 z_ref = [0., 0., 0., 58.06150614, 0., 0., 58.06150614] 1897 1898 z = interp.interpolate_polyline(f, vertex_coordinates, gauge_neighbour_id, point_coordinates) 1899 assert num.allclose(z, z_ref) 1900 1901 # Another f 1902 f = num.array([58.06150614, 158.06150614, 258.06150614]) 1903 z_ref = [0., 0., 0., 208.06150645, 0., 0., 108.0615061] 1904 z = interp.interpolate_polyline(f, vertex_coordinates, gauge_neighbour_id, point_coordinates) 1905 assert num.allclose(z, z_ref) 1906 1847 1907 1848 1908 #-------------------------------------------------------------
Note: See TracChangeset
for help on using the changeset viewer.