[vtkusers] Error in vtkStructuredGridReader

Amy Squillacote ahs at cfdrc.com
Tue Aug 5 09:05:06 EDT 2008


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
>
>
>   

-- 
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