Changeset 570
- Timestamp:
- Nov 16, 2004, 5:31:53 PM (20 years ago)
- Location:
- inundation/ga/storm_surge/pyvolution
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/ga/storm_surge/pyvolution/least_squares.py
r569 r570 235 235 candidate_vertices = root.search(x[0], x[1]) 236 236 237 237 238 #Find triangle containing x: 238 239 element_found = False … … 254 255 n2 = self.mesh.get_normal(k, 2) 255 256 257 256 258 #Compute interpolation 257 259 sigma2 = dot((x-xi0), n2)/dot((xi2-xi0), n2) … … 262 264 epsilon = 1.0e-6 263 265 assert abs(sigma0 + sigma1 + sigma2 - 1.0) < epsilon 264 266 265 267 #Check that this triangle contains the data point 266 if sigma0 >= 0 and sigma1 >= 0 and sigma2 >= 0: 268 269 #Sigmas can get negative within 270 #machine precision on some machines (e.g nautilus) 271 #Hence the small eps 272 273 eps = 1.0e-15 274 if sigma0 >= -eps and sigma1 >= -eps and sigma2 >= -eps: 267 275 element_found = True 268 276 break … … 272 280 break 273 281 274 275 print x, element_found, k276 282 277 283 #Update interpolation matrix A if necessary … … 299 305 #Ok if there is no triangle for datapoint 300 306 #(as in brute force version) 301 raise 'Could not find triangle for point', x307 #raise 'Could not find triangle for point', x 302 308 303 309 -
inundation/ga/storm_surge/pyvolution/test_least_squares.py
r568 r570 682 682 #------------------------------------------------------------- 683 683 if __name__ == "__main__": 684 suite = unittest.makeSuite(TestCase,'test _more_tri')684 suite = unittest.makeSuite(TestCase,'test') 685 685 runner = unittest.TextTestRunner(verbosity=1) 686 686 runner.run(suite)
Note: See TracChangeset
for help on using the changeset viewer.