Ignore:
Timestamp:
Oct 22, 2010, 10:36:57 AM (13 years ago)
Author:
habili
Message:

Changed from using polygons to polylines. The inlets are now represented by triangles that intersect or contain a polyline - The enquiry gap is now computed as: gap = (self.apron + self.enquiry_gap)*self.culvert_vector

Location:
trunk/anuga_core/source/anuga/structures
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/anuga_core/source/anuga/structures/inlet.py

    r8048 r8049  
    1 from anuga.geometry.polygon import inside_polygon, is_inside_polygon, polygon_overlap, polyline_overlap
     1from anuga.geometry.polygon import inside_polygon, is_inside_polygon, polyline_overlap
    22from anuga.config import velocity_protection, g
    33import math
     
    4343
    4444        if len(self.triangle_indices) == 0:
    45             region = 'Inlet polyline=%s' % (self.polyline)
    46             msg = 'No triangles have been identified in region '
     45            msg = 'Inlet polyline=%s ' % (self.polyline)
     46            msg += 'No triangles intersecting polyline '
    4747            raise Exception, msg
    48 
     48           
    4949        self.enquiry_index = self.domain.get_triangle_containing_point(self.enquiry_pt)
    5050
     51        if self.enquiry_index in self.triangle_indices:
     52            msg = 'Enquiry point %s' % (self.enquiry_pt)
     53            msg += 'is in an inlet triangle'
     54            raise Exception, msg
    5155
    5256    def compute_area(self):
     
    9296       
    9397    def get_average_elevation(self):
    94        
    9598
    9699        return num.sum(self.get_elevations()*self.get_areas())/self.area
  • trunk/anuga_core/source/anuga/structures/structure_operator.py

    r8048 r8049  
    8383        self.driving_energy = 0.0
    8484       
    85         self.__create_exchange_polygons()
     85        self.__create_exchange_polylines()
    8686
    8787        self.inlets = []
     
    194194
    195195
    196     def __create_exchange_polygons(self):
     196    def __create_exchange_polylines(self):
    197197
    198198        """Create polylines at the end of a culvert inlet and outlet.
     
    222222
    223223        #gap = 1.5*h + self.enquiry_gap
    224         gap = 1.5*self.culvert_vector + self.enquiry_gap
     224        gap = (self.apron+ self.enquiry_gap)*self.culvert_vector
    225225
    226226        self.inlet_polylines = []
    227227        self.inlet_equiry_points = []
    228228
    229         # Build exchange polygon and enquiry point
     229        # Build exchange polyline and enquiry point
    230230        for i in [0, 1]:
    231231            i0 = (2*i-1) #i0 determines the sign of the points
     
    267267            message += '\n'
    268268
    269             message += 'polygon\n'
     269            message += 'polyline\n'
    270270            message += '%s' % inlet.polyline
    271271            message += '\n'
Note: See TracChangeset for help on using the changeset viewer.