Changeset 847


Ignore:
Timestamp:
Feb 8, 2005, 1:34:42 PM (20 years ago)
Author:
duncan
Message:

triangmoduleharness - reformating/new tests

File:
1 edited

Legend:

Unmodified
Added
Removed
  • inundation/ga/storm_surge/pmesh/triangmoduleHarness.py

    r651 r847  
    3232        trilist = []
    3333        mode = "Qzcn"
    34         data = triang.genMesh(points,seglist,holelist,regionlist,pointattlist,segattlist,trilist, mode)
     34        data = triang.genMesh(points,seglist,holelist,regionlist,
     35                              pointattlist,segattlist,trilist, mode)
    3536        self.failUnless(data['generatedtrianglelist'] ==[(1, 0, 2), (2, 3, 1)],
    3637                        'generatedtrianglelist is wrong!')
    3738        #print "data['generatedsegmentlist']",data['generatedsegmentlist']
    38         self.failUnless(data['generatedsegmentlist'] ==[(2, 0), (3, 2), (1, 3), (0, 1)]
     39        self.failUnless(data['generatedsegmentlist'] ==[(2, 0), (3, 2), (1, 3),
     40                                                        (0, 1)]
    3941              ,          'generatedsegmentlist is wrong!')
    40         self.failUnless(data['generatedpointlist'] ==[(0.0, 0.0), (0.0, 10.0), (3.0, 0.0), (3.0, 10.0)],
    41                         ' is wrong!')
    42        
    43         #print "data['generatedtriangleneighborlist']",data['generatedtriangleneighborlist']
    44         self.failUnless(data['generatedtriangleneighborlist'] ==[(-1, 1, -1), (-1, 0, -1)],
     42        self.failUnless(data['generatedpointlist'] ==[(0.0, 0.0), (0.0, 10.0),
     43                                                      (3.0, 0.0), (3.0, 10.0)],
     44                        ' is wrong!')
     45       
     46        #print "data['generatedtriangleneighborlist']",
     47        #data['generatedtriangleneighborlist']
     48        self.failUnless(data['generatedtriangleneighborlist'] ==[(-1, 1, -1),
     49                                                                 (-1, 0, -1)],
    4550                        'generatedtriangleneighborlist is wrong!')
    4651
     
    6065        trilist = []
    6166        mode = "Qzp"
    62         data = triang.genMesh(points,seglist,holelist,regionlist,pointattlist,segattlist,trilist, mode)
     67        data = triang.genMesh(points,seglist,holelist,regionlist,
     68                              pointattlist,segattlist,trilist, mode)
    6369       
    6470        self.failUnless(data['generatedtrianglelist'] ==[(1, 0, 2), (2, 3, 1)],
    6571                        'trianglelist is wrong!')
    66         self.failUnless(data['generatedsegmentlist'] ==[(0, 1), (1, 3), (3, 2), (2, 0)],
     72        self.failUnless(data['generatedsegmentlist'] ==[(0, 1), (1, 3),
     73                                                        (3, 2), (2, 0)],
    6774                        'segmentlist is wrong!')
    68         self.failUnless(data['generatedpointlist'] ==[(0.0, 0.0), (0.0, 10.0), (3.0, 0.0), (3.0, 10.0)],
    69                         ' is wrong!')
    70        
     75        self.failUnless(data['generatedpointlist'] ==[(0.0, 0.0), (0.0, 10.0),
     76                                                      (3.0, 0.0), (3.0, 10.0)],
     77                        ' is wrong!')
     78   
     79    def testsegmarker(self):
     80
     81        points = []
     82        seglist = []
     83        holelist = []
     84        regionlist = []
     85
     86        points = [(0.0,0.0),(0.0,10.0),(3.0,0.0),(3.0,10.0)]
     87        pointattlist = [[],[],[],[]]
     88        regionlist.append( (1.2,1.2,5.0) )
     89        seglist = [(0,1),(1,3),(3,2),(2,0)]
     90        segattlist = [1.0,2.0,3.0,4.0]
     91        trilist = []
     92        mode = "Qzp"
     93        data = triang.genMesh(points,seglist,holelist,regionlist,
     94                              pointattlist,segattlist,trilist, mode)
     95       
     96        self.failUnless(data['generatedtrianglelist'] ==[(1, 0, 2), (2, 3, 1)],
     97                        'trianglelist is wrong!')
     98        self.failUnless(data['generatedsegmentlist'] ==[(0, 1), (1, 3),
     99                                                        (3, 2), (2, 0)],
     100                        'segmentlist is wrong!')
     101        self.failUnless(data['generatedpointlist'] ==[(0.0, 0.0), (0.0, 10.0),
     102                                                      (3.0, 0.0), (3.0, 10.0)],
     103                        ' is wrong!')
     104        self.failUnless(data['generatedsegmentmarkerlist'] ==[1,2,3,4],
     105                        ' is wrong!')
     106             
    71107    def testbad_region(self):
    72108
     
    83119        mode = "Qzpn"
    84120        try:
    85             data = triang.genMesh(points,seglist,holelist,regionlist,pointattlist,segattlist, trilist, mode)
     121            data = triang.genMesh(points,seglist,holelist,
     122                                  regionlist,pointattlist,segattlist,
     123                                  trilist, mode)
    86124           
    87125        except TypeError:
     
    104142        trilist = []
    105143        mode = "Qzpna36a"
    106         data = triang.genMesh(points,seglist,holelist,regionlist,pointattlist,segattlist, trilist, mode)
     144        data = triang.genMesh(points,seglist,holelist,regionlist,
     145                              pointattlist,segattlist, trilist, mode)
    107146        self.failUnless(len(data['generatedtrianglelist']) == 2,
    108147                        'testregion_with_maxarea 1: # of tris is wrong!')
     
    110149        regionlist = [(3,1,1.0),(1,3,1.0,8.0)]
    111150        mode = "Qzpna36a"
    112         data = triang.genMesh(points,seglist,holelist,regionlist,pointattlist,segattlist, trilist, mode)
     151        data = triang.genMesh(points,seglist,holelist,regionlist,
     152                              pointattlist,segattlist, trilist, mode)
    113153        self.failUnless(len(data['generatedtrianglelist']) == 6,
    114154                        'testregion_with_maxarea 2: # of tris is wrong!')
     
    116156        regionlist = [(3,1,1.0,8.0),(1,3,1.0,8.0)]
    117157        mode = "Qzpna36a"
    118         data = triang.genMesh(points,seglist,holelist,regionlist,pointattlist,segattlist, trilist, mode)
     158        data = triang.genMesh(points,seglist,holelist,regionlist,
     159                              pointattlist,segattlist, trilist, mode)
    119160        self.failUnless(len(data['generatedtrianglelist']) == 8,
    120161                        'testregion_with_maxarea 3: # of tris is wrong!')
     
    123164        regionlist = [(3,1,1.0),(1,3,1.0,8.0)]
    124165        mode = "Qzpna8a"
    125         data = triang.genMesh(points,seglist,holelist,regionlist,pointattlist,segattlist, trilist, mode)
     166        data = triang.genMesh(points,seglist,holelist,regionlist,
     167                              pointattlist,segattlist, trilist, mode)
    126168        self.failUnless(len(data['generatedtrianglelist']) == 8,
    127169                        'testregion_with_maxarea 4: # of tris is wrong!')
     
    140182        mode = "Qzpn"
    141183        try:
    142             data = triang.genMesh(points,seglist,holelist,regionlist,pointattlist,segattlist, trilist, mode)
     184            data = triang.genMesh(points,seglist,holelist,regionlist,
     185                                  pointattlist,segattlist, trilist, mode)
    143186           
    144187        except TypeError:
     
    160203        mode = "Qzpn"
    161204        try:
    162             data = triang.genMesh(points,seglist,holelist,regionlist,pointattlist,segattlist, trilist, mode)
     205            data = triang.genMesh(points,seglist,holelist,regionlist,
     206                                  pointattlist,segattlist, trilist, mode)
    163207           
    164208        except TypeError:
     
    180224        mode = "Qzpn"
    181225        try:
    182             data = triang.genMesh(points,seglist,holelist,regionlist,pointattlist,segattlist, trilist, mode)
     226            data = triang.genMesh(points,seglist,holelist,regionlist,
     227                                  pointattlist,segattlist, trilist, mode)
    183228           
    184229        except TypeError:
     
    200245        mode = "Qzpn"
    201246        try:
    202             data = triang.genMesh(points,seglist,holelist,regionlist,pointattlist,segattlist, trilist, mode)
     247            data = triang.genMesh(points,seglist,holelist,regionlist,
     248                                  pointattlist,segattlist, trilist, mode)
    203249           
    204250            self.failUnless(data['trianglelist'] ==[(1, 0, 2), (2, 3, 1)],
     
    227273        trilist = []
    228274        mode = "QAzpq"
    229         data = triang.genMesh(points,seglist,holelist,regionlist,pointattlist,segattlist, trilist, mode)
     275        data = triang.genMesh(points,seglist,holelist,regionlist,
     276                              pointattlist,segattlist, trilist, mode)
    230277           
    231278        self.failUnless(data['generatedtriangleattributelist'] ==[[77.0], [77.0], [77.0], [77.0]],
Note: See TracChangeset for help on using the changeset viewer.