Changeset 3448
- Timestamp:
- Aug 3, 2006, 2:58:25 PM (19 years ago)
- Location:
- inundation/pyvolution
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/pyvolution/netherlands.py
r2813 r3448 12 12 #rpdb.set_active() 13 13 14 from shallow_water _vtkimport Domain, Reflective_boundary, Dirichlet_boundary,\14 from shallow_water import Domain, Reflective_boundary, Dirichlet_boundary,\ 15 15 Transmissive_boundary, Constant_height, Constant_stage 16 16 17 17 from mesh_factory import rectangular_cross 18 18 from Numeric import array 19 19 from vtk_realtime_visualiser import Visualiser 20 20 21 21 class Weir: … … 121 121 domain.filename, _ = os.path.splitext(base) 122 122 else: 123 domain.initialise_visualiser(rect=[0.0,0.0,1.0,1.0])123 #domain.initialise_visualiser(rect=[0.0,0.0,1.0,1.0]) 124 124 #domain.initialise_visualiser() 125 125 #domain.visualiser.coloring['stage'] = False … … 127 127 domain.checkpoint = False 128 128 domain.store = False 129 129 vis = Visualiser(domain) 130 vis.setup['elevation'] = True 131 vis.updating['stage'] = True 132 vis.qcolor['stage'] = (0.0,0.0,0.8) 130 133 131 134 … … 174 177 domain.write_time() 175 178 #domain.write_boundary() 176 179 vis.update() 177 180 print domain.quantities['stage'].get_values(location='centroids', 178 181 indices=[0]) … … 188 191 189 192 print 'That took %.2f seconds' %(time.time()-t0) 193 vis.shutdown() -
inundation/pyvolution/vtk_realtime_visualiser.py
r2421 r3448 36 36 """ 37 37 38 def __init__(self, domain, default_scale_z=1.0, rect=None,title='Test'):38 def __init__(self, domain, default_scale_z=1.0, title='Test'): 39 39 threading.Thread.__init__(self) 40 40 # Initialise data structures. setup and updating are maps … … 51 51 self.vertices = domain.vertex_coordinates 52 52 53 54 55 56 53 self.idle = threading.Event() 57 54 self.redraw_ready = threading.Event() … … 66 63 self.mappers = {} 67 64 65 self.running = True 66 68 67 # Default options 69 68 for x in self.domain.quantities: 70 69 self.setup[x] = False 71 70 self.updating[x] = False 72 73 # Bounding box. 74 if rect is None: 75 self.max_x = max(max(self.vertices[:,0]),max(self.vertices[:,2]),max(self.vertices[:,4])) 76 self.min_x = min(min(self.vertices[:,0]),min(self.vertices[:,2]),min(self.vertices[:,4])) 77 self.max_y = max(max(self.vertices[:,1]),max(self.vertices[:,3]),max(self.vertices[:,5])) 78 self.min_y = min(min(self.vertices[:,1]),min(self.vertices[:,3]),min(self.vertices[:,5])) 79 else: 80 self.max_x = rect[2] 81 self.min_x = rect[0] 82 self.max_y = rect[3] 83 self.min_y = rect[1] 84 85 self.range_x = self.max_x - self.min_x 86 self.range_y = self.max_y - self.min_y 87 self.range_xy = max(self.range_x, self.range_y) 88 71 self.coloring[x] = False 72 self.start() 73 89 74 def run(self): 90 75 self.initialise_gui() … … 129 114 130 115 def add_axes(self): 131 """Add axes to this Visualiser 116 """Add axes to this Visualiser - TODO 132 117 """ 133 118 pass … … 239 224 240 225 self.renderWindow.Render() 241 242 243 226 244 227 self.root.update_idletasks() 245 228 self.idle.set() … … 247 230 248 231 def shutdown(self): 249 self.domain.visualise = False 232 """Shutdown the visualiser 233 """ 234 self.running = False 250 235 self.idle.set() 251 236 self.unpaused.set() 252 237 self.root.withdraw() 253 238 self.root.quit() 239 240 def update(self): 241 """Update the visualiser's display. 242 Clients are expected to call this in their evolve() loop, 243 to keep the visualiser in sync with the simulation. 244 """ 245 if self.running: 246 self.redraw_ready.set() 247 self.idle.wait() 248 self.idle.clear() 249 self.unpaused.wait()
Note: See TracChangeset
for help on using the changeset viewer.