[vtkusers] Problem upgrading from VTK3.1 (UG+Field)

Amy Henderson amy.henderson at kitware.com
Tue Oct 26 09:33:32 EDT 2004


Hi Gil,

I don't think the vtkFieldDataToAttributeFilter is actually what you want 
to use; it is for moving arrays from field data to point or cell data 
within the same vtkDataSet. In your case, you have a vtkUnstructuredGrid 
and a separate vtkFieldData. Instead of


set numarray [$f0 GetNumberOfArrays]
for {set i 0} {$i < $numarray} {incr i} {
         if { [$f0 GetArrayName $i] == "DISPLACE" } {
                 set dispNumArray $i
         }
}

vtkDoubleArray Disp
         Disp DeepCopy [$f0 GetArray $dispNumArray]

vtkFieldDataToAttributeDataFilter resfd2ad2
         resfd2ad2 SetInput [Ureader GetOutput]
         resfd2ad2 SetInputFieldToPointDataField
         resfd2ad2 SetOutputAttributeDataToPointData
         resfd2ad2 SetVectorComponent 0 Disp 0
         resfd2ad2 SetVectorComponent 1 Disp 1
         resfd2ad2 SetVectorComponent 2 Disp 2

# un-deformed mesh
vtkGeometryFilter surf2
         surf2 SetInput [Ureader GetOutput]


try the following

vtkUnstructuredGrid uGrid
uGrid DeepCopy [UReader GetOutput]
[uGrid GetPointData] SetVectors [$f0 GetArray "DISPLACE"]  # This will work 
if you have an array named "DISPLACE".

vtkGeometryFilter surf2
surf2 SetInput $uGrid

- Amy

At 04:35 AM 10/26/2004, Gil wrote:
>Hi Amy,
>
>When I DeepCopy the displacements array from the field, 
>vtkFieldDataToAttributeDataFilter tells me :
>"ERROR: In 
>C:\martink\vtk42\VTK\Graphics\vtkFieldDataToAttributeDataFilter.cxx, line 477
>vtkFieldDataToAttributeDataFilter (0x00619AD0): Can't find array requested"
>Any Idea?
>Thanks,
>Gil
>---
>----- Original Message ----- From: "Amy Henderson" <amy.henderson at kitware.com>
>To: "Gil at FEMplusplus.com" <gil at femplusplus.com>; "vtkusers" 
><vtkusers at vtk.org>
>Sent: Monday, October 25, 2004 11:26 PM
>Subject: Re: [vtkusers] Problem upgrading from VTK3.1 (UG+Field)
>
>
>>Hi Gil,
>>
>>Maybe you've seen this already, this section of the VTK FAQ (now in the 
>>VTK wiki) should be of help to you: 
>>http://www.vtk.org/Wiki/VTK_FAQ#Changes_in_VTK_between_3.2_and_4.0. In 
>>VTK 4.2, vtkPointData is a subclass of vtkFieldData. The SetFieldData 
>>method has been removed. Try using ShallowCopy or DeepCopy instead.
>>
>>- Amy
>>
>>At 05:08 PM 10/25/2004, Gil at FEMplusplus.com wrote:
>>>Hi,
>>>When upgrading an old application from VTK3.1 to VTK4.2 I get the 
>>>following error:
>>>"...could not find the requested method: SetFieldData...  while 
>>>executing [[Ureader GetOutput] GetPointData] SetFieldData $f"
>>>What the program tries to do is to read an Unstructured grid and its 
>>>results field from different files, and display the deformed grid (and 
>>>eventually other results).
>>>
>>>Searching the lists, I know that there have been many changes in the 
>>>FieldData area, but couldn't figure how to change the code.
>>>A simplified tcl file+data files are attached.
>>>
>>>Can anyone help?
>>>Thanks,
>>>Gil
>>>
>>>Email: <mailto:gil at femplusplus.com>gil at femplusplus.com
>>>---
>>>
>>>
>>>
>>>_______________________________________________
>>>This is the private VTK discussion list.
>>>Please keep messages on-topic. Check the FAQ at: 
>>><http://public.kitware.com/cgi-bin/vtkfaq>
>>>Follow this link to subscribe/unsubscribe:
>>>http://www.vtk.org/mailman/listinfo/vtkusers
>>
>>
>
>
>
>_______________________________________________
>This is the private VTK discussion list.
>Please keep messages on-topic. Check the FAQ at: 
><http://public.kitware.com/cgi-bin/vtkfaq>
>Follow this link to subscribe/unsubscribe:
>http://www.vtk.org/mailman/listinfo/vtkusers






More information about the vtkusers mailing list