Ignore:
Timestamp:
Sep 28, 2007, 3:35:18 PM (17 years ago)
Author:
duncan
Message:

adding tests and comments

File:
1 edited

Legend:

Unmodified
Added
Removed
  • anuga_core/source/anuga/utilities/test_quad.py

    r4666 r4741  
    150150        #This was causing round off error
    151151        Q = build_quadtree(mesh)
    152 
     152       
     153    def test_interpolate_one_point_many_triangles(self):
     154        # this test has 10 triangles that share the same vert.
     155        # If the number of points per cell in  a quad tree is less
     156        # than 10 it should crash
     157        z0 = [2.0, 5.0]
     158        z1 = [2.0, 5.0]
     159        z2 = [2.0, 5.0]
     160        z3 = [2.0, 5.0]
     161        z4 = [2.0, 5.0]
     162        z5 = [2.0, 5.0]
     163        z6 = [2.0, 5.0]
     164        z7 = [2.0, 5.0]
     165        z8 = [2.0, 5.0]
     166        z9 = [2.0, 5.0]
     167        z10 = [2.0, 5.0]
     168       
     169        v0 = [0.0, 0.0]
     170        v1 = [1.0, 0.0]
     171        v2 = [2.0, 0.0]
     172        v3 = [3.0, 0.0]
     173        v4 = [4.0, 0.0]
     174        v5 = [0.0, 10.0]
     175        v6 = [1.0, 10.0]
     176        v7 = [2.0, 10.0]
     177        v8 = [3.0, 10.0]
     178        v9 = [4.0, 10.0]
     179
     180        vertices = [z0,v0, v1, v2, v3,v4 ,v5, v6, v7, v8, v9,
     181                    z1, z2, z3, z4, z5, z6, z7, z8, z9]
     182        triangles = [
     183                      [11,1,2],
     184                      [12,2,3],
     185                      [13,3,4],
     186                      [14,4,5],
     187                      [7,6,15],
     188                      [8,7,16],
     189                      [9,8,17],
     190                      [10,9,18],
     191                      [6,1,19],
     192                      [5,10,0]
     193                      ]
     194       
     195        mesh = Mesh(vertices, triangles)
     196        try:
     197            Q = build_quadtree(mesh, max_points_per_cell = 9)
     198        except RuntimeError:
     199            pass
     200        else:
     201            self.failUnless(0 ==1,  'many verts at the same position no  \
     202            longer causes as error')
     203   
    153204    def test_retrieve_triangles(self):
    154205
     
    212263
    213264    mysuite = unittest.makeSuite(Test_Quad,'test')
    214     # mysuite = unittest.makeSuite(Test_Quad,'test_retrieve_triangles')
     265    #mysuite = unittest.makeSuite(Test_Quad,'test_interpolate_one_point_many_triangles')
    215266    runner = unittest.TextTestRunner()
    216267    runner.run(mysuite)
Note: See TracChangeset for help on using the changeset viewer.