Changeset 5354 for trunk/gui


Ignore:
Timestamp:
Apr 29, 2015, 2:38:53 AM (10 years ago)
Author:
ldelgass
Message:

Reorganize field class definition: methods at top, group by access

File:
1 edited

Legend:

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

    r5343 r5354  
    2121# Possible field dataset types:
    2222#
     23# 1D Datasets
     24#       1D              A field contained in a structure
    2325# 2D Datasets
    2426#       vtk             (range of z-axis is zero).
     
    3234#       mesh
    3335#       dx              (FIXME: make dx-to-vtk converter work)
    34 #       ucd avs
     36#       ucd             (AVS ucd format)
    3537#
    3638# Viewers:
    3739#       Format     Dim  Description                     Viewer          Server
     40#       1D          1   structure field                 DeviceViewer1D  N/A
    3841#       vtk         2   vtk file data.                  contour         vtkvis
    3942#       vtk         3   vtk file data.                  isosurface      vtkvis
     
    6467
    6568itcl::class Rappture::Field {
    66     protected variable _dim 0;          # Dimension of the mesh
    67     private variable _xmlobj "";        # ref to XML obj with field data
    68     private variable _limits;           # maps axis name => {z0 z1} limits
    69     private variable _field ""
    70     private variable _comp2fldName ;    # cname => field names.
    71     private variable _comp2type ;       # cname => type (e.g. "vectors")
    72     private variable _comp2size ;       # cname => # of components in element
    73     private variable _comp2assoc;       # cname => association (e.g. pointdata)
    74     private variable _fld2Components;   # field name => number of components
    75     private variable _fld2Label;        # field name => label
    76     private variable _fld2Units;        # field name => units
    77     private variable _hints
    78     private variable _viewer "";        # Hints which viewer to use
    79     private variable _isValid 0;        # Indicates if the field contains
    80                                         # valid data.
    81     private variable _isValidComponent; #  Array of valid components found
    82     private variable _alwaysConvertDX 0;
    83 
    8469    constructor {xmlobj path} {
    8570        # defined below
     
    9277    public method controls {option args}
    9378    public method extents {{cname -overall}}
    94     public method numComponents {cname}
    95     public method fieldlimits {}
    96     public method valueLimits { cname }
    97     public method flowhints { cname }
    98     public method hints {{key ""}}
    99     public method isunirect2d {}
    100     public method isunirect3d {}
    101     public method limits {axis}
    102     public method mesh {{cname -overall}}
    103     public method style { cname }
    104     public method type {}
    105     public method values { cname }
    106     public method vtkdata {cname}
    107     public method xErrorValues { cname } {
    108     }
    109     public method yErrorValues { cname } {
    110     }
    111 
    112     public method fieldnames { cname } {
    113         if { ![info exists _comp2fldName($cname)] } {
    114             return ""
    115         }
    116         return $_comp2fldName($cname)
    117     }
    11879    public method fieldinfo { fname } {
    11980        lappend out $_fld2Label($fname)
     
    12283        return $out
    12384    }
     85    public method fieldlimits {}
     86    public method fieldnames { cname } {
     87        if { ![info exists _comp2fldName($cname)] } {
     88            return ""
     89        }
     90        return $_comp2fldName($cname)
     91    }
     92    public method flowhints { cname }
     93    public method hints {{key ""}}
     94    public method isunirect2d {}
     95    public method isunirect3d {}
    12496    public method isvalid {} {
    12597        return $_isValid
    12698    }
     99    public method limits {axis}
     100    public method mesh {{cname -overall}}
     101    public method numComponents {cname}
     102    public method style { cname }
     103    public method type {}
     104    public method valueLimits { cname }
     105    public method values { cname }
    127106    public method viewer {} {
    128107        return $_viewer
    129108    }
     109    public method vtkdata {cname}
     110    public method xErrorValues { cname } {
     111    }
     112    public method yErrorValues { cname } {
     113    }
     114
    130115    protected method Build {}
    131116    protected method _getValue {expr}
    132 
    133     private variable _path "";          # Path of this object in the XML
    134     private variable _units ""   ;      # system of units for this field
    135     private variable _zmax 0     ;# length of the device
    136 
    137     private variable _comp2dims  ;# maps component name => dimensionality
    138     private variable _comp2xy    ;# maps component name => x,y vectors
    139     private variable _comp2vtk   ;# maps component name => vtk file data
    140     private variable _comp2dx    ;# maps component name => OpenDX data
    141     private variable _comp2unirect2d ;# maps component name => unirect2d obj
    142     private variable _comp2unirect3d ;# maps component name => unirect3d obj
    143     private variable _comp2style ;# maps component name => style settings
    144     private variable _comp2cntls ;# maps component name => x,y control points
    145     private variable _comp2extents
    146     private variable _comp2limits;        #  Array of limits per component
    147     private variable _type ""
    148     private variable _comp2flowhints
    149     private variable _comp2mesh  ;# list of: mesh object, BLT vector of values
    150     private variable _values ""  ;# Only used for unirect2d - list of values
    151     private common _counter 0    ;# counter for unique vector names
     117    protected method GetAssociation { cname }
     118    protected method GetTypeAndSize { cname }
     119    protected method ReadVtkDataSet { cname contents }
    152120
    153121    private method AvsToVtk { cname contents }
    154122    private method DicomToVtk { cname contents }
    155123    private method BuildPointsOnMesh { cname }
    156     protected method GetAssociation { cname }
    157     protected method GetTypeAndSize { cname }
    158     protected method ReadVtkDataSet { cname contents }
    159124    private method InitHints {}
    160125    private method VerifyVtkDataSet { contents }
    161126    private method VectorLimits { vector vectorsize {comp -1} }
    162127    private method VtkDataSetToXy { dataset }
     128
     129    protected variable _dim 0;          # Dimension of the mesh
     130
     131    private variable _xmlobj "";        # ref to XML obj with field data
     132    private variable _path "";          # Path of this object in the XML
     133    private variable _field "";         # This field element as XML obj
     134
     135    private variable _type "";          # Field type: e.g. file type
     136    private variable _hints;            # Hints array
     137    private variable _limits;           # maps axis name => {z0 z1} limits
     138    private variable _units "";         # system of units for this field
     139    private variable _viewer "";        # Hints which viewer to use
     140    private variable _isValid 0;        # Indicates if the field contains
     141                                        # valid data.
     142    private variable _isValidComponent; # Array of valid components found
     143    private variable _zmax 0;           # length of the device (1D only)
     144
     145    private variable _fld2Components;   # field name => number of components
     146    private variable _fld2Label;        # field name => label
     147    private variable _fld2Units;        # field name => units
     148
     149    private variable _comp2fldName;     # cname => field names.
     150    private variable _comp2type;        # cname => type (e.g. "vectors")
     151    private variable _comp2size;        # cname => # of components in element
     152    private variable _comp2assoc;       # cname => association (e.g. pointdata)
     153    private variable _comp2dims;        # cname => dimensionality
     154    private variable _comp2xy;          # cname => x,y vectors
     155    private variable _comp2vtk;         # cname => vtk file data
     156    private variable _comp2dx;          # cname => OpenDX data
     157    private variable _comp2unirect2d;   # cname => unirect2d obj
     158    private variable _comp2unirect3d;   # cname => unirect3d obj
     159    private variable _comp2style;       # cname => style settings
     160    private variable _comp2cntls;       # cname => x,y control points
     161    private variable _comp2extents
     162    private variable _comp2limits;      #  Array of limits per component
     163    private variable _comp2flowhints
     164    private variable _comp2mesh;        # list: mesh obj, BLT vector of values
     165
     166    private variable _values "";        # Only for unirect2d - list of values
     167
     168    private common _alwaysConvertDX 0;
     169    private common _counter 0;          # counter for unique vector names
    163170}
    164171
Note: See TracChangeset for help on using the changeset viewer.