[vtkusers] Bug or feature in vtkRearrangeFields ?

Roman Putanowicz putanowr at twins.pk.edu.pl
Tue Apr 6 02:41:02 EDT 2004


Hi VTK Users, 

Well, I suspect but I am not sure :-)
The behaviour of vtkRearrangeFields is very similar to the behaviour
of the bugged vtkAssignAttribute.

As is vtkRearrangeFields passes only these arrays which were specified
in AddOperation.

Here is example (script and data in attachement).
Without vtkRearrangeFields output contains the following arrays:

Field data
  density 
  temperature 
  subdomains 
  material 
Point data
Cell data

After adding the vtkRearrangeFields filter (named arranger) and calling
  arranger.AddOperation('MOVE', 'temperature', 'DATA_OBJECT', 'POINT_DATA')
the output contains the following arrays:

Field data
Point data
  temperature 
Cell data
  
In case of vtkRearrangeFields this may be intended behaviour to pass
only those arrays which were explicitly selected for rearrangement
but in fact I hope this is not the case and there is a bug :-)

Regards

Romek

-- 
    _/_/_/       _/     _/       _/_/_/_/_/    Roman Putanowicz 
  _/            _/     _/           _/         Inst.Comp.Meth.Civ.Eng.
 _/            _/     _/           _/          tel +48 12  628 2569
 _/_/_/racow   _/_/_/niversity of _/echnology  putanowr at twins.pk.edu.pl

-------------- next part --------------
# 
import vtkpython

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

arranger = vtkpython.vtkRearrangeFields()
arranger.SetInput(ureader.GetOutput())
arranger.AddOperation('MOVE', 'temperature', 'DATA_OBJECT', 'POINT_DATA')
arranger.Update()

# To see the effect of vtkRearrangeFields uncoment one or another of the two
# lines below 
ugrid = arranger.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 2.0
2D scalar data
ASCII
           
DATASET UNSTRUCTURED_GRID
POINTS 8 float 
0 0 2 1 0 2 1 1 2 0 1 2 2 0 2 
3 0 2 3 1 2 2 1 2

CELLS 6 24
3 0 1 2
3 0 2 3
3 1 4 2
3 4 7 2
3 4 5 7
3 5 6 7

CELL_TYPES 6
5 5 5 5 5 5

FIELD myfield 4

density  1 8 float
0 0 4 0 0 0 0 0

temperature 1 8  float 
1.0  2.0  2.0  1.0  3.0  4.0  4.0  3.0  

subdomains 1 6 int
0 1 2 3 4 5

material  1 6 int
3 3 3 4 4 4


More information about the vtkusers mailing list