[vtkusers] Error in vtkStructuredGridReader

Amy Squillacote ahs at cfdrc.com
Tue Aug 5 11:52:05 EDT 2008


Thomas Obenaus wrote:
> Amy Squillacote wrote:
>
>   
>> Thomas Obenaus wrote:
>>
>>     
>>> Hello,
>>>
>>> i have a problem. I don't know if it's my fault or if the
>>> vtkStructuredGridReader has a bug. I'm using VTK
>>> via the offered Java-Wrapper.
>>> All I want to do is to load a vtk-file with the vtkStructuredGridReader.
>>> This data is special because there are defined two
>>> dataset attributes of the same type (VECTORS). Per specification the
>>> definition of more than one dataset attribute of the same type in one
>>> file is allowed.
>>> the problem is that I can't access the two vectorfields. Using the
>>> function getVectors("name") should do that for me. But I can only get
>>> the first vectorfield.
>>> If I want to access the second one the function returns null.
>>>
>>> Here is an example of the file I want to read:
>>>
>>> # vtk DataFile Version 1.0
>>> vtk output
>>> ASCII
>>> DATASET STRUCTURED_GRID
>>> DIMENSIONS 5 2 1
>>> POINTS 10 float
>>> -3.00E+00 -3.00E+00 -3.00E+00
>>> -3.00E+00 -3.00E+00 -5.00E-01
>>> -3.00E+00 -3.00E+00 2.00E+00
>>> -3.00E+00 -3.00E+00 4.50E+00
>>> -3.00E+00 -3.00E+00 7.00E+00
>>> -3.00E+00 3.00E+00 -3.00E+00
>>> -3.00E+00 3.00E+00 -5.00E-01
>>> -3.00E+00 3.00E+00 2.00E+00
>>> -3.00E+00 3.00E+00 4.50E+00
>>> -3.00E+00 3.00E+00 7.00E+00
>>>
>>> POINT_DATA 10
>>> VECTORS field1 float
>>> -1.790149E-4 3.204499E-4 5.385784E-4
>>> -1.790149E-4 3.204499E-4 -5.385784E-4
>>> -2.197622E-4 2.168404E-19 8.989287E-4
>>> -2.197622E-4 5.421011E-20 -8.989287E-4
>>> -1.790149E-4 -3.204499E-4 5.385784E-4
>>> -1.790149E-4 -3.204499E-4 -5.385784E-4
>>> -1.790149E-4 -3.204499E-4 -5.385784E-4
>>> -1.790149E-4 -3.204499E-4 5.385784E-4
>>> -2.197622E-4 2.439455E-19 -8.989287E-4
>>> -2.197622E-4 5.421011E-20 8.989287E-4
>>>
>>> VECTORS field2 float
>>> -1.790149E-4 3.204499E-4 5.385784E-4
>>> -1.790149E-4 3.204499E-4 -5.385784E-4
>>> -2.197622E-4 2.168404E-19 8.989287E-4
>>> -2.197622E-4 5.421011E-20 -8.989287E-4
>>> -1.790149E-4 -3.204499E-4 5.385784E-4
>>> -1.790149E-4 -3.204499E-4 -5.385784E-4
>>> -1.790149E-4 -3.204499E-4 -5.385784E-4
>>> -1.790149E-4 -3.204499E-4 5.385784E-4
>>> -2.197622E-4 2.439455E-19 -8.989287E-4
>>> -2.197622E-4 5.421011E-20 8.989287E-4
>>>
>>> For the functioncall vtkDataSet v1 =
>>> reader.GetOutPut().GetPointData().GetVectors( "field1" ) I get the first
>>> vectorfield (CORRECT).
>>> But for the functioncall vtkDataSet v2 =
>>> reader.GetOutPut().GetPointData().GetVectors( "field2" )  v2 is null
>>> (FAILURE).
>>>
>>>   
>>>       
>> Have you tried reader.GetOutput().GetPointData().GetArray( "field2" ); ?
>>
>> - Amy
>>
>>     
>>> Thanks,
>>> Thomas Obenaus.
>>>
>>> _______________________________________________
>>> This is the private VTK discussion list.
>>> Please keep messages on-topic. Check the FAQ at:
>>> http://www.vtk.org/Wiki/VTK_FAQ
>>> Follow this link to subscribe/unsubscribe:
>>> http://www.vtk.org/mailman/listinfo/vtkusers
>>>
>>>
>>>   
>>>       
>>     
> Yes I tried...same result. I also have printed the number of the read
> arrays to my console via 
> reader.GetOutput().GetPointData().GetNumberOfArrays( ), the function
> returns 1 for my examle (failure 2 was expected).
> But if I define the second vectorfield (field2) as a field of scalars
> the function returns 2 (correct). I don't know why the reader doesn't
> read two or more dataset attributes of the same type.
>
> -Thomas
>   

I'm copying this back to the vtkusers list so other people can help you 
find an answer and so the conversation is archived.

- Amy

-- 
Amy Squillacote                    Phone: (256) 726-4839
Computer Scientist                 Fax: (256) 726-4806
CFD Research Corporation           Web: http://www.cfdrc.com
215 Wynn Drive, Suite 501
Huntsville, AL  35805





More information about the vtkusers mailing list