[Paraview] Reading C-ordered data from hdf5

John R. Cary cary at txcorp.com
Fri Aug 15 10:52:45 EDT 2008


Thanks for your response.  A few more questions.

Dominik Szczerba wrote:
> Depends what format you are talking about. Converting to legacy VTK, 
> yes, this is inefficient in every regard. 

Apologies for not knowing about legacy VTK.  Does this imply that the
newer VTK uses C ordering by default?  If so, in what version did it
change?

Thanks again.....John Cary

> If you are knowledgable to program in hdf5 you may consider writing a 
> plugin that will import your data without file conversions. However, 
> you will probably have to convert rank-2 arrays anyway:
>
>     // FIXME can it be done smarter
>     for(int j=0; j<array->GetNumberOfTuples(); j++)
>     {
>         for(int i=0; i<array->GetNumberOfComponents(); i++)
>         {
>             array->SetComponent(j,i,data(j+1,i+1));
>         }
>     }
>
> where data is a fortran style array. I wonder too if SetData would 
> work here.

>
> -- Dominik
>
>
> John R. Cary wrote:
>> I have arrays written out from C into HDF5 using the HDF5 C
>> API, and so in the file the arrays are in C ordering.  I now
>> need to read them into VTK.  AFAICT, VTK is Fortran ordering,
>> even though it is written in C++.  So that means I need to
>> reverse the ordering.  Of course, I can write a loop to do
>> this, but is there some standard way that VTK folks do this?
>> I don't want to reinvent the wheel.
>>
>> Sorry for what is likely an elementary question, but I could
>> not find it on the FAQ or after googling quite a bit.
>>
>> Thanks so much......John Cary
>>
>>
>



More information about the ParaView mailing list