XDMF3 file format

Share the page with

XDMF3 file format

Overview of XDMF3

![[xdmf_struct.png]]

DataItem

DataItem element is used to define the data format portion of XDMF. It is

Uniform

To handle small data we can use XML format as shown below:

<DataItem 
          Name = "Test data"
          ItemType="Uniform"
          Format="XML"
          NumberType="Float"
          Precision="4"
          Rank="1"
          Dimensions="3">
          1.0 2.0 3.0
</DataItem>

To handle big data we can use HDF5 format as shown below:

<DataItem 
          Name = "Pressure data"
          ItemType="Uniform"
          Format="HDF"
          NumberType="Float"
          Precision="8"
          Dimensions="64 128 256">
          output.h5:/Results/Iteration_100/Part_2/Pressure
</DataItem>

Collection and Tree

<DataItem ItemType="Tree">
    <DataItem ItemType="Tree">
        <DataItem Name = "Collection 1" ItemType="Collection">
            <DataItem
                Name = "Data 1"
                Format="XML"
                NumberType="Float"
                Precision="4"
                Rank="1"
                Dimensions="3">
                1.0 2.0 3.0
            </DataItem>
    
            <DataItem
                Name = "Data 2"
                Format="XML"
                NumberType="Float"
                Precision="4"
                Rank="1"
                Dimensions="4">
                1.0 2.0 3.0 4.0
            </DataItem>
        </DataItem>
    </DataItem>

    <DataItem Name = "Collection 2" ItemType="Collection">
        <DataItem
            Name = "Data 3"
            Format="XML"
            NumberType="Float"
            Precision="4"
            Rank="1"
            Dimensions="3">
            1.0 2.0 3.0
        </DataItem>

        <DataItem
            Name = "Data 4"
            Format="XML"
            NumberType="Float"
            Precision="4"
            Rank="1"
            Dimensions="4">
            1.0 2.0 3.0 4.0
        </DataItem>
    </DataItem>

    <DataItem
        Name = "Data 5"
        Format="XML"
        NumberType="Float"
        Precision="4"
        Rank="1"
        Dimensions="4">
        1.0 2.0 3.0 4.0
    </DataItem>

</DataItem>

This DataItem is a tree with three children:

HyperSlab

Coordinate

Function

Grid

The data model portion of XDMF begins with the Grid element. A Grid is a container for information related to 2D and 3D points, structured or unstructured connectivity, and assigned values.

The grid element has following look.

<Grid ...>
    ...
</Grid>

Grid attributes

GridType

For a Grid element we should specify the attribute GridType, we have following Grid types:

Uniform

A homogeneous single grid, for example collection of linear quadrangle elements. Uniform grids should contain a Topology and Geometry element.

<Grid
      name="Car Wheel"
      GridType="Uniform">
      <Topology>
      ...
      </Topology>
      <Geometry>
      ...
      </Geometry>
</Grid>

Collection

An array of uniform grids all with the same Attributes. We should specify the CollectionType attribute:

<Grid
    name="Lug nuts"
    GridType="Collection"
    CollectionType="Spatial">
    <Grid
        name="Lug nuts 0"
        GridType="Uniform">
        <Topology>
        ...
        </Topology>
        <Geometry>
        ...
        </Geometry>
    </Grid>
    <Grid
        name="Lug nuts 1"
        GridType="Uniform">
        <Topology>
        ...
        </Topology>
        <Geometry>
        ...
        </Geometry>
    </Grid>
</Grid>

Tree

A hierarchical group

Subset

A SubSet GridType is used to define a portion of another grid or define new attributes on the grid. This allows users to share the geometry and topology of another grid, the attributes from the original grid are not assigned.

Subset Grid has an attribute called Section which has value DataItem or All.

<Grid
    Name="Portion"
    GridType="Subset"
    Section="DataItem">
    <DataItem
        DataType="Int"
        Dimension="2"
        Format="XML">
        0 2
    </DataItem>
    <Grid
        Name="Target"
        Reference="XML">
        /Xdmf/Domain/Grid[@Name="Main Grid"]
    </Grid>
</Grid>

Topology

The topology element describes the general organization of the data. For structured grid, the connectivity is implicit. For unstructured grid, if the connectivity differs from the standard.

We have following attributes for the Topology element:

TopologyType

Mixed

Mixed topology enables to define a mixture of unstructured cells. A cell defined in a mixed topology is made of a type (integer value) and a list of associated data (integer value) describing the cell. The list of data describing each cell depends upon the cell type. Mixed topology must define the cell type of every element.

Cell type for TopologyType="Mixed":

