from os import sep from sys import path from Numeric import array import unittest path.append('..' + sep + 'pymetis') import metis class TestMetis(unittest.TestCase): def setUp(self): pass def testHexmesh(self): # Hexagonal mesh # # 1---2 # / \ / \ # 6---0---3 # \ / \ / # 5---4 # # Divided 3 ways # Calling order is: elements, verticies, edge list # element type, number parts edgecut, epart, npart = metis.partMeshNodal(6, 7,\ [0, 1, 2,\ 0, 2, 3,\ 0, 3, 4,\ 0, 4, 5,\ 0, 5, 6,\ 0, 6, 1],\ 1,\ 3,) #print edgecut #print epart #print npart self.assert_(edgecut == 5) self.assert_(epart == array([2, 2, 0, 0, 0, 0], 'i')) self.assert_(npart == array([0, 2, 2, 2, 0, 0, 0], 'i')) if __name__ == '__main__': unittest.main()