Changeset 2718 for trunk


Ignore:
Timestamp:
Dec 6, 2011, 2:27:25 PM (13 years ago)
Author:
gah
Message:
 
Location:
trunk/gui/scripts
Files:
1 added
1 edited

Legend:

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

    r2711 r2718  
    3535    public method flowhints { cname }
    3636    public method type {}
     37    public method vtkdata {{what -overall}}
    3738
    3839    protected method _build {}
     
    5051    private variable _comp2vtk   ;# maps component name => vtkFloatArray
    5152    private variable _comp2vtkstreamlines   ;# maps component name => vtkFloatArray
     53    private variable _comp2volume   ;# maps component name => vtkFloatArray
    5254    private variable _comp2dx    ;# maps component name => OpenDX data
    5355    private variable _comp2unirect2d ;# maps component name => unirect2d obj
     
    967969    return $_comp2extents($what)
    968970}
     971
     972# ----------------------------------------------------------------------
     973# USAGE: blob ?<name>?
     974#
     975# Returns a string representing the blob of data for the mesh and values.
     976# ----------------------------------------------------------------------
     977itcl::body Rappture::Field::vtkdata {{what -overall}} {
     978    if {$what == "component0"} {
     979        set what "component"
     980    }
     981    if {[info exists _comp2xy($what)]} {
     982        return ""
     983    }
     984    if { [info exists _comp2vtk($what)] } {
     985        return ""
     986    }
     987    if { [info exists _comp2vtkstreamlines($what)] } {
     988        # Return the contents of the vtk file.
     989        return $_comp2vtkstreamlines($what)
     990    }
     991    if { [info exists _comp2vtkvolume($what)] } {
     992        # Return the contents of the vtk file.
     993        return $_comp2vtkvolume($what)
     994    }
     995    if {[info exists _comp2dx($what)]} {
     996        set data $_comp2dx($what)
     997        if { $data == "" } {
     998            return ""
     999        }
     1000        set data  [$_field get -decode yes $data]
     1001        set data [Rappture::ConvertDxToVtk $data]
     1002        return $data
     1003    }
     1004    if {[info exists _comp2unirect2d($what)]} {
     1005        return [$_comp2unirect2d($what) blob]
     1006    }
     1007    if {[info exists _comp2unirect3d($what)]} {
     1008        return [$_comp2unirect3d($what) blob]
     1009    }
     1010    error "bad option \"$what\": should be [join [lsort [array names _comp2dims]] {, }]"
     1011}
Note: See TracChangeset for help on using the changeset viewer.