source: inundation/pymetis/test_metis.py @ 2806

Last change on this file since 2806 was 2806, checked in by jack, 18 years ago

Update to use long as the index type. Needs verification on 32-bit
machines.

File size: 1.5 KB
Line 
1from os import sep
2from sys import path
3
4from Numeric import array
5
6import unittest
7
8path.append('..' + sep + 'pymetis')
9
10import metis
11
12class TestMetis(unittest.TestCase):
13    def setUp(self):
14        pass
15
16    def testHexmesh(self):
17        # Hexagonal mesh
18        #
19        #   1---2 
20        #  / \ / \
21        # 6---0---3
22        #  \ / \ /
23        #   5---4
24        #
25        # Divided 3 ways
26        # Calling order is: elements, verticies, edge list
27        # element type, number parts
28        edgecut, epart, npart = metis.partMeshNodal(6, 7,\
29                                                    [0, 1, 2,\
30                                                     0, 2, 3,\
31                                                     0, 3, 4,\
32                                                     0, 4, 5,\
33                                                     0, 5, 6,\
34                                                     0, 6, 1],\
35                                                    1,\
36                                                    3,)
37        #print edgecut
38        #print epart
39        #print npart
40        epart_expected = array([2, 0, 2, 0, 0, 0], 'i')
41        npart_expected = array([0, 0, 2, 0, 2, 0, 2], 'i')
42        self.assert_(edgecut == 5)
43        for i in range(len(epart)):
44            self.assert_(epart[i] == epart_expected[i])
45        for i in range(len(npart)):
46            self.assert_(npart[i] == npart_expected[i])
47
48if __name__ == '__main__':
49    unittest.main()
50
Note: See TracBrowser for help on using the repository browser.