Changeset 6538


Ignore:
Timestamp:
Mar 18, 2009, 8:50:58 AM (16 years ago)
Author:
ole
Message:

Committed test that clearly reveals bug described in ticket:314 irrespective of whether mesh is being reused or not. Work to fix this is under way.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • anuga_core/source/anuga/fit_interpolate/test_search_functions.py

    r6536 r6538  
    55from search_functions import search_tree_of_vertices, set_last_triangle
    66from search_functions import _search_triangles_of_vertices
     7from search_functions import find_triangle_compute_interpolation
    78
    89from anuga.abstract_2d_finite_volumes.neighbour_mesh import Mesh
     
    1011from anuga.utilities.polygon import is_inside_polygon
    1112from anuga.utilities.quad import build_quadtree, Cell
    12 
     13from anuga.utilities.polygon import is_inside_polygon, is_inside_triangle   
     14
     15import Numeric as num
    1316
    1417class Test_search_functions(unittest.TestCase):
     
    207210        assert k == 1
    208211       
     212       
     213    def test_triangle_compute_interpolation(self):
     214        """test_triangle_compute_interpolation
     215       
     216        Test that triangle can be found if point is inside it
     217        """
     218       
     219        triangle = num.array([[306951.77151059, 6194462.14596986],
     220                              [306952.58403545, 6194459.65001246],
     221                              [306953.55109034, 6194462.0041216]])
     222
     223
     224        n0 = [0.92499377, -0.37998227]
     225        n1 = [0.07945684,  0.99683831]
     226        n2 = [-0.95088404, -0.30954732]
     227       
     228        x = [306953.344, 6194461.5]
     229       
     230        # Test that point is indeed inside triangle
     231        assert is_inside_polygon(x, triangle,
     232                                 closed=True, verbose=False)
     233        assert is_inside_triangle(x, triangle,
     234                                  closed=True, verbose=False)                                 
     235       
     236        element_found, sigma0, sigma1, sigma2 = \
     237            find_triangle_compute_interpolation(triangle, n0, n1, n2, x)
     238           
     239        msg = 'Point which is clearly inside triangle was not found'
     240        assert element_found is True, msg
    209241
    210242#-------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.