Ignore:
Timestamp:
Feb 3, 2015, 4:27:32 PM (10 years ago)
Author:
steve
Message:

added extra unit test for setting hole_tags when using create_mesh_from_regions

Location:
trunk/anuga_core/anuga/pmesh
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/anuga_core/anuga/pmesh/mesh.py

    r9551 r9591  
    803803        factor = 2* math.pi/segment_count
    804804        for cut in range(segment_count):
    805              cuts.append(cut*factor)
     805            cuts.append(cut*factor)
    806806
    807807        polygon = []
     
    971971        self.alphaUserSegments = []
    972972
    973        #FIXME see where this is used. return an array instead
     973    #FIXME see where this is used. return an array instead
    974974    def getTriangulation(self):
    975975        #return self.meshTriangles
  • trunk/anuga_core/anuga/pmesh/tests/test_mesh_interface.py

    r9562 r9591  
    636636           
    637637    def test_create_mesh_with_breaklines(self):
    638          # These are the absolute values
     638        # These are the absolute values
    639639        polygon = [[100,100], [1000,100], [1000,1000], [100,1000]]
    640640
     
    645645                                     10000000,
    646646                                     breaklines=[[[50,50],[2000,2000]]])
    647                                                                          
     647
    648648        self.assertTrue(len(m.regions) == 1, 'FAILED!')
    649649        segs = m.getUserSegments()
     
    653653
    654654    def test_create_mesh_with_interior_holes(self):
    655          # These are the absolute values
     655        # These are the absolute values
    656656        polygon = [[100,100], [1000,100], [1000,1000], [100,1000]]
    657657       
     
    714714            msg = 'Passing a single polygon should have raised an error '
    715715            raise Exception, msg
    716 
    717                
     716       
     717       
     718    def test_create_mesh_with_interior_holes_and_tags(self):
     719        # These are the absolute values
     720        polygon = [[100,100], [1000,100], [1000,1000], [100,1000]]
     721       
     722        interior_poly1 = [[101,101],[200,200], [101,200]]
     723        interior_poly2 = [[300,300],[500,500], [400,200]]
     724
     725        boundary_tags = {'walls': [0,1], 'bom': [2,3]}
     726
     727
     728        # This should work with one hole
     729        m = create_mesh_from_regions(polygon,
     730                                     boundary_tags,
     731                                     10000000,
     732                                     interior_holes=[interior_poly1],
     733                                     hole_tags=[{'edge0' : [0], 'edge1': [1], 'edge2': [2]}])
     734
     735        self.assertTrue(len(m.getUserSegments()) == 7, 'FAILED!')
     736        self.assertTrue(len(m.userVertices) == 7, 'FAILED!')
     737
     738        m.generate_mesh()
     739       
     740        tags_list = m.getMeshSegmentTags()
     741       
     742        assert len([x for x in tags_list if x == 'edge0']) == 7
     743        assert len([x for x in tags_list if x == 'edge1']) == 6
     744        assert len([x for x in tags_list if x == 'edge2']) == 54             
     745
     746
    718747    def test_create_mesh_from_regions_with_duplicate_verts(self):
    719748        # These are the absolute values
     
    799828
    800829    def concept_ungenerateII(self):
    801         from anuga.shallow_water import Domain, Reflective_boundary, \
    802                             Dirichlet_boundary
     830        from anuga import Domain, Reflective_boundary, Dirichlet_boundary
    803831
    804832        x=0
     
    869897
    870898    def concept_ungenerateIII(self):
    871         from anuga.shallow_water import Domain, Reflective_boundary, \
     899        from anuga import Domain, Reflective_boundary, \
    872900                            Dirichlet_boundary
    873901        from anuga.pmesh.mesh_interface import create_mesh_from_regions
Note: See TracChangeset for help on using the changeset viewer.