[Paraview] XDMF: multiple DataItems under Geometry

Xunlei Wu xunlei at renci.org
Sun Feb 28 09:18:46 EST 2010


Hi All,

I have a Lagrange grid in 3D (e.g. 80 x 80 x 80) in HDF5 format. And my
grid coordinates are arranged into 3 vectors, i.e. x, y, z. So far, I
can only build the XDMF geometry successfully as

<Geometry GeometryType="XYZ">
<DataItem NumberType="Float" Precision="4" Dimensions="512000 3"
Format="HDF">xxx.h5:/Event/xyz</DataItem>
</Geometry>

by using XDMF API in C

XdmfValuesHDF* x_ValuesHDF;
XdmfString x_String = x_ValuesHDF->DataItemFromHDF(h5_string);
x_Geometry->SetDataXml(x_String);

However in this case ("XYZ"), I need one for loop to construct the
512000x3 array (xyz) from the three vectors: x, y, z. This is quite
costly. If I want to build the geometry type as "X_Y_Z", e.g.

<Geometry GeometryType="X_Y_Z">
<DataItem NumberType="Float" Precision="4" Dimensions="3 512000"
Format="HDF">xxx.h5:/Event/x_y_z</DataItem>
</Geometry>

ParaView only recognizes the x component while assign all y's and z's to
ZERO. Is there a bug in XDMF API or ParaView? Ideally, I would like to
build sth. like

<Geometry GeometryType="X_Y_Z">
<DataItem NumberType="Float" Precision="4" Dimensions="80 80 80"
Format="HDF">xxx.h5:/Event/x</DataItem>
<DataItem NumberType="Float" Precision="4" Dimensions="80 80 80"
Format="HDF">xxx.h5:/Event/y</DataItem>
<DataItem NumberType="Float" Precision="4" Dimensions="80 80 80"
Format="HDF">xxx.h5:/Event/z</DataItem>
</Geometry>

*How can I insert multiple XdmfDataItem's in XdmfGeometry class?* I've tried

XdmfDataItem* x_DataItem;
x_DataItem = new XdmfDataItem;
x_Geometry->Insert(x_DataItem);
x_DataItem->SetDataXml(x_String_for_x_vector);

x_DataItem = new XdmfDataItem;
x_Geometry->Insert(x_DataItem);
x_DataItem->SetDataXml(x_String_for_y_vector);

x_DataItem = new XdmfDataItem;
x_Geometry->Insert(x_DataItem);
x_DataItem->SetDataXml(x_String_for_z_vector);

This produces

<Geometry GeometryType="X_Y_Z">
<DataItem ...>
<DataItem NumberType="Float" Precision="4" Dimensions="80 80 80"
Format="HDF">xxx.h5:/Event/x</DataItem>
</DataItem>
<DataItem ...>
<DataItem NumberType="Float" Precision="4" Dimensions="80 80 80"
Format="HDF">xxx.h5:/Event/y</DataItem>
</DataItem>
<DataItem ...>
<DataItem NumberType="Float" Precision="4" Dimensions="80 80 80"
Format="HDF">xxx.h5:/Event/z</DataItem>
</DataItem>
</Geometry>

which causes ParaView to crash. I have also tried

XdmfDataItem* x_DataItem;
x_DataItem = new XdmfDataItem;
x_Geometry->Insert(x_DataItem);
x_DataItem->SetName("x");
x_DataItem->Set("NumberType", "Float");
x_DataItem->Set("Precision", "4");
x_DataItem->SetShape(3, [80 80 80]);
x_DataItem->SetFormat(XDMF_FORMAT_HDF);
x_DataItem->SetHeavyDataSetName(h5_string_for_x);
...
//y and z portions are similar to that of x.

This produces

<Geometry GeometryType="X_Y_Z">
<DataItem NumberType="Float" Precision="4" Dimensions="3"
Format="HDF">xxx.h5:/Event/x</DataItem>
<DataItem NumberType="Float" Precision="4" Dimensions="3"
Format="HDF">xxx.h5:/Event/y</DataItem>
<DataItem NumberType="Float" Precision="4" Dimensions="3"
Format="HDF">xxx.h5:/Event/z</DataItem>
</Geometry>

This is the closest to what I want. Unfortunately the data shape is
wrong. No matter what I send in SetShape(), the produced XMF has
Dimensions="3". Is there a BUG in XDMF API?

Please help. Thanks a lot.

Best,
xunlei


More information about the ParaView mailing list