Changeset 447 for trunk/gui/scripts/field.tcl
- Timestamp:
- May 29, 2006 7:59:02 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/scripts/field.tcl
r136 r447 41 41 private variable _comp2xy ;# maps component name => x,y vectors 42 42 private variable _comp2vtk ;# maps component name => vtkFloatArray 43 private variable _comp2dx ;# maps component name => OpenDX data 43 44 private variable _comp2style ;# maps component name => style settings 44 45 private variable _comp2cntls ;# maps component name => x,y control points … … 161 162 return [$mobj mesh] 162 163 } 164 if {[info exists _comp2dx($what)]} { 165 return "" ;# no mesh -- it's embedded in the value data 166 } 163 167 error "bad option \"$what\": should be [join [lsort [array names _comp2dims]] {, }]" 164 168 } … … 180 184 if {[info exists _comp2vtk($what)]} { 181 185 return [lindex $_comp2vtk($what) 1] ;# return vtkFloatArray 186 } 187 if {[info exists _comp2dx($what)]} { 188 return $_comp2dx($what) ;# return gzipped, base64-encoded DX data 182 189 } 183 190 error "bad option \"$what\": should be [join [lsort [array names _comp2dims]] {, }]" … … 237 244 } 238 245 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 269 282 } 270 283 } … … 392 405 catch {unset _comp2xy} 393 406 catch {unset _comp2vtk} 407 catch {unset _comp2dx} 394 408 catch {unset _comp2dims} 395 409 catch {unset _comp2style} … … 410 424 } elseif {[$_field element $cname.vtk] != ""} { 411 425 set type "vtk" 426 } elseif {[$_field element $cname.dx] != ""} { 427 set type "dx" 412 428 } 413 429 … … 550 566 set _comp2dims($cname) "[$mobj dimensions]D" 551 567 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] 552 578 set _comp2style($cname) [$_field get $cname.style] 553 579 incr _counter
Note: See TracChangeset
for help on using the changeset viewer.