- Timestamp:
- May 11, 2010, 3:12:21 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/fit_interpolate/test_search_functions.py
r7715 r7716 3 3 4 4 import unittest 5 from mesh_quadtree import search_tree_of_vertices, set_last_triangle 6 from mesh_quadtree import _search_triangles_of_vertices 7 from mesh_quadtree import _trilist_from_data 8 from mesh_quadtree import compute_interpolation_values, MeshQuadtree 5 from mesh_quadtree import MeshQuadtree, compute_interpolation_values 9 6 10 7 from anuga.abstract_2d_finite_volumes.neighbour_mesh import Mesh … … 51 48 52 49 root = MeshQuadtree(mesh) 53 set_last_triangle()54 55 found, s0, s1, s2, k = search_tree_of_vertices(root, mesh,[-0.2, 10.7])50 root.set_last_triangle() 51 52 found, s0, s1, s2, k = root.search_fast([-0.2, 10.7]) 56 53 assert found is False 57 54 58 found, s0, s1, s2, k = search_tree_of_vertices(root, mesh,[0, 0])55 found, s0, s1, s2, k = root.search_fast([0, 0]) 59 56 assert found is True 60 57 … … 71 68 72 69 root = MeshQuadtree(mesh) 73 set_last_triangle()70 root.set_last_triangle() 74 71 75 72 x = [0.2, 0.7] 76 found, s0, s1, s2, k = search_tree_of_vertices(root, mesh,x)73 found, s0, s1, s2, k = root.search_fast(x) 77 74 assert k == 1 # Triangle one 78 75 assert found is True … … 91 88 92 89 root = MeshQuadtree(mesh) 93 set_last_triangle()90 root.set_last_triangle() 94 91 95 92 for x in [[0.6, 0.3], [0.1, 0.2], [0.7,0.7], … … 97 94 [10, 3]]: 98 95 99 found, s0, s1, s2, k = search_tree_of_vertices(root, mesh, 100 ensure_numeric(x)) 96 found, s0, s1, s2, k = root.search_fast(ensure_numeric(x)) 101 97 102 98 if k >= 0: … … 123 119 124 120 root = MeshQuadtree(mesh) 125 set_last_triangle()121 root.set_last_triangle() 126 122 #print m, root.show() 127 123 … … 130 126 [10, 3]]: 131 127 132 found, s0, s1, s2, k = search_tree_of_vertices(root, mesh,x)128 found, s0, s1, s2, k = root.search_fast(x) 133 129 134 130 if k >= 0: … … 151 147 152 148 root = MeshQuadtree(mesh) 153 set_last_triangle()149 root.set_last_triangle() 154 150 155 151 # One point 156 152 x = ensure_numeric([0.5, 0.5]) 157 153 158 triangles = _trilist_from_data(mesh,root.search(x))154 triangles = root._trilist_from_data(root.search(x)) 159 155 160 156 found, sigma0, sigma1, sigma2, k = \ 161 _search_triangles_of_vertices(triangles, x)157 root._search_triangles_of_vertices(triangles, x) 162 158 163 159 if k >= 0: … … 175 171 [10, 3]]: 176 172 177 triangles = _trilist_from_data(mesh,root.search(x))173 triangles = root._trilist_from_data(root.search(x)) 178 174 179 175 #print x, candidate_vertices 180 176 found, sigma0, sigma1, sigma2, k = \ 181 _search_triangles_of_vertices(triangles,177 root._search_triangles_of_vertices(triangles, 182 178 ensure_numeric(x)) 183 179 if k >= 0: … … 225 221 #x = [3.5, 1.5] 226 222 x = [2.5, 1.5] 227 element_found, sigma0, sigma1, sigma2, k = \ 228 search_tree_of_vertices(root, mesh, x) 223 element_found, sigma0, sigma1, sigma2, k = root.search_fast(x) 229 224 # One point 230 225 x = [3.00005, 2.999994] 231 element_found, sigma0, sigma1, sigma2, k = \ 232 search_tree_of_vertices(root, mesh, x) 226 element_found, sigma0, sigma1, sigma2, k = root.search_fast(x) 233 227 assert element_found is True 234 228 assert k == 1
Note: See TracChangeset
for help on using the changeset viewer.