Ignore:
Timestamp:
May 29, 2006 7:59:02 PM (18 years ago)
Author:
mmc
Message:

Fixed the nanovisviewer so that it supports multiple volumes, and
so you can switch back and forth between volumes. Also, guarded
against lock-ups by sending volume data a chunk at a time and
updating events in between. That way, we can read results coming
back from the application, and avoid a deadlock where both client
and server are writing to a full buffer.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gui/scripts/field.tcl

    r136 r447  
    4141    private variable _comp2xy    ;# maps component name => x,y vectors
    4242    private variable _comp2vtk   ;# maps component name => vtkFloatArray
     43    private variable _comp2dx    ;# maps component name => OpenDX data
    4344    private variable _comp2style ;# maps component name => style settings
    4445    private variable _comp2cntls ;# maps component name => x,y control points
     
    161162        return [$mobj mesh]
    162163    }
     164    if {[info exists _comp2dx($what)]} {
     165        return ""  ;# no mesh -- it's embedded in the value data
     166    }
    163167    error "bad option \"$what\": should be [join [lsort [array names _comp2dims]] {, }]"
    164168}
     
    180184    if {[info exists _comp2vtk($what)]} {
    181185        return [lindex $_comp2vtk($what) 1]  ;# return vtkFloatArray
     186    }
     187    if {[info exists _comp2dx($what)]} {
     188        return $_comp2dx($what)  ;# return gzipped, base64-encoded DX data
    182189    }
    183190    error "bad option \"$what\": should be [join [lsort [array names _comp2dims]] {, }]"
     
    237244            }
    238245            2D - 3D {
    239                 foreach {xv yv} $_comp2vtk($comp) break
    240                 switch -- $which {
    241                     x - xlin - xlog {
    242                         foreach {vmin vmax} [$xv limits x] break
    243                         set axis xaxis
    244                     }
    245                     y - ylin - ylog {
    246                         foreach {vmin vmax} [$xv limits y] break
    247                         set axis yaxis
    248                     }
    249                     z - zlin - zlog {
    250                         foreach {vmin vmax} [$xv limits z] break
    251                         set axis zaxis
    252                     }
    253                     v - vlin - vlog {
    254                         catch {unset style}
    255                         array set style $_comp2style($comp)
    256                         if {[info exists style(-min)] && [info exists style(-max)]} {
    257                             # This component has its own hard-coded
    258                             # min/max range.  Ignore it for overall limits.
    259                             set vmin $min
    260                             set vmax $max
    261                         } else {
    262                             foreach {vmin vmax} [$yv GetRange] break
    263                         }
    264                         set axis vaxis
    265                     }
    266                     default {
    267                         error "bad option \"$which\": should be x, xlin, xlog, y, ylin, ylog, v, vlin, vlog"
    268                     }
     246                if {[info exists _comp2vkt($comp)]} {
     247                    foreach {xv yv} $_comp2vtk($comp) break
     248                    switch -- $which {
     249                        x - xlin - xlog {
     250                            foreach {vmin vmax} [$xv limits x] break
     251                            set axis xaxis
     252                        }
     253                        y - ylin - ylog {
     254                            foreach {vmin vmax} [$xv limits y] break
     255                            set axis yaxis
     256                        }
     257                        z - zlin - zlog {
     258                            foreach {vmin vmax} [$xv limits z] break
     259                            set axis zaxis
     260                        }
     261                        v - vlin - vlog {
     262                            catch {unset style}
     263                            array set style $_comp2style($comp)
     264                            if {[info exists style(-min)] && [info exists style(-max)]} {
     265                                # This component has its own hard-coded
     266                                # min/max range.  Ignore it for overall limits.
     267                                set vmin $min
     268                                set vmax $max
     269                            } else {
     270                                foreach {vmin vmax} [$yv GetRange] break
     271                            }
     272                            set axis vaxis
     273                        }
     274                        default {
     275                            error "bad option \"$which\": should be x, xlin, xlog, y, ylin, ylog, v, vlin, vlog"
     276                        }
     277                    }
     278                } else {
     279                    set vmin 0  ;# HACK ALERT! must be OpenDX data
     280                    set vmax 1
     281                    set axis vaxis
    269282                }
    270283            }
     
    392405    catch {unset _comp2xy}
    393406    catch {unset _comp2vtk}
     407    catch {unset _comp2dx}
    394408    catch {unset _comp2dims}
    395409    catch {unset _comp2style}
     
    410424        } elseif {[$_field element $cname.vtk] != ""} {
    411425            set type "vtk"
     426        } elseif {[$_field element $cname.dx] != ""} {
     427            set type "dx"
    412428        }
    413429
     
    550566            set _comp2dims($cname) "[$mobj dimensions]D"
    551567            set _comp2vtk($cname) [list $mobj $farray]
     568            set _comp2style($cname) [$_field get $cname.style]
     569            incr _counter
     570        } elseif {$type == "dx"} {
     571            #
     572            # HACK ALERT!  Extract gzipped, base64-encoded OpenDX
     573            # data.  Assume that it's 3D.  Pass it straight
     574            # off to the NanoVis visualizer.
     575            #
     576            set _comp2dims($cname) "3D"
     577            set _comp2dx($cname) [$_field get $cname.dx]
    552578            set _comp2style($cname) [$_field get $cname.style]
    553579            incr _counter
Note: See TracChangeset for help on using the changeset viewer.