[Paraview] Reading C-ordered data from hdf5

Dominik Szczerba dominik at itis.ethz.ch
Fri Aug 15 02:56:17 EDT 2008


Depends what format you are talking about. Converting to legacy VTK, 
yes, this is inefficient in every regard. 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
> 
> 

-- 
Dominik Szczerba, Ph.D.
Foundation for Research
on Information Technologies in Society
http://www.itis.ethz.ch


More information about the ParaView mailing list