source: anuga_core/source/anuga/mesh_engine/test_triangmoduleII.py @ 3514

Last change on this file since 3514 was 3514, checked in by duncan, 18 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.8 KB
Line 
1#!/usr/bin/env python
2#
3
4import sys
5
6import unittest
7import anuga.mesh_engine.triang as triang
8
9"""
10Note, this test is seperated from the other tests because if it is added
11the triangle code seg faults.  Don't know why
12"""
13class triangTestCase(unittest.TestCase):
14
15    def setUp(self):
16        pass
17
18    def tearDown(self):
19        pass
20
21    def BAD_test_lone_vertsII(self):
22
23        points = []
24        seglist = []
25        holelist = []
26        regionlist = []
27
28        points = [(0.0,0.0),(0.0,0.0),(0.0,10.0),(0.0,10.0),(10.0,10.0),
29                  (10.0,10.0),(0.0,10.0),(10.0,0.0)]
30
31        pointattlist = []
32        for point in points:
33            pointattlist.append([])
34        seglist = [(0,1),(1,2),(2,3),(3,4),(4,5),(5,7),(7,0)]
35        segattlist = []
36        for seg in seglist:
37            segattlist.append(0)
38        trilist = []
39        mode = "QpznAa2000.1a"
40        data = triang.genMesh(points,seglist,holelist,regionlist,
41                              pointattlist,segattlist,trilist, mode)
42        #print "data['generatedtrianglelist']", data['generatedtrianglelist']
43        self.failUnless(data['generatedtrianglelist'] ==[(6, 1, 7), (7, 5, 6)],
44                        'trianglelist is wrong!')
45        self.failUnless(data['generatedsegmentlist'] ==[(1, 6), (6, 5),
46                                                        (5, 7), (7, 1)],
47                        'segmentlist is wrong!')
48        self.failUnless(data['generatedpointlist'] ==[(0.0,0.0),(0.0,0.0),
49                                                      (0.0,10.0),(0.0,10.0),
50                                                      (10.0,10.0),
51                                                      (10.0,10.0),(0.0,10.0),
52                                                      (10.0,0.0)],
53                        ' is wrong!')
54        self.failUnless(data['lonepointlist'] ==[0,2,3,4],
55                        'lonepointlist is wrong!')
56
57    def test_lone_vertsIII(self):
58
59        points = []
60        seglist = []
61        holelist = []
62        regionlist = []
63
64        points = [(0.0,0.0),(0.0,0.0),(0.0,10.0),(0.0,10.0),(10.0,10.0),
65                  (10.0,10.0),(0.0,10.0),(10.0,0.0)]
66
67        pointattlist = []
68        for point in points:
69            pointattlist.append([])
70        seglist = []
71        segattlist = []
72        for seg in seglist:
73            segattlist.append(0)
74        trilist = []
75        mode = "Qzp"
76        data = triang.genMesh(points,seglist,holelist,regionlist,
77                              pointattlist,segattlist,trilist, mode)
78
79        self.failUnless(data['lonepointlist'] ==[0,1,2,3,4,5,6,7],
80                        'lonepointlist is wrong!')
81if __name__ == "__main__":
82
83    suite = unittest.makeSuite(triangTestCase,'test')
84    runner = unittest.TextTestRunner()
85    runner.run(suite)
Note: See TracBrowser for help on using the repository browser.