Changeset 3960


Ignore:
Timestamp:
Nov 9, 2006, 4:47:53 PM (18 years ago)
Author:
jack
Message:

Converted about 1/2 the realtime vis to use accessor functions rather than accessing internals directly.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • anuga_core/source/anuga/visualiser/realtime.py

    r3958 r3960  
    4545    def setup_grid(self):
    4646        self.vtk_cells = vtkCellArray()
    47         triangles = self.source.triangles
    48         N_tri = self.source.number_of_triangles
     47        triangles = self.source.get_triangles()
     48        N_tri = len(self.source)
    4949        verticies = self.source.get_vertex_coordinates()
    5050        N_vert = len(verticies)
     
    5858
    5959    def update_height_quantity(self, quantityName, dynamic=True):
    60         N_vert = len(self.source.vertex_coordinates)
     60        N_vert = len(self.source.get_vertex_coordinates())
    6161        qty_index = zeros(N_vert, Float)
     62        triangles = self.source.get_triangles()
    6263
    63         for n in range(len(self.source.triangles)):
     64        for n in range(len(triangles)):
    6465            for v in range(3):
    65                 qty_index[self.source.triangles[n][v]] = self.source.quantities[quantityName].vertex_values[n][v]
     66                qty_index[triangles[n][v]] = self.source.get_quantity(quantityName).vertex_values[n][v]
    6667
    6768        points = vtkPoints()
     
    9293       
    9394    def build_quantity_dict(self):
    94         N_vert = len(self.source.vertex_coordinates)
     95        triangles = self.source.get_triangles()
    9596        quantities = {}
    9697        for q in self.source.quantities.keys():
    97             quantities[q] = zeros(N_vert, Float)
    98             for n in range(len(self.source.triangles)):
    99                 for v in range(3):
    100                     quantities[q][self.source.triangles[n][v]] = self.source.quantities[q].vertex_values[n][v]
     98            quantities[q], _ = self.source.get_quantity(q).get_vertex_values(xy=False)
    10199        return quantities
    102100
Note: See TracChangeset for help on using the changeset viewer.