Changeset 4998 for trunk


Ignore:
Timestamp:
Feb 11, 2015 1:56:11 PM (5 years ago)
Author:
ldelgass
Message:

Some cleanups and doc updates for mesh,values methods in field object

File:
1 edited

Legend:

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

    r4997 r4998  
    7777    private variable _hints
    7878    private variable _viewer "";        # Hints which viewer to use
    79     private variable _xv "";            # For 1D meshes only.  Holds the points
    8079    private variable _isValid 0;        # Indicates if the field contains
    8180                                        # valid data.
     
    148147    private variable _type ""
    149148    private variable _comp2flowhints
    150     private variable _comp2mesh
     149    private variable _comp2mesh  ;# list of: mesh object, BLT vector of values
     150    private variable _values ""  ;# Only used for unirect2d - list of values
    151151    private common _counter 0    ;# counter for unique vector names
    152152
     
    161161    private method VerifyVtkDataSet { contents }
    162162    private method VectorLimits { vector vectorsize {comp -1} }
    163     private variable _values ""
    164163}
    165164
     
    302301# USAGE: mesh ?<name>?
    303302#
    304 # Returns a list {xvec yvec} for the specified field component <name>.
    305 # If the name is not specified, then it returns the vectors for the
    306 # overall field (sum of all components).
     303# For 1D data (curve), returns a BLT vector of x values for the field
     304# component <name>.  Otherwise, this method is unused
    307305# ----------------------------------------------------------------------
    308306itcl::body Rappture::Field::mesh {{cname -overall}} {
     
    313311        return [lindex $_comp2xy($cname) 0]  ;# return xv
    314312    }
    315     if { [info exists _comp2vtk($cname)] } {
     313    if {[info exists _comp2vtk($cname)]} {
    316314        # FIXME: extract mesh from VTK file data.
    317         if { $_comp2dims($cname) == "1D" } {
    318             return $_xv
    319         }
    320315        error "method \"mesh\" is not implemented for VTK file data"
    321316    }
    322317    if {[info exists _comp2dx($cname)]} {
    323         return ""  ;# no mesh -- it's embedded in the blob data
     318        error "method \"mesh\" is not implemented for DX file data"
    324319    }
    325320    if {[info exists _comp2mesh($cname)]} {
    326         return ""  ;# no mesh -- it's embedded in the value data
     321        # FIXME: This only works for cloud
     322        set mesh [lindex $_comp2mesh($cname) 0]
     323        return [$mesh points]
    327324    }
    328325    if {[info exists _comp2unirect2d($cname)]} {
    329         set mobj [lindex $_comp2unirect2d($cname) 0]
    330         return [$mobj mesh]
     326        # FIXME: unirec2d mesh is a list: xMin xMax xNum yMin yMax yNum
     327        return [$_comp2unirect2d($cname) mesh]
    331328    }
    332329    if {[info exists _comp2unirect3d($cname)]} {
    333         set mobj [lindex $_comp2unirect3d($cname) 0]
    334         return [$mobj mesh]
     330        # This returns a list of x,y,z points
     331        return [$_comp2unirect3d($cname) mesh]
    335332    }
    336333    error "can't get field mesh: Unknown component \"$cname\": should be one of [join [lsort [array names _comp2dims]] {, }]"
     
    340337# USAGE: values ?<name>?
    341338#
    342 # Returns a list {xvec yvec} for the specified field component <name>.
    343 # If the name is not specified, then it returns the vectors for the
    344 # overall field (sum of all components).
     339# For 1D data (curve), returns a BLT vector of field values (y coords)
     340# for the field component <name>.  Otherwise, this method is unused
    345341# ----------------------------------------------------------------------
    346342itcl::body Rappture::Field::values {cname} {
     
    351347        return [lindex $_comp2xy($cname) 1]  ;# return yv
    352348    }
    353     # VTK file data
    354349    if { [info exists _comp2vtk($cname)] } {
    355350        # FIXME: extract the values from the VTK file data
    356         if { $_comp2dims($cname) == "1D" } {
    357             return $_values
    358         }
    359         error "method \"values\" is not implemented for vtk file data"
    360     }
    361     # Points-on-mesh
     351        error "method \"values\" is not implemented for VTK file data"
     352    }
     353    if {[info exists _comp2dx($cname)]} {
     354        error "method \"values\" is not implemented for DX file data"
     355    }
    362356    if { [info exists _comp2mesh($cname)] } {
    363357        set vector [lindex $_comp2mesh($cname) 1]
    364358        return [$vector range 0 end]
    365359    }
    366     if {[info exists _comp2dx($cname)]} {
    367         error "method \"values\" is not implemented for dx file data"
    368     }
    369360    if {[info exists _comp2unirect2d($cname)]} {
    370361        return $_values
     
    373364        return [$_comp2unirect3d($cname) values]
    374365    }
    375     error "can't get field values. Unknown component \"$cname\": should be [join [lsort [array names _comp2dims]] {, }]"
     366    error "can't get field values. Unknown component \"$cname\": should be one of [join [lsort [array names _comp2dims]] {, }]"
    376367}
    377368
     
    13841375        return $out
    13851376    }
    1386     error "can't find vtkdata for $cname. This method should only be called by the vtkheightmap widget"
     1377    error "can't find vtkdata for $cname"
    13871378}
    13881379
Note: See TracChangeset for help on using the changeset viewer.