otherDataSetAttributes.tcl 1.82 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
for {set i  0} {$i < [expr $argc - 1]} {incr i} {
   if {[lindex $argv $i] == "-A"} {
      set auto_path "$auto_path [lindex $argv [expr $i +1]]"
   }
}

package require vtk

vtkDebugLeaks dl
dl PromptUserOff
dl Delete

vtkDataSetAttributes dsa

foreach array "Bit Char Double Float Int Long Short UnsignedChar UnsignedInt UnsignedLong UnsignedShort" {

    vtk${array}Array a${array}Array
    a${array}Array Allocate 1 1
    a${array}Array SetNumberOfComponents 3
    a${array}Array SetNumberOfTuples 4
    a${array}Array SetName a${array}Array

    # SetComponent
    set k 0
    for {set i 0} {$i < [a${array}Array GetNumberOfTuples]} {incr i} {
	for {set j 0} {$j < [a${array}Array GetNumberOfComponents]} {incr j} {
	    a${array}Array SetComponent $i $j 1
	    incr k
	}     
    }

    dsa AddArray  a${array}Array
    a${array}Array Delete
}

Ken Martin's avatar
Ken Martin committed
36
foreach attribute "Scalars Vectors Normals TCoords" {
37
38
39
40
    dsa SetActive${attribute} aFloatArray
    dsa Get${attribute} aFloatArray
    dsa Get${attribute} foo
}
Ken Martin's avatar
Ken Martin committed
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58

vtkFloatArray aFloatTensors
aFloatTensors Allocate 1 1
aFloatTensors SetNumberOfComponents 9
aFloatTensors SetNumberOfTuples 4
aFloatTensors SetName aFloatTensors
for {set i 0} {$i < [aFloatTensors GetNumberOfTuples]} {incr i} {
   for {set j 0} {$j < [aFloatTensors GetNumberOfComponents]} {incr j} {
      aFloatTensors SetComponent $i $j 1
      incr k
   }     
}
dsa AddArray  aFloatTensors
aFloatTensors Delete
dsa SetActiveTensors aFloatTensors
dsa GetTensors aFloatTensors
dsa GetTensors foo

59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
dsa RemoveArray aFloatArray

vtkDataSetAttributes dsa2
dsa2 CopyAllocate dsa 4 4
dsa2 CopyData dsa 0 0
dsa2 Delete

vtkDataSetAttributes dsa3
dsa3 InterpolateAllocate dsa 4 4
dsa3 InterpolateEdge dsa 0 0 1 0.5

vtkDataSetAttributes dsa4
dsa4 InterpolateAllocate dsa 4 4
dsa4 InterpolateTime dsa dsa3 0 0.5
dsa4 Delete

dsa3 Delete


dsa Delete
exit