Changeset 5846 for anuga_core/source/pymetis
- Timestamp:
- Oct 18, 2008, 7:52:32 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/pymetis/test_metis.py
r3555 r5846 3 3 from sys import path 4 4 5 from Numeric import array 5 from Numeric import array, allclose 6 6 7 7 import unittest … … 9 9 # path.append('..' + sep + 'pymetis') 10 10 11 import metis11 import pymetis.metis as metis 12 12 13 13 class TestMetis(unittest.TestCase): … … 15 15 pass 16 16 17 def test Hexmesh(self):17 def test_Hexmesh(self): 18 18 # Hexagonal mesh 19 19 # … … 42 42 npart_expected = array([0, 2, 2, 2, 0, 0, 0], 'i') 43 43 self.assert_(edgecut == 5) 44 for i in range(len(epart)): 45 self.assert_(epart[i] == epart_expected[i]) 46 for i in range(len(npart)): 47 self.assert_(npart[i] == npart_expected[i]) 44 assert allclose(epart, epart_expected) 45 assert allclose(npart, npart_expected) 46 47 48 def test_Hexmesh2(self): 49 # Hexagonal mesh 50 # 51 # 1---2 52 # / \ / \ 53 # 6---0---3 54 # \ / \ / 55 # 5---4 56 # 57 # Divided 2 ways 58 # Calling order is: elements, verticies, edge list 59 # element type, number parts 60 edgecut, epart, npart = metis.partMeshNodal(6, 7,\ 61 [0, 2, 1,\ 62 0, 3, 2,\ 63 0, 4, 3,\ 64 0, 5, 4,\ 65 0, 6, 5,\ 66 0, 1, 6],\ 67 1,\ 68 2,) 69 #print edgecut 70 #print epart 71 #print npart 72 epart_expected = array([1, 0, 0, 0, 1, 1], 'i') 73 npart_expected = array([0, 1, 1, 0, 0, 0, 1], 'i') 74 self.assert_(edgecut == 5) 75 assert allclose(epart, epart_expected) 76 assert allclose(npart, npart_expected) 77 48 78 49 79 if __name__ == '__main__':
Note: See TracChangeset
for help on using the changeset viewer.