CellType ID
POLYVERTEX 1
POLYLINE 2
POLYGON 3
POLYHEDRON 16
TRIANGLE 4
QUADRILATERAL 5
TETRAHEDRON 6
PYRAMID 7
WEDGE 8
HEXAHEDRON 9
EDGE_3 34
QUADRILATERAL_9 35
TRIANGLE_6 36
QUADRILATERAL_8 37
TETRAHEDRON_10 38
PYRAMID_13 39
WEDGE_15 40
WEDGE_18 41
HEXAHEDRON_20 48
HEXAHEDRON_24 49
HEXAHEDRON_27 50

Cell data for POLYGON:

Cell data for POLYHEDRON:

Structured

Geometry

The Geometry element describes the XYZ values of the mesh.

Following attributes are available:

Examples:

<Geometry GeometryType="XYZ">
    <DataItem 
        Format="XML" 
        Dimensions="2 4 3">
        0.0    0.0    0.0
        1.0    0.0    0.0
        1.0    1.0    0.0
        0.0    1.0    0.0 
        0.0    0.0    2.0
        1.0    0.0    2.0
        1.0    1.0    2.0
        0.0    1.0    2.0
    </DataItem>
</Geometry>

Attribute

Attribute element defines values associated with the mesh. There are three attributes which defines what type of data is associated with the mesh.

AttributeType

Center

ItemType

FiniteElementFunction

When we use ItemType=FiniteElementFunction we should specify another attribute called ElementFamily, ElementDegree and ElementCell.

ElementFamily can take following values:

ElementDegree can take arbitrary value.

ElementCell can take following values:

Example: Vector FiniteElementFunction of ElementFamily=CG and ElementDegree=1, and ElementCell=triangle :

<Attribute 
    ItemType="FiniteElementFunction" 
    ElementFamily="CG" 
    ElementDegree="1" 
    ElementCell="triangle" 
    Name="u" 
    Center="Other" 
    AttributeType="Vector">
    <DataItem 
        Dimensions="8 6" 
        NumberType="UInt" 
        Format="XML">
        6 12 8 7 13 9
        6 2 8 7 3 9
        12 16 14 13 17 15
        12 8 14 13 9 15
        2 8 4 3 9 5 
        2 0 4 3 1 5
        8 14 10 9 15 11
        8 4 10 9 5 11
    </DataItem>
    <DataItem 
        Dimensions="18 1" 
        NumberType="Float" 
        Format="XML">
        0
        1
        0
        0.5
        0.5
        1
        0
        0
        0.5
        0.5
        1
        1
        0.5
        0
        1
        0.5
        1
        0
    </DataItem>
</Attribute>

When we use ItemType=FiniteElementFunction, then we must provide at least 2 children DataItem elements. They are defined in the following order:

Indices to DOF values, which defines indices to DOF values. These are finite element wise indices to the second DataItem array.

DOF values, which defines values of degree of freedom.

Example 1

<?xml version="1.0" ?>
<!DOCTYPE Xdmf SYSTEM "Xdmf.dtd" []>
<Xdmf Version="2.0" xmlns:xi="[http://www.w3.org/2001/XInclude](http://www.w3.org/2001/XInclude)">
  <Domain>
    <Grid Name="TestGrid">
      <Topology TopologyType="Hexahedron" NumberOfElements="2" >
        <DataItem Format="XML" DataType="Float"
        Dimensions="2 8">
        0 1 7 6   3 4 10 9
        1 2 8 7   4 5 11 10
      </DataItem>
    </Topology>
    <Geometry Type="XYZ">
      <DataItem Format="XML" DataType="Float" Precision="8"
      Dimensions="4 3 3">
      0.0   0.0   1.0
      1.0   0.0   1.0
      3.0   0.0   2.0

      0.0   1.0   1.0
      1.0   1.0   1.0
      3.0   2.0   2.0

      0.0   0.0   -1.0
      1.0   0.0   -1.0
      3.0   0.0   -2.0

      0.0   1.0   -1.0
      1.0   1.0   -1.0
      3.0   2.0   -2.0
    </DataItem>
  </Geometry>
  <Attribute AttributeType="Scalar" Name="NodeValues" Center="Node">
    <DataItem Format="XML" DataType="Float" Precision="8"
    Dimensions="4 3" >
    100 200 300
    300 400 500
    300 400 500
    500 600 700
  </DataItem>
</Attribute>
<Attribute Name="CellValues" Center="Cell">
  <DataItem Format="XML" DataType="Float" Precision="8"
  Dimensions="2" >
  100 200
</DataItem>
</Attribute>
</Grid>
</Domain>
</Xdmf>
Share the page with