[Paraview] storing tensors in hdf5?

Pratik Mallya pratik.mallya at gmail.com
Sat Apr 9 01:21:08 EDT 2011


Hi everyone,
I wanted to first store a tensor (symmetric, but yet 9 components; will 
reduce this later) in an h5 format to be then read by paraview. The way 
i did it was to calculate the 3X3 matrix at every point (from given data 
) and then changed the shape(in python, using numpy arrays) to a 1X9 
array, and then stored this in an h5 file (all using the h5py library of 
python and numpy).
But when i try to read the file, although the grid appears correctly, 
paraview says that it is unable to read the data:

ERROR: In 
/home/pratik/Manually_Installed_Softwares/numerical/ParaView/ParaView-3.10.0/Utilities/Xdmf2/vtk/vtkXdmfHeavyData.cxx, 
line 1102

vtkXdmfReader (0xaeee8a8): Failed to read attribute data


hmm..i do have the grid and the calculated tensor in different h5 files 
(does that make a difference?). Can anyone please suggest what is wrong 
with this? Is the format of storing the tensor data correct?
It is a 256X256 2dsmesh, so i gave:
  <DataItem  Format="HDF" NumberType="Float" Dimensions="256 256 9" 
Precision="8">
in the xml file for the attribute of the tensor

here is the full xml file:
<?xml version="1.0" ?>
<!DOCTYPE Xdmf SYSTEM "Xdmf.dtd" []>
<Xdmf>
    <Domain Name="test.xdmf">
        <Grid Name="Domain Space x Time" GridType="Collection" 
CollectionType="Temporal">
            <Time TimeType="List">
                <DataItem Format="XML" NumberType="Float" Dimensions="1">
                    0.000000
                </DataItem>
            </Time>
            <Grid Name="Time 1" GridType="Collection">
                <Grid Name="Domain 1x1x1">
                    <Topology TopologyType="2DSMesh" Dimensions = "256 256">
                    </Topology>
                    <Geometry GeometryType="X_Y">
                            <DataItem Dimensions="256 256" 
NumberType="Float" Precision="4" Format="HDF">
                                Rxdmf2d.h5:/X
                            </DataItem>
                            <DataItem Dimensions="256 256 " 
NumberType="Float" Precision="4" Format="HDF">
                                Rxdmf2d.h5:/Y
                            </DataItem>
                    </Geometry>
                    <Attribute Name="sig" Center="Node"  
AttributeType="Tensor">
                        <DataItem  Format="HDF" NumberType="Float" 
Dimensions="256 256 9" Precision="8">
                            Q.h5:/Q
                        </DataItem>
                    </Attribute> 
                </Grid>
            </Grid>
        </Grid>
    </Domain>
</Xdmf>


-- 
*Pratik Mallya*
http://en.wikipedia.org/wiki/User:Pratik.mallya


More information about the ParaView mailing list