Ignore:
Timestamp:
Dec 1, 2004, 4:36:33 PM (20 years ago)
Author:
ole
Message:

Refactoring boundary structure to allow None Boundary object for internal boundaries.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • inundation/ga/storm_surge/pyvolution/domain.py

    r590 r648  
    180180        More entries may point to the same boundary object
    181181       
    182         Schematically the mapping is:
    183 
    184         self.boundary_segments: k: (vol_id, edge_id)
     182        Schematically the mapping is from two dictionaries to one list
     183        where the index is used as pointer to the boundary_values arrays
     184        within each quantity.
     185
    185186        self.boundary:          (vol_id, edge_id): tag
    186187        boundary_map (input):   tag: boundary_object
    187188        ----------------------------------------------
    188         self.boundary_objects:  k: boundary_object
     189        self.boundary_objects:  ((vol_id, edge_id), boundary_object)
    189190       
    190191
    191192        Pre-condition:
    192           self.boundary and self.boundary_segments have been built.
     193          self.boundary has been built.
    193194
    194195        Post-condition:
     
    199200        However, if a tag is not used to the domain, no error is thrown.
    200201        FIXME: This would lead to implementation of a
    201         default boundary condition
     202        default boundary condition       
     203
     204        Note: If a segment is listed in the boundary dictionary and if it is
     205        not None, it *will* become a boundary -
     206        even if there is a neighbouring triangle.
     207        This would be the case for internal boundaries
     208       
     209        Boundary objects that are None will be skipped.
     210
     211        FIXME: If set_boundary is called multiple times and if Boundary
     212        object is changed into None, the neighbour structure will not be
     213        restored!!!
     214       
     215
    202216        """
    203217
    204218        self.boundary_objects = []
    205         for k, (vol_id, edge_id) in enumerate(self.boundary_segments):
     219
     220        #FIXME: Try to remove the sorting and fix test_mesh.py
     221        x = self.boundary.keys()
     222        x.sort()
     223        for k, (vol_id, edge_id) in enumerate(x):
    206224            tag = self.boundary[ (vol_id, edge_id) ]
    207225
    208226            if boundary_map.has_key(tag):
    209227                B = boundary_map[tag]
    210                 self.boundary_objects.append(B)               
     228
     229                if B is not None:
     230                    self.boundary_objects.append( ((vol_id, edge_id), B) )
     231                    self.neighbours[vol_id, edge_id] = -len(self.boundary_objects)
     232                else:
     233                    pass
     234                    #FIXME: Check and perhaps fix neighbour structure
     235                   
    211236
    212237            else:
     
    379404
    380405        #FIXME: Update only those that change (if that can be worked out)
    381         for i, B in enumerate(self.boundary_objects):
    382             vol_id, edge_id = self.boundary_segments[i]
     406        for i, ((vol_id, edge_id), B) in enumerate(self.boundary_objects):
    383407            q = B.evaluate(vol_id, edge_id)
    384408
Note: See TracChangeset for help on using the changeset viewer.