2

I have a 5 dimensional matrix in an hdf5 data file. I would like to plot this data using paraview. The solution I have in mind is describing the data via the Xdmf Format.

The 5 dimensional matrix is structured as follows:

matrix[time][type][x][y][z]

The 'time' index specifies a time step. The 'type' selects the matrices for different particle types. And x,y,z describes the spatial coordinates of a grid. The value of the matrix is a Scalar that I would like to plot.

My question is: How can I select a specific 3 dimensional matrix for a given time step and type to plot, using the xdmf format? Ideally the timestep can be represented by the <time> functionality of Xdmf.

I tried the 'hyperslab' functionality of xdmf, but that seems to not reduce the dimensionallity to, which I need to to plot the grid.

I also had a look at the 'SubSet' functionality, but I did not understand how to use it, by reading the official documentation at xdmf.

Mr Lister
  • 45,515
  • 15
  • 108
  • 150
mel
  • 399
  • 2
  • 6

1 Answers1

3

With help of the mailing list of Xdmf I found a solution that works for me.

My input matrix is 5-dim (1,2,12,6,6) in the hdf5 file "ana.h5" and I select timestep 0 and type 1.

<?xml version="1.0" ?>
<!DOCTYPE Xdmf SYSTEM "Xdmf.dtd" []>
<Xdmf xmlns:xi="http://www.w3.org/2003/XInclude" Version="2.2">

 <Domain>
  <Topology name="topo" TopologyType="3DCoRectMesh" Dimensions="12 6 6"></Topology>
  <Geometry name="geo" Type="ORIGIN_DXDYDZ">
   <!-- ORigin -->
   <DataItem Format="XML" Dimensions="3">
    0.0 0.0 0.0
   </DataItem>
   <!-- DxDyDz -->
   <DataItem Format="XML" Dimensions="3">
    1 1 1
   </DataItem>
  </Geometry>

  <Grid Name="TimeStep_0" GridType="Uniform">
   <Topology Reference="/Xdmf/Domain/Topology[1]"/>
   <Geometry Reference="/Xdmf/Domain/Geometry[1]"/>
   <Time Value="64"/>

   <Attribute Type="Scalar" Center="Cell" Name="Type1">
    <!-- Result will be 3 dimensions -->
    <DataItem ItemType="HyperSlab" Dimensions="12 6 6 ">
    <!-- The source is 5 dimensions -->
    <!-- Origin=0,1,0,0,0  Stride=1,1,1,1,1 Count=1,1,12,6,6 -->
    <DataItem Dimensions="3 5" Format="XML">
     0 1 0 0 0
     1 1 1 1 1
     1 1 12 6 6
    </DataItem> 
    <DataItem Format="HDF" NumberType="UInt" Precision="2" Dimensions="1 2 12 6 6 ">
     ana.h5:/density_field
    </DataItem>
   </DataItem>
  </Attribute>
</Grid>
</Domain>
</Xdmf>

The resulting matrix is 3 dimensional (12,6,6) and plotable with paraview.

mel
  • 399
  • 2
  • 6