Changeset 2267


Ignore:
Timestamp:
Jan 23, 2006, 3:07:17 PM (18 years ago)
Author:
jack
Message:

Added pause and resume buttons to the vtk visualiser. This
will freeze the evolve thread, allowing interaction with the visualiser.

Disabled use of the vtk_visualiser_ext module, because it doesn't link on windows.
The prebuilt vtk DLLs are built with VC++ and the rest of the project is being built with
MinGW, which don't link together. The speed increase wasn't noticable anyway.

Location:
inundation/pyvolution
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • inundation/pyvolution/vtk_realtime_visualiser.py

    r2266 r2267  
    5252        self.idle = threading.Event()
    5353        self.redraw_ready = threading.Event()
     54        self.unpaused = threading.Event()
     55        self.unpaused.set()
    5456
    5557        # Internal use - storage of vtk objects
     
    106108
    107109        self.quitButton = Tkinter.Button(self.root, text='Quit', command=self.shutdown)
    108         self.quitButton.pack(side=Tkinter.BOTTOM)
     110        self.quitButton.pack(side=Tkinter.RIGHT)
     111
     112        self.pauseButton = Tkinter.Button(self.root, text='Pause', command=self.unpaused.clear)
     113        self.pauseButton.pack(side=Tkinter.LEFT)
     114
     115        self.resumeButton = Tkinter.Button(self.root, text='Resume', command=self.unpaused.set)
     116        self.resumeButton.pack(side=Tkinter.LEFT)
    109117
    110118    def add_axes(self):
     
    142150        else:
    143151            scale = self.default_scale_z
    144 
    145         self.grids[q] = make_vtkpoints(self.N_tri,
    146                                    self.N_vert,
    147                                    scale,
    148                                    self.domain.quantities[q].vertex_values,
    149                                    self.vert_index,
    150                                    self.domain.triangles)
     152        #############################################################
     153        # Disabled the make_vtkpoints call because the extension is
     154        # difficult to get to link under windows
     155        #############################################################
     156        #self.grids[q] = make_vtkpoints(self.N_tri,
     157        #                           self.N_vert,
     158        #                           scale,
     159        #                           self.domain.quantities[q].vertex_values,
     160        #                           self.vert_index,
     161        #                           self.domain.triangles)
     162        #grid = self.grids[q]
     163        #############################################################
     164       
     165        qty_index = zeros(self.N_vert, Float)
     166        for n in range(self.N_tri):
     167            for v in range(3):
     168                qty_index[self.domain.triangles[n][v]] = self.domain.quantities[q].vertex_values[n][v]
     169               
     170        self.grids[q] = vtk.vtkPoints()
    151171        grid = self.grids[q]
    152         ###################################################
    153         # Obsoleted by vtk_visualiser_ext and make_vtkpoints
    154         ###################################################
    155         #qty_index = zeros(self.N_vert, Float)
    156         #for n in range(self.N_tri):
    157         #    for v in range(3):
    158         #        qty_index[self.domain.triangles[n][v]] = self.domain.quantities[q].vertex_values[n][v]
    159         #self.grids[q] = vtk.vtkPoints()
    160         #grid = self.grids[q]
    161         #for v in range(self.N_vert):
    162         #    grid.InsertNextPoint(self.vert_index[v][0],
    163         #                         self.vert_index[v][1],
    164         #                         qty_index[v] * scale)
    165         ###################################################
     172       
     173        for v in range(self.N_vert):
     174            grid.InsertNextPoint(self.vert_index[v][0],
     175                                 self.vert_index[v][1],
     176                                 qty_index[v] * scale)
    166177
    167178        # Can't recycle vtkPolyData objects: Apparently they behave
     
    211222        self.domain.visualise = False
    212223        self.idle.set()
     224        self.unpaused.set()
    213225        self.root.withdraw()
    214226        self.root.quit()
  • inundation/pyvolution/vtk_visualiser_ext.cpp

    r2266 r2267  
     1/*
     2 * Additional functions used by the VTK visualiser
     3 * currently not used, since it is a pain to link on windows
     4 *
     5 */
     6
    17#include "Python.h"
    28#include "Numeric/arrayobject.h"
Note: See TracChangeset for help on using the changeset viewer.