Changeset 705 for inundation/ga/storm_surge
- Timestamp:
- Dec 14, 2004, 12:59:59 PM (20 years ago)
- Location:
- inundation/ga/storm_surge/pyvolution
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/ga/storm_surge/pyvolution/least_squares.py
r641 r705 245 245 #Find vertices near x 246 246 candidate_vertices = root.search(x[0], x[1]) 247 248 247 is_more_elements = True 249 if candidate_vertices == []: 250 # The point isn't even within the root cell! 251 is_more_elements = False 252 element_found = False 253 else: 254 element_found, sigma0, sigma1, sigma2, k = \ 255 self.search_triangles_of_vertices(candidate_vertices, x) 256 248 249 element_found, sigma0, sigma1, sigma2, k = \ 250 self.search_triangles_of_vertices(candidate_vertices, x) 257 251 while not element_found and is_more_elements: 258 candidate_vertices = root.expand_search() 259 if candidate_vertices == []: 260 # All the triangles have been searched. 252 candidate_vertices, branch = root.expand_search() 253 if branch == []: 254 # Searching all the verts from the root cell that haven't 255 # been searched. This is the last try 256 element_found, sigma0, sigma1, sigma2, k = \ 257 self.search_triangles_of_vertices(candidate_vertices, x) 261 258 is_more_elements = False 262 259 else: 263 260 element_found, sigma0, sigma1, sigma2, k = \ 264 261 self.search_triangles_of_vertices(candidate_vertices, x) 265 266 262 267 263 268 264 #Update interpolation matrix A if necessary … … 301 297 sigma0 = -10.0 302 298 sigma1 = -10.0 299 k = -10.0 303 300 304 301 #For all vertices in same cell as point x … … 317 314 #print "PDSG - xi1", xi1 318 315 #print "PDSG - xi2", xi2 319 320 # 316 #print "PDSG element %i verts((%f, %f),(%f, %f),(%f, %f))" \ 317 # % (k, xi0[0], xi0[1], xi1[0], xi1[1], xi2[0], xi2[1]) 321 318 322 319 #Get the three normals -
inundation/ga/storm_surge/pyvolution/quad.py
r611 r705 122 122 #print "cell ", cell.show() 123 123 points += cell.retrieve() 124 return points 124 return points, self.branch 125 125 126 126 -
inundation/ga/storm_surge/pyvolution/test_least_squares.py
r703 r705 83 83 0., 0. , 0., 0., 0., 0.]] 84 84 assert allclose(interp.get_A(), answer) 85 85 86 def test_quad_treeII(self): 87 p0 = [-66.0, 14.0] 88 p1 = [14.0, -66.0] 89 p2 = [14.0, 14.0] 90 p3 = [60.0, 20.0] 91 p4 = [10.0, 60.0] 92 p5 = [60.0, 60.0] 93 94 points = [p0, p1, p2, p3, p4, p5] 95 triangles = [ [0, 1, 2], 96 [3, 2, 1], 97 [0, 2, 4], 98 [0, 2, 4], 99 [4, 2, 5], 100 [5, 2, 3]] 101 102 data = [ [-26.0,-26.0] ] 103 104 interp = Interpolation(points, triangles, data, alpha = 0.0) 105 #print "PDSG - interp.get_A()", interp.get_A() 106 answer = [ [ 0.5, 0.5, 0.0, 0., 107 0., 0.]] 108 assert allclose(interp.get_A(), answer) 109 interp.set_point_coordinates([[-30, -30]]) #point outside of mesh 110 #print "PDSG -30,-30 - interp.get_A()", interp.get_A() 111 answer = [ [ 0.0, 0.0, 0.0, 0., 112 0., 0.]] 113 assert allclose(interp.get_A(), answer) 114 115 116 #point outside of quad tree root cell 117 interp.set_point_coordinates([[-70, -70]]) 118 #print "PDSG -70,-70 interp.get_A()", interp.get_A() 119 answer = [ [ 0.0, 0.0, 0.0, 0., 120 0., 0. ]] 121 assert allclose(interp.get_A(), answer) 122 86 123 87 124 def test_datapoints_at_vertices(self): … … 158 195 159 196 interp = Interpolation(points, vertices, data) 160 197 #print "interp.get_A()", interp.get_A() 161 198 assert allclose(sum(interp.get_A(), axis=1), 1.0) 162 199 … … 793 830 794 831 suite = unittest.makeSuite(TestCase,'test') 832 #suite = unittest.makeSuite(TestCase,'test_arbitrary_datapoints') 795 833 runner = unittest.TextTestRunner(verbosity=1) 796 834 runner.run(suite) -
inundation/ga/storm_surge/pyvolution/test_quad.py
r484 r705 127 127 assert type(result) in [types.ListType,types.TupleType],\ 128 128 'should be a list' 129 129 #print "result",result 130 130 self.assertEqual(result, [0,1,2,3]) 131 131 -
inundation/ga/storm_surge/pyvolution/wiki/issues.txt
r685 r705 2 2 OPEN ISSUES: 3 3 ------------ 4 Issue (least_squares): The current is-a-point-in-a-triangle algorithm 5 is slow if a point is outside of the mesh. It will check each 6 triangle 3 times to see if the point is in that triangle. 7 Importance: low 8 Suggested Action: keep a list of triangles searched./ form a polygon 9 of the mesh boundary and throw out points not in the polygon. 10 4 11 Issue (interpolate_sww): Give a warning if points are outside the mesh. 5 12 Importance: Mid
Note: See TracChangeset
for help on using the changeset viewer.