Changeset 1898 for inundation/pyvolution/test_least_squares.py
- Timestamp:
- Oct 12, 2005, 9:09:20 AM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/pyvolution/test_least_squares.py
r1891 r1898 573 573 #Point on common vertex 574 574 d6 = [0., 5.] 575 576 575 577 576 point_coords = [d0, d1, d2, d3, d4, d5, d6] 578 577 … … 593 592 [5., 7.5, 7.5, -5.], # (2.5, 2.5) 594 593 [5., 6., 9., -2.], # (4,1) 595 [5., 10., 5., -10.]] # (0,5)594 [5., 10., 5., -10.]] # (0,5) 596 595 597 596 #print "***********" … … 599 598 #print "answer",answer 600 599 #print "***********" 600 601 #Should an error message be returned if points are outside 602 # of the mesh? Not currently. 603 604 assert allclose(z, answer) 605 606 607 def test_interpolate_point_outside_of_mesh(self): 608 """Test linear interpolation of known values at vertices to 609 new points inside a triangle 610 """ 611 a = [0.0, 0.0] 612 b = [0.0, 5.0] 613 c = [5.0, 0.0] 614 d = [5.0, 5.0] 615 616 vertices = [a, b, c, d] 617 triangles = [ [1,0,2], [2,3,1] ] #bac, cdb 618 619 #Far away point 620 d7 = [-1., -1.] 621 622 point_coords = [ d7] 623 624 interp = Interpolation(vertices, triangles, point_coords) 625 626 #Known values at vertices 627 #Functions are x+y, x+2y, 2x+y, x-y-5 628 f = [ [0., 0., 0., -5.], # (0,0) 629 [5., 10., 5., -10.], # (0,5) 630 [5., 5., 10.0, 0.], # (5,0) 631 [10., 15., 15., -5.]] # (5,5) 632 633 z = interp.interpolate(f) 634 answer = [ [0., 0., 0., 0.]] # (-1,-1) 635 636 #print "***********" 637 #print "z",z 638 #print "answer",answer 639 #print "***********" 640 641 #Should an error message be returned if points are outside 642 # of the mesh? Not currently. 601 643 602 644 assert allclose(z, answer)
Note: See TracChangeset
for help on using the changeset viewer.