Changeset 3056 for inundation/pmesh
- Timestamp:
- Jun 2, 2006, 3:10:48 PM (19 years ago)
- Location:
- inundation/pmesh
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/pmesh/mesh_interface.py
r3051 r3056 17 17 from mesh import Mesh 18 18 19 import exceptions 20 class PolygonError(exceptions.Exception): pass 19 21 20 22 def create_mesh_from_regions(bounding_polygon, … … 44 46 45 47 poly_geo_reference is the geo_reference of the polygons. 48 The bounding polygon and the interior polygons 46 49 If none, assume absolute. Please pass one though, since absolute 47 50 references have a zone. … … 61 64 # To do make maximum_triangle_area optional? 62 65 # check the segment indexes - throw an error if they are out of bounds 63 # 66 #(DSG) Yes! 67 64 68 #In addition I reckon the polygons could be of class Geospatial_data 65 69 #(DSG) Yes! 66 70 67 71 # First check that interior polygons are fully contained in bounding polygon 68 69 # FIXME (Ole): This causes the tests to fail because coordinates have been 70 # converted to relative coordinates (I think). How can we simplify this? 71 # 72 #FIXME (DSG-DSG) this code does not take into account geo-referencing 73 #if interior_regions is not None: 72 #Note, Both poly's have the same geo_ref, therefore don't take into account 73 # geo_ref 74 if interior_regions is not None: 74 75 75 #for interior_polygon, res in interior_regions:76 #indices = inside_polygon(interior_polygon, bounding_polygon,77 #closed = True, verbose = False)76 for interior_polygon, res in interior_regions: 77 indices = inside_polygon(interior_polygon, bounding_polygon, 78 closed = True, verbose = False) 78 79 79 #if len(indices) <> len(interior_polygon):80 #msg = 'Interior polygon %s is outside bounding polygon: %s'\81 #%(str(interior_polygon), str(bounding_polygon))82 # raisemsg80 if len(indices) <> len(interior_polygon): 81 msg = 'Interior polygon %s is outside bounding polygon: %s'\ 82 %(str(interior_polygon), str(bounding_polygon)) 83 raise PolygonError, msg 83 84 84 85 -
inundation/pmesh/test_mesh_interface.py
r3052 r3056 113 113 114 114 # These are the absolute values 115 min_x = 10116 min_y = 88115 min_x = -10 116 min_y = -88 117 117 polygon_absolute = [[min_x,min_y],[1000,100],[1000,1000],[100,1000]] 118 118 … … 170 170 171 171 # These are the absolute values 172 min_x = 10173 min_y = 88172 min_x = -10 173 min_y = -88 174 174 polygon = [[min_x,min_y],[1000,100],[1000,1000],[100,1000]] 175 175 … … 221 221 'FAILED!') 222 222 223 def NOT_IMPLEMEMTED_test_create_mesh_from_regions_interior_regions(self):223 def test_create_mesh_from_regions_interior_regions(self): 224 224 ### Test that create_mesh_from_regions fails when an interior region is 225 225 ### outside bounding polygon. … … 301 301 suite = unittest.makeSuite(TestCase,'test') 302 302 #suite = unittest.makeSuite(meshTestCase,'test_asciiFile') 303 runner = unittest.TextTestRunner( verbosity=2) #verbosity=2)303 runner = unittest.TextTestRunner() #verbosity=2) 304 304 runner.run(suite) 305 305
Note: See TracChangeset
for help on using the changeset viewer.