Changeset 7714
- Timestamp:
- May 11, 2010, 11:31:16 AM (15 years ago)
- Location:
- anuga_core/source/anuga
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/fit_interpolate/search_functions.py
r7713 r7714 72 72 return True, sigma0, sigma1, sigma2, k 73 73 74 # search to bottom of tree from last found leaf75 74 branch = last_triangle[0][1] 76 75 77 76 if branch == -10: 78 77 branch = root 79 80 tri_data = branch.search(x[0], x[1]) 78 79 # test neighbouring tris 80 tri_data = branch.test_leaves(x) 81 triangles = _trilist_from_data(mesh, tri_data) 82 element_found, sigma0, sigma1, sigma2, k = \ 83 _search_triangles_of_vertices(triangles, x) 84 if element_found: 85 return True, sigma0, sigma1, sigma2, k 86 87 # search to bottom of tree from last found leaf 88 tri_data = branch.search(x) 81 89 triangles = _trilist_from_data(mesh, tri_data) 82 90 element_found, sigma0, sigma1, sigma2, k = \ … … 95 103 96 104 for sibling in siblings: 97 tri_data = sibling.search(x [0], x[1])105 tri_data = sibling.search(x) 98 106 triangles = _trilist_from_data(mesh, tri_data) 99 107 element_found, sigma0, sigma1, sigma2, k = \ … … 104 112 branch = branch.parent 105 113 if branch: 106 tri_data = branch.test_leaves(x [0], x[1])114 tri_data = branch.test_leaves(x) 107 115 triangles = _trilist_from_data(mesh, tri_data) 108 116 element_found, sigma0, sigma1, sigma2, k = \ … … 112 120 113 121 return element_found, sigma0, sigma1, sigma2, k 114 115 116 ## Get triangles in the cell that the point is in.117 #tri_data = root.search(x[0], x[1])118 #triangles = _trilist_from_data(mesh, tri_data)119 120 #element_found, sigma0, sigma1, sigma2, k = \121 #_search_triangles_of_vertices(triangles, x)122 123 #if element_found:124 #return True, sigma0, sigma1, sigma2, k125 122 126 123 -
anuga_core/source/anuga/geometry/aabb.py
r7711 r7714 68 68 return True 69 69 70 def contains(self, x , y):71 return (self.xmin <= x <= self.xmax) and (self.ymin <= y<= self.ymax)70 def contains(self, x): 71 return (self.xmin <= x[0] <= self.xmax) and (self.ymin <= x[1] <= self.ymax) 72 72 -
anuga_core/source/anuga/geometry/quad.py
r7713 r7714 135 135 136 136 137 def search(self, x , y):137 def search(self, x): 138 138 """return a list of possible intersections with geometry""" 139 140 # if self.searched == [x,y]:141 # print 'ERROR: already searched at ', [x,y]142 # self.searched = [x,y]143 139 144 intersecting_regions = self.test_leaves(x , y)140 intersecting_regions = self.test_leaves(x) 145 141 146 142 # recurse down into nodes that the point passes through 147 143 if self.children: 148 144 for child in self.children: 149 if child.extents.contains(x , y):150 intersecting_regions.extend(child.search(x , y))145 if child.extents.contains(x): 146 intersecting_regions.extend(child.search(x)) 151 147 152 148 return intersecting_regions 153 149 154 150 155 def test_leaves(self, x , y):151 def test_leaves(self, x): 156 152 intersecting_regions = [] 157 153 … … 159 155 for leaf in self.leaves: 160 156 aabb, data = leaf 161 if aabb.contains(x , y):157 if aabb.contains(x): 162 158 intersecting_regions.append((data, self)) 163 159 -
anuga_core/source/anuga/geometry/test_geometry.py
r7713 r7714 19 19 def test_AABB_contains(self): 20 20 box = AABB(1, 21, 1, 11) 21 assert box.contains( 10, 5)22 assert box.contains( 1, 1)23 assert box.contains( 20, 6)24 assert not box.contains( -1, -1)25 assert not box.contains( 5, 70)26 assert not box.contains( 6, -70)27 assert not box.contains( -1, 6)28 assert not box.contains( 50, 6)21 assert box.contains([10, 5]) 22 assert box.contains([1, 1]) 23 assert box.contains([20, 6]) 24 assert not box.contains([-1, -1]) 25 assert not box.contains([5, 70]) 26 assert not box.contains([6, -70]) 27 assert not box.contains([-1, 6]) 28 assert not box.contains([50, 6]) 29 29 30 30 def test_AABB_split_vert(self):
Note: See TracChangeset
for help on using the changeset viewer.