[Paraview] storing tensors in hdf5?

Toon tweyens at fis.uc3m.es
Wed Mar 11 10:09:13 EDT 2015


Pratik Mallya <pratik.mallya <at> gmail.com> writes:

> 
> Pratik Mallya wrote:
> > Pratik Mallya wrote:
> >> Well, that is why i chose the subject title to be so :).
> >> In particular, I since I am using numpy (and h5py) to calculate the 
> >> tensor, I am storing the result (a 256X256X9 ndarray named Q) into h5 
> >> file by using a command of the form:
> >> g.create_dataset("Q", data=Q)
> >> Does the problem lie here? Am i supposed to use a different 
> >> format/function of h5py, or something?  Because I can see the .h5 
> >> file using hdfview, and it seems perfectly all right.
> >>
> >>
> > I figured out a workaround: although my h5 file has nine component(3 
> > are redundant since it is a symmetric tensor) i am reading it as a 6 
> > component tensor, and paraview is now able to read it!
> > I wonder why this is the case? I have already detailed the code in 
> > previous mail; can someone please tell me why it is working like this?
> >
> > Thanks in anticipation.
> >
> Well...no one seemed to have cared to reply.
> Anyways, it turns out that in the xdmf file, if you supply the dimension 
> as one less than what is present in the .h5 file, then the xdmf reader 
> can properly read the thing. e.g since the tensors i was storing were in 
> the shape (1,9) (each tensor), i gave the topology as "1 8", and then it 
> read the data, no complaints and perfect plot :).
> 

Thank you Pratik! I have had similar problems when I tried to read my old 
XDMF files after reinstalling my whole system.

It appears that sometimes I used 3 dimensions for 2D plots (even though I 
still defined it as 2D, for example with 2Dsmesh). One of the dimensions 
would then be 1, of course.

This never gave me problems in the past but now it did.

The solution was to adapt my XDMF routines to output only the indices that 
are bigger than 1. Now it works!

Thanks again!





More information about the ParaView mailing list