[vtkusers] Bug in vtkMergeDataObjectFilter ?
Roman Putanowicz
putanowr at twins.pk.edu.pl
Mon Apr 5 02:48:21 EDT 2004
Hi VTK Users,
I think I have found a bug in vtkMergeDataObjectFilter.
I am using VTK 4.4 but have checked the CVS and the bug is there too.
The vtkMergeDataObjectFilter does not pass any fields if
the method SetOutputFieldToDataObjectField was called.
Quick look at the code reveals that in vtkMergeDataObjectFilter::Execute
there is code for the case this->OutputField == VTK_CELL_DATA_FIELD
and this->OutputField == VTK_POINT_DATA_FIELD but the case
this->OutputField == VTK_DATA_OBJECT_FIELD is not handled at all.
Below I attached my fix and in the attachment there is Python script
and data files to reproduce the bug/check the fix.
Regards
Romek
-------------- next part --------------
#
import vtkpython
import sys
if len(sys.argv) != 3:
print "usage: %s emptygrid.vtk purefield.vtk" % sys.argv[0]
sys.exit()
ureader = vtkpython.vtkUnstructuredGridReader()
ureader.SetFileName(sys.argv[1])
ureader.Update()
doreader = vtkpython.vtkDataObjectReader()
doreader.SetFileName(sys.argv[2])
doreader.Update()
merger = vtkpython.vtkMergeDataObjectFilter()
merger.SetInput(ureader.GetOutput())
merger.SetDataObject(doreader.GetOutput())
merger.SetOutputFieldToDataObjectField()
merger.Update()
ugrid =merger.GetUnstructuredGridOutput()
fielddata = ugrid.GetFieldData()
print "Field data"
for i in range(fielddata.GetNumberOfArrays()):
print " %s "% fielddata.GetArrayName(i)
-------------- next part --------------
# vtk DataFile Version 2.0
Simple grid with not attributes
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
-------------- next part --------------
# vtk DataFile Version 2.0
scalar fields
ASCII
FIELD mixed 4
pressure 1 4 float
0 0 4 0
temperature 1 4 float
1.0 2.0 2.0 1.0
subdomains 1 2 int
0 1
material 1 2 int
3 4
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
More information about the vtkusers
mailing list