[Paraview] storing tensors in hdf5?

Felipe Bordeu felipe.bordeu at ec-nantes.fr
Sat Apr 9 06:47:28 EDT 2011


hi,

I tried open a xdmf file like yours but everything in xml, and works  
fine, (using paraview 3.8.1 32-bit on OSX)

maybe the problem is in your H5 file.

good luck.

<?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 = "2 2">
                   </Topology>
                   <Geometry GeometryType="X_Y">
                           <DataItem Dimensions="2 2 "  
NumberType="Float" Precision="4" Format="XML">
                               0 1 0 1
                           </DataItem>
                           <DataItem Dimensions="2 2 "  
NumberType="Float" Precision="4" Format="XML">
                               0 0 1 1
                           </DataItem>
                   </Geometry>
                   <Attribute Name="sig" Center="Node"   
AttributeType="Tensor">
                       <DataItem  Format="XML" NumberType="Float"  
Dimensions="2 2 9" Precision="8">
                           1 2 3 4 5 6 7 8 9
                           2 3 4 5 6 7 8 9 10
                           3 4 5 6 7 8 9 10 11
                           4 5 6 7 8 9 10 11 12
                       </DataItem>
                   </Attribute>                </Grid>
           </Grid>
       </Grid>
   </Domain>
</Xdmf>

Le 9 avr. 11 à 07:21, Pratik Mallya a écrit :

> 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
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the ParaView Wiki at: http://paraview.org/Wiki/ParaView
>
> Follow this link to subscribe/unsubscribe:
> http://www.paraview.org/mailman/listinfo/paraview


Felipe Bordeu Weldt
Ingénieur de Recherche
---------------------------------------------------------------------------
Tél. : +33 2 40 37 16 57
Fax. : +33 2 40 74 74 06
felipe.bordeu at ec-nantes.fr
Institut en Génie Civil et Mécanique (GeM)
École Centrale de Nantes, Université de Nantes, CNRS
1 rue de la Noë BP 92101
44321 Nantes Cedex 3
---------------------------------------------------------------------------


More information about the ParaView mailing list