source: anuga_core/source/anuga/pyvolution/test_general_mesh.py @ 3546

Last change on this file since 3546 was 3514, checked in by duncan, 19 years ago

Hi all,
I'm doing a change in the anuga structure, moving the code to

\anuga_core\source\anuga

After you have done an svn update, the PYTHONPATH has to be changed to;
PYTHONPATH = anuga_core/source/

This is part of changes required to make installation of anuga quicker and reducing the size of our sandpits.

If any imports are broken, try fixing them. With adding anuga. to them for example. If this seems to have really broken things, email/phone me.

Cheers
Duncan

File size: 2.3 KB
Line 
1#!/usr/bin/env python
2
3#FIXME (Ole): Maxe this test independent of anything that inherits from General_mesh (namely shallow_water)
4
5
6import unittest
7from math import sqrt, pi
8
9
10from quantity import *
11from anuga.config import epsilon
12from Numeric import allclose, array, ones, Float
13
14
15class Test_General_Mesh(unittest.TestCase):
16    def setUp(self):
17        pass
18
19    def tearDown(self):
20        pass
21
22    def test_get_vertex_values(self):
23        """
24        get connectivity based on triangle lists.
25        """
26        from mesh_factory import rectangular
27        from shallow_water import Domain
28        from Numeric import zeros, Float
29
30        #Create basic mesh
31        points, vertices, boundary = rectangular(1, 3)
32        domain = Domain(points, vertices, boundary)
33
34        value = [7]
35        #indexes = [1]  #FIXME (Ole): Should this be used
36        assert  domain.get_vertices() == domain.triangles
37        assert domain.get_vertices([0,4]) == [domain.triangles[0],
38                                              domain.triangles[4]]
39    def test_areas(self):
40        from mesh_factory import rectangular
41        from shallow_water import Domain
42        from Numeric import zeros, Float
43
44        #Create basic mesh
45        points, vertices, boundary = rectangular(1, 3)
46        domain = Domain(points, vertices, boundary)
47
48        assert domain.get_area() == 1.0
49
50
51    def test_get_unique_vertex_values(self):
52        """
53        get unique_vertex based on triangle lists.
54        """
55        from mesh_factory import rectangular
56        from shallow_water import Domain
57        from Numeric import zeros, Float
58
59        #Create basic mesh
60        points, vertices, boundary = rectangular(1, 3)
61        domain = Domain(points, vertices, boundary)
62
63        assert  domain.get_unique_vertices() == [0,1,2,3,4,5,6,7]
64        unique_vertices = domain.get_unique_vertices([0,1,4])
65        unique_vertices.sort()
66        assert unique_vertices == [0,1,2,4,5,6,7]
67
68        unique_vertices = domain.get_unique_vertices([0,4])
69        unique_vertices.sort()
70        assert unique_vertices == [0,2,4,5,6,7]
71
72#-------------------------------------------------------------
73if __name__ == "__main__":
74    suite = unittest.makeSuite(Test_General_Mesh,'test')
75    runner = unittest.TextTestRunner()
76    runner.run(suite)
77
Note: See TracBrowser for help on using the repository browser.