[vtkusers] vtkAssignAttribute behaviour

Roman Putanowicz putanowr at twins.pk.edu.pl
Mon Apr 5 13:55:46 EDT 2004


Hi VTK Users,

Could anybody, please, explain me what is the intended behaviour
of vktAssignAttribute filter in respect to the data set field data?

It seems to me that this filter filters out the data set field data.

The effect is illustrated with the attached script.

If the vtkAssignAttribute filter is not in the pipeline the script
produces the following list of arrays in the data:

Field data
  force 
  accel 
Point data
  velocity 
  meantemp 
Cell data
  density 

Inserting the vtkAssignAttribute filter changes the output to

Field data
Point data
  velocity 
  meantemp 
Cell data
  density 


Is this a bug or intended behaviour ?.
Thanks in advance.

Romek
-------------- next part --------------
# 
import vtkpython
import sys

ureader = vtkpython.vtkUnstructuredGridReader()
ureader.SetFileName('assign_ugrid.vtk')
ureader.Update()

assigner = vtkpython.vtkAssignAttribute()
assigner.SetInput(ureader.GetOutput())
assigner.Update()

# To see the effect of vtkAssignAttribute uncoment one or another of the two
# lines below 
ugrid = assigner.GetUnstructuredGridOutput()
#ugrid = ureader.GetOutput()

fielddata = ugrid.GetFieldData()

print "Field data"
for i in range(fielddata.GetNumberOfArrays()):
    print "  %s "% fielddata.GetArrayName(i)

pointdata = ugrid.GetPointData()
print "Point data"
for i in range(pointdata.GetNumberOfArrays()):
    print "  %s "% pointdata.GetArrayName(i)

celldata = ugrid.GetCellData()
print "Cell data"
for i in range(celldata.GetNumberOfArrays()):
    print "  %s "% celldata.GetArrayName(i)
-------------- next part --------------
# vtk DataFile Version 3.0
2D scalar data
ASCII
           
DATASET UNSTRUCTURED_GRID
POINTS 4 float 
0 0 0 
1 0 0
1 1 0
0 1 0

CELLS 2 8 
3 0 1 2
3 0 2 3

CELL_TYPES 2
5 5

FIELD pvec 2
force 2 4 float
1.0 0.0
1.0 1.0
1.0 1.0
1.0 0.0

accel 2 4 float
0.5 1.0
1.0 0.0
1.0 0.5
0.5 1.5

POINT_DATA 4
VECTORS velocity float 
 1.0  0.0  0.0
 1.0  0.5  0.0
 0.0  1.0  0.0
-0.5  1.0  0.0

VECTORS displacement float 
0.0 0.0 0.0
1.0 0.0 0.5
1.0 1.0 1.0
0.0 1.0 0.2

SCALARS meantemp float 1
LOOKUP_TABLE default
1.0 5.0 6.0 2.0

CELL_DATA 2
SCALARS density float 1
LOOKUP_TABLE default
2  1 

SCALARS resistance float 2
LOOKUP_TABLE default
1 2
3 4


More information about the vtkusers mailing list