- Timestamp:
- Apr 29, 2015, 2:38:53 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/scripts/field.tcl
r5343 r5354 21 21 # Possible field dataset types: 22 22 # 23 # 1D Datasets 24 # 1D A field contained in a structure 23 25 # 2D Datasets 24 26 # vtk (range of z-axis is zero). … … 32 34 # mesh 33 35 # dx (FIXME: make dx-to-vtk converter work) 34 # ucd avs36 # ucd (AVS ucd format) 35 37 # 36 38 # Viewers: 37 39 # Format Dim Description Viewer Server 40 # 1D 1 structure field DeviceViewer1D N/A 38 41 # vtk 2 vtk file data. contour vtkvis 39 42 # vtk 3 vtk file data. isosurface vtkvis … … 64 67 65 68 itcl::class Rappture::Field { 66 protected variable _dim 0; # Dimension of the mesh67 private variable _xmlobj ""; # ref to XML obj with field data68 private variable _limits; # maps axis name => {z0 z1} limits69 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 element73 private variable _comp2assoc; # cname => association (e.g. pointdata)74 private variable _fld2Components; # field name => number of components75 private variable _fld2Label; # field name => label76 private variable _fld2Units; # field name => units77 private variable _hints78 private variable _viewer ""; # Hints which viewer to use79 private variable _isValid 0; # Indicates if the field contains80 # valid data.81 private variable _isValidComponent; # Array of valid components found82 private variable _alwaysConvertDX 0;83 84 69 constructor {xmlobj path} { 85 70 # defined below … … 92 77 public method controls {option args} 93 78 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 }118 79 public method fieldinfo { fname } { 119 80 lappend out $_fld2Label($fname) … … 122 83 return $out 123 84 } 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 {} 124 96 public method isvalid {} { 125 97 return $_isValid 126 98 } 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 } 127 106 public method viewer {} { 128 107 return $_viewer 129 108 } 109 public method vtkdata {cname} 110 public method xErrorValues { cname } { 111 } 112 public method yErrorValues { cname } { 113 } 114 130 115 protected method Build {} 131 116 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 } 152 120 153 121 private method AvsToVtk { cname contents } 154 122 private method DicomToVtk { cname contents } 155 123 private method BuildPointsOnMesh { cname } 156 protected method GetAssociation { cname }157 protected method GetTypeAndSize { cname }158 protected method ReadVtkDataSet { cname contents }159 124 private method InitHints {} 160 125 private method VerifyVtkDataSet { contents } 161 126 private method VectorLimits { vector vectorsize {comp -1} } 162 127 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 163 170 } 164 171
Note: See TracChangeset
for help on using the changeset viewer.