Changeset 7498


Ignore:
Timestamp:
Sep 8, 2009, 12:49:14 PM (14 years ago)
Author:
ole
Message:

Refactored file boundary to make use of new midpoint data structure.

Location:
anuga_core/source/anuga/abstract_2d_finite_volumes
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • anuga_core/source/anuga/abstract_2d_finite_volumes/domain.py

    r7492 r7498  
    306306    def get_vertex_coordinates(self, *args, **kwargs):
    307307        return self.mesh.get_vertex_coordinates(*args, **kwargs)
     308       
     309    def get_vertex_coordinate(self, *args, **kwargs):
     310        return self.mesh.get_vertex_coordinate(*args, **kwargs)       
     311       
     312    def get_edge_midpoint_coordinates(self, *args, **kwargs):
     313        return self.mesh.get_edge_midpoint_coordinates(*args, **kwargs)               
     314       
     315    def get_edge_midpoint_coordinate(self, *args, **kwargs):
     316        return self.mesh.get_edge_midpoint_coordinate(*args, **kwargs)       
    308317
    309318    def get_triangles(self, *args, **kwargs):
  • anuga_core/source/anuga/abstract_2d_finite_volumes/general_mesh.py

    r7484 r7498  
    313313                offset=num.array([self.geo_reference.get_xllcorner(),
    314314                                  self.geo_reference.get_yllcorner()], num.float)
    315                 return num.array([V[i3,:]+offset,
    316                                   V[i3+1,:]+offset,
    317                                   V[i3+2,:]+offset], num.float)
     315                                 
     316                return V[i3:i3+3,:] + offset                                 
    318317            else:
    319                 return num.array([V[i3,:], V[i3+1,:], V[i3+2,:]], num.float)
     318                return V[i3:i3+3,:]
    320319
    321320    def get_vertex_coordinate(self, i, j, absolute=False):
     
    383382                offset=num.array([self.geo_reference.get_xllcorner(),
    384383                                  self.geo_reference.get_yllcorner()], num.float)
    385                 return num.array([E[i3,:]+offset,
    386                                   E[i3+1,:]+offset,
    387                                   E[i3+2,:]+offset], num.float)
     384
     385                return E[i3:i3+3,:] + offset                                 
    388386            else:
    389                 return num.array([E[i3,:], E[i3+1,:], E[i3+2,:]], num.float)   
     387                return E[i3:i3+3,:]
    390388
    391389
     
    399397
    400398        E = self.get_edge_midpoint_coordinates(triangle_id=i, absolute=absolute)
    401         return E[j,:]
     399        return E[j,:] # Return (x, y) for edge mid point
    402400
    403401   
  • anuga_core/source/anuga/abstract_2d_finite_volumes/generic_boundary_conditions.py

    r7317 r7498  
    252252        boundary_keys.sort()
    253253
    254         # Record ordering #FIXME: should this also happen in domain.py?
     254        # Record ordering #FIXME: should this also happen in domain.py or general_mesh.py?
    255255        self.boundary_indices = {}
    256256        for i, (vol_id, edge_id) in enumerate(boundary_keys):
    257257
    258             base_index = 3*vol_id
    259             x0, y0 = V[base_index, :]
    260             x1, y1 = V[base_index+1, :]
    261             x2, y2 = V[base_index+2, :]
    262            
    263             # Compute midpoints
    264             if edge_id == 0: m = num.array([(x1 + x2)/2, (y1 + y2)/2], num.float)
    265             if edge_id == 1: m = num.array([(x0 + x2)/2, (y0 + y2)/2], num.float)
    266             if edge_id == 2: m = num.array([(x1 + x0)/2, (y1 + y0)/2], num.float)
    267 
    268             # Convert to absolute UTM coordinates
    269             m[0] += xllcorner
    270             m[1] += yllcorner
    271            
    272             # Register point and index
    273             self.midpoint_coordinates[i,:] = m
     258            self.midpoint_coordinates[i,:] = domain.get_edge_midpoint_coordinate(vol_id, edge_id,
     259                                                                                 absolute=True)
    274260
    275261            # Register index of this boundary edge for use with evaluate
    276262            self.boundary_indices[(vol_id, edge_id)] = i
    277263
     264           
     265           
    278266        if verbose: log.critical('Initialise file_function')
    279267        self.F = file_function(filename,
Note: See TracChangeset for help on using the changeset viewer.