Changeset 9343 for trunk/anuga_work
- Timestamp:
- Sep 22, 2014, 11:15:38 AM (11 years ago)
- Location:
- trunk/anuga_work/development/gareth/template_scenarios/tsunami/tsunami3/scripts
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/anuga_work/development/gareth/template_scenarios/tsunami/tsunami3/scripts/user_functions.py
r9341 r9343 94 94 {boundary_line_and_tags[0][1]: range(len(bounding_polygon) - 1)} 95 95 96 # Treat the case of a 'closed' polygon with first point == last point 97 # by dropping the last point 98 if bounding_polygon[0] == bounding_polygon[-1]: 99 bounding_polygon = [bounding_polygon[k] for k in range(len(bounding_polygon)-1)] 100 96 101 for i in range(boundary_segnum - 1): 102 # Loop over all the 'other' boundary segments, and find the line which 103 # starts at the end point of bounding_polygon 97 104 98 # Find the line which starts at the end point of bounding_polygon105 found_match = False # Flag for error if no matching segments found 99 106 100 107 for j in range(boundary_segnum): 101 108 blj = boundary_line_and_tags[j][0] 102 109 if blj[0] == bounding_polygon[-1]: 110 111 found_match = True 103 112 104 113 # Append all but the first point of blj to bounding_polygon … … 112 121 113 122 if i == boundary_segnum - 2: 123 # The first and last points should match 124 if bounding_polygon[0] != bounding_polygon[-1]: 125 msg = 'The first and last points of the bounding ' + \ 126 'polygon are not identical' 127 raise ValueError(msg) 128 129 # Remove the last point 114 130 bounding_polygon = [bounding_polygon[k] for k in 115 131 range(len(bounding_polygon) - 1)] … … 127 143 else: 128 144 boundary_tags[key] = new_tags 145 # Finish the j loop 146 break 147 # Check that a 'match' was found for every 'i' iteration 148 if not found_match: 149 raise Exception, 'Did not find a match' 129 150 130 151 return (bounding_polygon, boundary_tags)
Note: See TracChangeset
for help on using the changeset viewer.