Changeset 113 for trunk/gui/scripts/mesh.tcl
- Timestamp:
- Oct 18, 2005 8:58:02 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/scripts/mesh.tcl
r95 r113 32 32 public proc release {obj} 33 33 34 private method _getVtkElement {npts} 35 34 36 private variable _xmlobj "" ;# ref to XML obj with device data 35 37 private variable _mesh "" ;# lib obj representing this mesh 38 private variable _pts2elem ;# maps # points => vtk element 36 39 37 40 private variable _units "m m m" ;# system of units for x, y, z … … 109 112 # create the vtk objects containing points and connectivity 110 113 vtkPoints $this-points 111 vtkVoxel $this-vox112 114 vtkUnstructuredGrid $this-grid 113 115 … … 152 154 foreach comp [$xmlobj children -type element $path] { 153 155 set nlist [$_mesh get $comp.nodes] 156 set elem [_getVtkElement [llength $nlist]] 157 154 158 set i 0 155 159 foreach n $nlist { 156 [$ this-voxGetPointIds] SetId $i $n160 [$elem GetPointIds] SetId $i $n 157 161 incr i 158 162 } 159 $this-grid InsertNextCell [$this-vox GetCellType] \ 160 [$this-vox GetPointIds] 163 $this-grid InsertNextCell [$elem GetCellType] [$elem GetPointIds] 161 164 } 162 165 } … … 170 173 171 174 rename $this-points "" 172 rename $this-vox ""173 175 rename $this-grid "" 176 177 foreach type [array names _pts2elem] { 178 rename $_pts2elem($type) "" 179 } 174 180 } 175 181 … … 304 310 return [array get hints] 305 311 } 312 313 # ---------------------------------------------------------------------- 314 # USAGE: _getVtkElement <npts> 315 # 316 # Used internally to find (or allocate, if necessary) a vtk element 317 # that can be used to build up a mesh. The element depends on the 318 # number of points passed in. 4 points is a tetrahedron, 5 points 319 # is a pyramid, etc. 320 # ---------------------------------------------------------------------- 321 itcl::body Rappture::Mesh::_getVtkElement {npts} { 322 if {![info exists _pts2elem($npts)]} { 323 switch -- $npts { 324 4 { 325 set _pts2elem($npts) $this-elem4 326 vtkTetra $_pts2elem($npts) 327 } 328 5 { 329 set _pts2elem($npts) $this-elem5 330 vtkPyramid $_pts2elem($npts) 331 } 332 6 { 333 set _pts2elem($npts) $this-elem6 334 vtkWedge $_pts2elem($npts) 335 } 336 8 { 337 set _pts2elem($npts) $this-elem8 338 vtkVoxel $_pts2elem($npts) 339 } 340 } 341 } 342 return $_pts2elem($npts) 343 }
Note: See TracChangeset
for help on using the changeset viewer.