Listing 3. Code to Display Model and Vector Boundaries
# creation of render windows, etc. snipped
vtkPolyData mesh
vtkFloatPoints points
vtkCellArray cells
vtkFloatVectors vector
vtkHedgeHog hhog
vtkFloatScalars field
for {set i 1} {$i <= $nverts} {incr i} {
points InsertPoint $i $xk($i) $yk($i) $zk($i)
}
# loop over points and set vector magnitudes. (snipped)
for {set i 1} {$i <= $nverts} {incr i} {
field InsertScalar $i $vec($i)
}
[mesh GetPointData] SetScalars field
set srange [[[mesh GetPointData] GetScalars] GetRange]
puts stdout "range of $type: $srange"
# find minimum and maxisum vector magnitude for
# later colarmap ranging (snipped).
#(max and min cell size calculations snipped)
# set the cells of the data set.
set p1 $i1tab($i)
set p2 $i3tab($i)
set p3 $i8tab($i)
cells InsertNextCell 2
cells InsertCellPoint $i
cells InsertCellPoint $p1
# (p2 and p3 cell code snipped)
}
}
mesh SetPoints points
mesh SetLines cells
[mesh GetPointData] SetVectors vector
cells Delete
# polydata set which puts panels on all solid surfaces:
vtkPolyData panels
vtkCellArray panelcells
# use the "points" from above"
for {set i $first_cell} {$i <= $last_cell} {incr i} {
# puts "finding panels for $i"
# snipped code that creates bit-encoded integer
# which describes the solid panels on cell $i.
# This integer is stored in the variable $sum.
set sum [expr $ibcl + $ibcb + $ibcf]
switch -exact $sum {
1 {
panelcells InsertNextCell 4
panelcells InsertCellPoint $i
panelcells InsertCellPoint $p1
panelcells InsertCellPoint $p8
panelcells InsertCellPoint $p5
}
# switches 2 -- 6 snipped
7 {
panelcells InsertNextCell 6
panelcells InsertCellPoint $p7
panelcells InsertCellPoint $p3
panelcells InsertCellPoint $p8
panelcells InsertCellPoint $i
panelcells InsertCellPoint $p5
panelcells InsertCellPoint $p1
panelcells InsertNextCell 4
panelcells InsertCellPoint $i
panelcells InsertCellPoint $p1
panelcells InsertCellPoint $p3
panelcells InsertCellPoint $p2
}
}
}
panels SetPoints points
panels SetStrips panelcells
vtkDataSetMapper mapper
vtkPolyDataMapper panelmapper
panelmapper SetInput panels
vtkActor panelactor
panelactor SetMapper panelmapper
set panelprop [panelactor GetProperty]
$panelprop SetColor .7 .7 .7
$panelprop SetOpacity .5
hhog SetInput mesh
mapper SetInput [hhog GetOutput]
ren AddActor meshactor
ren AddActor panelactor
[meshactor GetProperty] SetRepresentationToSurface
# render commands snipped.