Changeset 1272


Ignore:
Timestamp:
May 2, 2005, 5:58:03 PM (20 years ago)
Author:
steve
Message:

Playing with visualisation

Location:
inundation/ga/storm_surge
Files:
1 added
2 edited

Legend:

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

    r1271 r1272  
    77
    88        self.frame  = frame()
    9         self.bed_model     = faces(frame=self.frame)
     9        autoscale=0
     10        self.bed_model   = faces(frame=self.frame)
    1011        self.stage_model = faces(frame=self.frame)
    1112        self.domain = domain
     
    2728        self.max_bed = max(max(self.bed))
    2829        self.min_bed = min(min(self.bed))
    29         self.range_bed = self.max_bed - self.min_bed
     30        self.range_bed = max(self.max_bed - self.min_bed, 1e-10)*2.0
    3031
    3132        print 'min_bed=',self.min_bed
     
    4546        #print 'shape of stage',shape(self.stage)
    4647
     48        self.border_model = curve(frame = self.frame, pos=[(0,0),(0,1),(1,1),(1,0),(0,0)])
     49        self.timer=label(pos=(0.75,0.5,0.5),text='Time=%10.5e'%self.domain.time)
     50
    4751        self.update_all()
    4852
     
    5155        self.update_bed()
    5256        self.update_stage()
     57
     58    def update_timer(self):
     59        self.timer.text='Time=%10.5e'%self.domain.time
    5360
    5461    def update_bed(self):
     
    8996        min_y = self.min_y
    9097        range_xy = self.range_xy
     98        range_bed = self.range_bed
    9199
    92100        vertices = self.vertices
     
    96104
    97105        try:
    98             update_arrays_weave(vertices,quantity,col,pos,normals,colour,N,min_x,min_y,range_xy,scale_z)
     106            update_arrays_weave(vertices,quantity,col,pos,normals,colour,N,
     107                                min_x,min_y,range_xy,range_bed,scale_z)
    99108        except:
    100             update_arrays_python(vertices,quantity,col,pos,normals,colour,N,min_x,min_y,range_xy,scale_z)
    101 
    102 
    103 
    104 def  update_arrays_python(vertices,quantity,col,pos,normals,colour,N,min_x,min_y,range_xy,scale_z):
     109            update_arrays_python(vertices,quantity,col,pos,normals,colour,N,
     110                                 min_x,min_y,range_xy,range_bed,scale_z)
     111
     112
     113
     114def  update_arrays_python(vertices,quantity,col,pos,normals,colour,N,
     115                          min_x,min_y,range_xy,range_bed,scale_z):
    105116
    106117    from math import sqrt
     
    114125            v[j,0] = (vertices[i,2*j  ]-min_x)/range_xy
    115126            v[j,1] = (vertices[i,2*j+1]-min_y)/range_xy
    116             v[j,2] = quantity[i,j]*scale_z
     127            v[j,2] = quantity[i,j]/range_bed*scale_z
    117128
    118129        v10 = v[1,:]-v[0,:]
     
    156167
    157168
    158 def  update_arrays_weave(vertices,quantity,col,pos,normals,colour,N,min_x,min_y,range_xy,scale_z):
     169def  update_arrays_weave(vertices,quantity,col,pos,normals,colour,
     170                         N,min_x,min_y,range_xy,range_bed,scale_z):
    159171
    160172    import weave
     
    174186                v(j,0) = (vertices(i,2*j  )-min_x)/range_xy;
    175187                v(j,1) = (vertices(i,2*j+1)-min_y)/range_xy;
    176                 v(j,2) = quantity(i,j)*scale_z;
     188                v(j,2) = quantity(i,j)/range_bed*scale_z;
    177189            }
    178190
     
    261273    surface = domain.surface
    262274    surface.update_stage()
     275    surface.update_timer()
    263276    #print 'end visual update'
Note: See TracChangeset for help on using the changeset viewer.