Ignore:
Timestamp:
Feb 8, 2005, 7:07:56 PM (20 years ago)
Author:
ole
Message:

First cut at a spatio-temporal boundary.
Need to improve the test, though.

File:
1 edited

Legend:

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

    r850 r851  
    187187        #any tagged boundary later on.
    188188       
    189         midpoint_coordinates = zeros( (len(domain.boundary), 2), Float)
     189        self.midpoint_coordinates = zeros( (len(domain.boundary), 2), Float)
    190190        boundary_keys = domain.boundary.keys()
     191       
     192        #Record ordering #FIXME: should this happen in domain.py
     193        self.boundary_indices = {}
     194       
    191195        for i, (vol_id, edge_id) in enumerate(boundary_keys):
    192196           
     
    199203            if edge_id == 1: m = array([(x0 + x2)/2, (y0 + y2)/2])
    200204            if edge_id == 2: m = array([(x1 + x0)/2, (y1 + y0)/2])           
    201             midpoint_coordinates[i,:] = m
    202        
    203         self.midpoint_coordinates = midpoint_coordinates   
     205            self.midpoint_coordinates[i,:] = m
     206           
     207            self.boundary_indices[(vol_id, edge_id)] = i
     208       
    204209       
    205         self.F = file_function(filename, domain, interpolation_points=midpoint_coordinates)
     210        self.F = file_function(filename, domain,
     211                               interpolation_points=self.midpoint_coordinates)
    206212        self.domain = domain
    207213
    208214        #Test
    209         q = self.F(0, 0, 0)
     215        q = self.F(0, point_id=0)
    210216
    211217        d = len(domain.conserved_quantities)
    212         msg = 'Values specified in file %s must be a list or an array of length %d' %(filename, d)
     218        msg = 'Values specified in file %s must be ' %filename
     219        msg += ' a list or an array of length %d' %d
    213220        assert len(q) == d, msg
    214221
     
    226233
    227234        if vol_id is not None and edge_id is not None:
    228             x, y = self.midpoint_coordinates[ vol_id, edge_id ]
    229             return self.F(t, x, y)
     235            i = self.boundary_indices[ vol_id, edge_id ]
     236            return self.F(t, point_id = i)
    230237        else:
    231             return self.F(t)
     238            return self.F(t) #What should the semantics be?
    232239
    233240
Note: See TracChangeset for help on using the changeset viewer.